In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/03 Report--
Reference to the article:
Http://blog.csdn.net/itfootball/article/details/46763731
Http://www.cnblogs.com/coderzh/p/AugmentedTrafficControl.html
Hardware preparation: Mercury MW150U 150m wireless USB card (don't ask why, if you can use something else that can support ap mode and have a driver, I used Ralink and 360wifi to configure it to death)
System version: ubuntu 14.04 LTS Desktop version (new system setup root password: sudo passwd)
It is divided into two parts: configuring wifi under ubuntu and configuring ATC project
1. Configure wifi under ubuntu
1. Check to see if the wireless network card is connected: lsusb
If we display the information of our wireless network card, which means that we have identified our usb wireless network card
two。 Install hostapd and dhcp
Hostapd: the wireless network card can be switched to AP/Master mode through Hostapd, and an open (unencrypted) WEP,WPA or WPA2 wireless network can be established by modifying the configuration file.
Dhcp: simply put, ip management
Installation: apt-get install hostapd isc-dhcp-server
Verify whether the installation is successful: type hostapd and dhcpd respectively, and the detailed description of the command will be successful.
3. Configure hostapd
Vi / etc/hostapd/hostapd.conf
Hostapd.conf##
Interface=wlan0
Driver=nl80211
Ssid=autotest / / wifi name
Channel=10
Hw_mode=g
Macaaddr_acl=0
Auth_algs=3
Wpa=2
Wpa_passphrase=12345678 / / password
Wpa_key_mgmt=WPA-PSK
Wpa_pairwise=TKIP CCMP
Rsn_pariwise=TKIP CCMP
# # #
4. Run hostapd (you can skip to step 5, step 4 is to step on the pit)
Execute: hostapd-B / etc/hostapd/hostapd.conf
Error report: nl80211: Could not configure driver mode
Nl80211 driver initialization faile
Solution: nmcli nm wifi off
Rfkill unblock wlan
5. Run hostapd
Execute: nmcli nm wifi off
Rfkill unblock wlan
Killall hostapd
Hostapd-B / etc/hostapd/hostapd.conf (- B running in the background)
Or
Hostapd-d / etc/hostapd/hostapd.conf (- d runs directly)
6. Query DNS, step 7
Execution: nmcli dev list iface eth0 | grep IP4
Root@lufukeng:/# nmcli dev list iface eth0 | grep IP4
IP4.ADDRESS [1]: ip = 192.168.200.131 pick 24, gw = 192.168.200.2
IP4.DNS [1]: 192.168.200.2
IP4.DOMAIN [1]: localdomain
IP4.WINS [1]: 192.168.200.2
7. Configure dhcpd
Vi / etc/dhcp/dhcpd.conf
# # #
Subnet 192.168.0.0 netmask 255.255.255.0
{
Range 192.168.0.2 192.168.0.10
Option routers 192.168.0.1
Option domain-name-servers 192.168.200.2 the DNS of the query, there is no need to change it.
}
# # #
8. Set up wlan0
Ifconfig wlan0 192.168.0.1 netmask 255.255.255.0
9. Start dhcp-server
Touch / var/run/dhcp-server/dhcpd.pid
Chmod 777 / var/run/dhcp-server/dhcpd.pid
Dhcpd wlan0-pf / var/run/dhcp-server/dhcpd.pid
10.IP forwarding
Bash-c "echo 1 > / proc/sys/net/ipv4/ip_forward"
11. Set up NAT
Iptables-t nat-A POSTROUTING-o eth0-j MASQUERADE
Here, if the phone is connected to wifi and surf the Internet normally, it will be successful.
Download and configure ATC
1. Install pip
Terminal input: sudo apt-get install python-pip
Install the django components required by ATC through pip:
Pip install atc_thrift atcd django-atc-api django-atc-demo-ui django-atc-profile-storage
two。 Create a django project to use the ATC server app
Django-admin startproject atcui
3. Modify ATC configuration
Cd atcui/atcui
Vi settings.py
Add the following to INSTALLED_APPS
'rest_framework'
'atc_api'
'bootstrap_themes'
'django_static_jquery'
'atc_demo_ui'
'atc_profile_storage'
Vi urls.py
Change the urlpatterns content to the following:
From django.views.generic.base import RedirectView
From django.conf.urls import include
Urlpatterns = [
Url (r'^ admin/',admin.site.urls)
Url (r'^ api/v1/',include ('atc_api.urls'))
Url (r'^ ATC _ demo_ui/',include ('atc_demo_ui.urls'))
Url (r'^ api/v1/profiles/',include ('atc_profile_storage.urls'))
Url (r'^ $', RedirectView.as_view (url='/atc_demo_ui/', permanent=False))
]
Cd atcui / / change to the directory where manage.py is located
Update django database: python manage.py migrate
4. After the configuration is completed, it can be run. Here, the network card eth0 is used as the public network connection, and wlan0 is used as the private network connection, which is specified by parameters when starting.
Sudo atcd--atcd-wan eth0-- atcd-lan wlan0
5. Run ATC UI
Python manage.py runserver 0.0.0.0:8000
When you visit 192.168.0.1 profile 8000 through a mobile browser, you will display a web page that has not been configured with any Facebook. The file configuration that has been configured is provided below.
6.facebook has configured common network configurations for us in its own project, which can be added in the following ways
Apt-get install git
Git clone https://github.com/facebook/augmented-traffic-control.git
Apt-get install curl
Cd augmented-traffic-control
Utils/restore-profiles.sh localhost:8000
7.ATC usage
Turn on / / Open
Select / / Select
Update Shaping / / Update. After selecting the network, click Update.
Turn off / / close
Finally, a copy of the network parameter configuration is attached (for reference only):
Network bandwidth (bandwidth)
Delay (latency)
Packet loss rate (packet loss)
Packet error rate (corrupted packets)
Disorder rate (packets ordering)
Name Latency Bandwidth Packet-loss
GPRS (good) 500 50 2
EDGE (good) 300 250 1.5
3G/HSDPA (good) 250 750 1.5
DIAL-UP (good) 185 40 2
DSL (poor) 70 2000 2
DSL (good) 40 8000
WIFI (good) 40 30000
Satellite 1500-0.2
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.