docker 搭建 弱网测试环境 ATC
前言

我的环境: Ubuntu16.04 64bit、Python 2.7.12、Django1.8.7
环境要求
Python2.7+
查看当前python版本:python --version
Django1.7+
查看Django版本:
命令行中先输入python,
然后依次输入import django
django.VERSION
然后回车即可看到版本号,Ctrol + D 退出编辑。
这里写图片描述

注意:千万不要卸载Python3.4!!!
千万不要卸载Python3.4!!!
千万不要卸载Python3.4!!!
由于很多软件关联了python如果卸载了,其他软件也会被自动卸载!!!!
1、软件环境准备
a)安装pip
sudo apt-get install python-pip python-dev build-essential
sudo pip install --upgrade pip
b)然后通过pip安装ATC,必须使用sudo
sudo pip install atc_thrift atcd django-atc-api django-atc-demo-ui django-atc-profiorage
c)安装Django1.8.7,一定要使用sudo
sudo pip install Django==1.8.7
2、安装并启动ATC docker 镜像
备注:如果安装过程中,因为部分软件版本过旧导致安装失败,可以先运行sudo apt-get dist-upgrade,更新所有的软件:
会提示你要下载多少软件,已经多少M大小,你回车选择是,之后就自动安装了。
最后更新完成了。
如果想要安装相应的软件,自需输入 sudo apt-get install 软件名
docker run -it --privileged --net=host --rm atcd/atc
会自动检查,如果本地存在,会直接启动,如果本地没有就会从云端下载。

启动完成后,即可访问:http://localhost:8000/ ,进入ATC界面

3、准备无线网卡
别浪费时间,直接买一个免驱动的无线网卡
推荐使用linux免驱动的无线网卡(普通无线网卡需要手动安装驱动,可能会碰到很多问题)
改网卡的相关设置,这两个命令运行完可以ctrol + C强制结束(wan为有线网卡名称,lan为无线网卡名称 )
sudo atcd --atcd-lan wlx00026fb96d31 --atcd-wan enp3s0
wlx00026fb96d31为无线网卡名,enp3s0为有限网卡名
网卡名来自于ifconfig -a

4、导入facebook的网络配置
apt-get install gitgit clone https://github.com/facebook/augmented-traffic-control.gitapt-get install curlcd augmented-traffic-control
将网络配置文件加载到指定ATC服务中
utils/restore-profiles.sh 0.0.0.0:8000

加载后的ATC profiles如下图所示:

5、创建wifi
ubuntu18.04设置方式:https://blog.csdn.net/u012491646/article/details/80219973
以下为ubuntu16.04设置方式:
(1)新建wifi

点击:“编辑连接”

(2)配置wifi





设置mode=ap

(3)使wifi生效



6、ATC环境ok了,可以使用了
至此,可用其他手机连接wifi,并访问http://ATC_IP:8000/atc_demo_ui/进行网络配置了
