ATC, Facebook开源模拟网络环境的工具
2015-07-20 16:11
579 查看
Augmented Traffic Control (ATC) 是Facebook开源的一款移动网络测试工具,可以模拟各种网络环境。开发者可以通过ATC配置移动设备连接的网络的状况,可以模拟高速的、或者移动网络下受限的网络。
通过ATC可以控制网络的下述方面:
1. Bandwith,带宽
2. Latency, 延迟
3. Packet loss, 丢包率
4. Packet corruption,错包率
5. Packet reordering,乱序率
通过上面参数的设置,可以模拟出各类常用的网络环境,例如2G,3G,4G,WiFi等等。可以参考Comcast中的参数配置。
ATC is designed to be running on:
A Network Getaway: ATC will shape the traffic that is forwarded through it. To do this, ATC will typically have 1 network interface conencted to your local network and an other that connects you to the internet.
Linux: ATC makes uses of both iptables and the tc subsystem. As such, Linux is a hard requirement.
Python 2.7: Currently, ATC is only supported on python version 2.7.
我们首先要注意ATC需要使用iptable和tc的支持,因此只能在Linux系统上使用,此外目前ATC只支持python2.7。本文直接在Ubuntu14.04真机上完成环境的搭建。
安装python2.7以及pip
Ubuntu14.04自带了python2.7,如果系统没有安装,先安装python2.7。然后安装pip:
使用pip安装需要的ATC组件
部署和安装ATC的Django web工程
使用django-admin生成一个新的django工程:
修改/atcui/setting.py,按照在INSTALLED_APPS中增加相关内容
修改atcui/urls.py,在urlpatterns中增加ATC的url页面:
最后,执行migrate命令,更新数据库
启动AP热点,运行ATC
根据上文中设置的AP热点,启动AP热点,然后启动ATC组件。
上述命令表示使用eth0网卡作为公网连接,wlan0作为AP内网连接。
5. 运行ATC UI
通过上述配置,我们就可以在连接上AP热点的手机浏览器上访问ATC UI。例如我设置本机的wlan0的ip是192.168.0.1,直接通过http://192.168.0.1:8000访问到控制界面。
我们可以在上述的表达中填入想设置的丢包率吧、延迟等参数,就可以控制手机访问的网络环境。
【参考】
1. Augmented Traffic Control
2. Facebook网络模拟测试工具ATC使用
3. Ubuntu 14.04 快速创建无线接入点供移动设备连接上网
通过ATC可以控制网络的下述方面:
1. Bandwith,带宽
2. Latency, 延迟
3. Packet loss, 丢包率
4. Packet corruption,错包率
5. Packet reordering,乱序率
通过上面参数的设置,可以模拟出各类常用的网络环境,例如2G,3G,4G,WiFi等等。可以参考Comcast中的参数配置。
ATC安装
Important: Before trying to install ATC, please make sure you meet the following requirements.ATC is designed to be running on:
A Network Getaway: ATC will shape the traffic that is forwarded through it. To do this, ATC will typically have 1 network interface conencted to your local network and an other that connects you to the internet.
Linux: ATC makes uses of both iptables and the tc subsystem. As such, Linux is a hard requirement.
Python 2.7: Currently, ATC is only supported on python version 2.7.
我们首先要注意ATC需要使用iptable和tc的支持,因此只能在Linux系统上使用,此外目前ATC只支持python2.7。本文直接在Ubuntu14.04真机上完成环境的搭建。
在Ubuntu中设置WiFi热点
直接参考Ubuntu 14.04 快速创建无线接入点供移动设备连接上网,讲解的很详细。我按照上面的配置以后,手机一直收不到AP热点,重启一下才收到,坑了很多时间……)ATC环境搭建
官网上已经给出了很详细的介绍,可以参考Augmented Traffic Control。下面我实际的配置过程。安装python2.7以及pip
Ubuntu14.04自带了python2.7,如果系统没有安装,先安装python2.7。然后安装pip:
sudo apt-get install python-pip python-dev build-essential sudo pip install --upgrade pip
使用pip安装需要的ATC组件
pip install atc_thrift atcd django-atc-api django-atc-demo-ui django-atc-profile-storage
部署和安装ATC的Django web工程
使用django-admin生成一个新的django工程:
django-admin startproject atcui
修改/atcui/setting.py,按照在INSTALLED_APPS中增加相关内容
INSTALLED_APPS = ( ... # Django ATC API 'rest_framework', 'atc_api', # Django ATC Demo UI 'bootstrap_themes', 'django_static_jquery', 'atc_demo_ui', # Django ATC Profile Storage 'atc_profile_storage', )
修改atcui/urls.py,在urlpatterns中增加ATC的url页面:
... from django.views.generic.base import RedirectView urlpatterns = patterns('', ... # Django ATC API url(r'^api/v1/', include('atc_api.urls')), # Django ATC Demo UI url(r'^atc_demo_ui/', include('atc_demo_ui.urls')), # Django ATC profile storage url(r'^api/v1/profiles/', include('atc_profile_storage.urls')), url(r'^$', RedirectView.as_view(url='/atc_demo_ui/', permanent=False)), )
最后,执行migrate命令,更新数据库
python manage.py migrate
启动AP热点,运行ATC
根据上文中设置的AP热点,启动AP热点,然后启动ATC组件。
sudo atcd --atcd-wan eth0 --atcd-lan wlan0
上述命令表示使用eth0网卡作为公网连接,wlan0作为AP内网连接。
5. 运行ATC UI
python manage.py runserver 0.0.0.0:8000
通过上述配置,我们就可以在连接上AP热点的手机浏览器上访问ATC UI。例如我设置本机的wlan0的ip是192.168.0.1,直接通过http://192.168.0.1:8000访问到控制界面。
我们可以在上述的表达中填入想设置的丢包率吧、延迟等参数,就可以控制手机访问的网络环境。
【参考】
1. Augmented Traffic Control
2. Facebook网络模拟测试工具ATC使用
3. Ubuntu 14.04 快速创建无线接入点供移动设备连接上网
相关文章推荐
- 网络信息安全
- TCP/IP编程·Server
- 高性能、高并发、高扩展性和可读性的网络服务器架构:StateThreads
- TCP/IP编程·Client
- Centos 7.x临时的网络与路由配置
- python利用requests框架 http请求
- HttpClient模拟登录手机版微博
- zigbee06要怎么设置网络形式?星状网状树形这些网络要怎么才能建立?需要哪些设置呢?
- 网络IO之阻塞、非阻塞、同步、异步总结
- Python系列------httplib2--安装
- http://sass-lang.com/documentation/Sass/Script/Functions.html
- 解决Ubuntu Server 12.04换了网卡MAC地址后 网络不可用的问题.
- BZOJ3997: [TJOI2015]组合数学(网络流)
- Java基础—网络编程
- asp.net 5 如何使用ioc 以及在如何获取httpcontext对象
- Universal-Image-Loader,android-Volley,Picasso、Fresco和Glide五大Android开源组件加载网络图片的优缺点比较
- http 415 错误
- CA根证书制作【仅供参考】-----win7 windows server 2008R2下 https SSL证书安装的搭配(搭配https ssl本地测试环境)
- Linux中TCP连接过程状态简介
- 网络协议初探和Socket的使用