Here are a few questions that will help us get a better understanding of your setup. Please take a minute to answer them, this will avoid some back and forth communication by providing some context to us.
-->
Meeting the requirements:ATC has a few requirements, this section is used to make sure the requirements are met. Until you can check all the boxes, ATC will not work on your system.
[ x] atcd runs on Linux
[ x] atcd has 2 physical interfaces
[ x] 1 that connects to the internet (WAN)
[ x] 1 that connects to the local network (LAN)
[ x] the traffic from the devices that are being shaped is routed through atcd
[ x] atcd sees the real IP of the devices (e.g there is no NAT on the LAN segment)
Checking for special atcd options:
In some cases, atcd default configuration may not be suitable for your system. Use:
atcd -h
do change those default to suit your setup.
For instance, if your lan interface is wlan0, you should start atcd using:
atcd --atcd-lan wlan0
Steps to reproduce the issue:
Guides that I followed:
For the first one, I only do the first part. I don't set up the bridge.
I log in with my phone the moment I press update shaping it crashes no error - nothing not even in the /var/messages
Describe the results you received:
I get a crash of my raspberry Pi when atcd should start shaping the traffic of my phone.
For example l'll do the stup log in the wifi it works fine after that I go to 192.168.4.1:8000/atc_demo_ui
I autorize my phone with the token and the ip-address the I select a package for example 2g and click on update shaping.
And then the wifi doesnt work anymore and get broken pipe on my terminal and I can't ssh to my raspberry.
Describe the results you expected:
It shouldn't crash.
Any additional information that you think is important:
Dumping system info:
While this may not be required in many cases, providing the following information will help us better understand your setup.
I couldn't find any error at all. but that is the output that atcd gives me:
######################################################
(venv) pi@raspberrypi:~/dev/atc/venv/bin $ sudo ./atcd --atcd-lan wlan0 --atcd-wan eth0
INFO:AtcdVService.AtcdNBServerTask:AtcdNBServerTask Server Started on 127.0.0.1:9090
INFO:AtcdVService.AtcdLinuxShaper:Calling initialize_shaping_system
INFO:AtcdVService.AtcdLinuxShaper:Running /sbin/iptables -t mangle -F FORWARD
INFO:AtcdVService.AtcdLinuxShaper:deleting root QDisc on wlan0
WARNING:AtcdVService.AtcdLinuxShaper:could not delete root QDisc. There might have been nothing to delete
INFO:AtcdVService.AtcdLinuxShaper:setting root qdisc on wlan0
INFO:AtcdVService.AtcdLinuxShaper:deleting root QDisc on eth0
WARNING:AtcdVService.AtcdLinuxShaper:could not delete root QDisc. There might have been nothing to delete
INFO:AtcdVService.AtcdLinuxShaper:setting root qdisc on eth0
INFO:AtcdVService.AtcdLinuxShaper:Restoring shaped connection from DB
INFO:AtcdVService.AtcdLinuxShaper:Request startShaping TrafficControl(device=TrafficControlledDevice(controllingIP='192.168.4.19', controlledIP='192.168.4.19'), timeout=81905.05380916595, settings=TrafficControlSetting(down=Shaping(loss=Loss(percentage=0.0, correlation=0.0), delay=Delay(delay=0, jitter=0, correlation=0.0), rate=20, iptables_options=[], corruption=Corruption(percentage=0.0, correlation=0.0), reorder=Reorder(percentage=0.0, correlation=0.0, gap=0)), up=Shaping(loss=Loss(percentage=0.0, correlation=0.0), delay=Delay(delay=0, jitter=0, correlation=0.0), rate=20, iptables_options=[], corruption=Corruption(percentage=0.0, correlation=0.0), reorder=Reorder(percentage=0.0, correlation=0.0, gap=0))))
INFO:AtcdVService.AtcdLinuxShaper:Shaping ip 192.168.4.19 on interface eth0
INFO:AtcdVService.AtcdLinuxShaper:create new HTB class on IFID eth0, classid 1:2,parent 1:0, rate 20kbits
INFO:AtcdVService.AtcdLinuxShaper:create new Netem qdisc on IFID eth0, parent 1:2, loss 0.0%, delay 0
INFO:AtcdVService.AtcdLinuxShaper:create new FW filter on IFID eth0, classid 1:2, handle 2, rate: 20kbits
INFO:AtcdVService.AtcdLinuxShaper:Running /sbin/iptables -t mangle -A FORWARD -d 192.168.4.19 -i eth0 -j MARK --set-mark 2
INFO:AtcdVService.AtcdLinuxShaper:Shaping ip 192.168.4.19 on interface wlan0
INFO:AtcdVService.AtcdLinuxShaper:create new HTB class on IFID wlan0, classid 1:2,parent 1:0, rate 20kbits
INFO:AtcdVService.AtcdLinuxShaper:create new Netem qdisc on IFID wlan0, parent 1:2, loss 0.0%, delay 0
INFO:AtcdVService.AtcdLinuxShaper:create new FW filter on IFID wlan0, classid 1:2, handle 2, rate: 20kbits
INFO:AtcdVService.AtcdLinuxShaper:Running /sbin/iptables -t mangle -A FORWARD -s 192.168.4.19 -i wlan0 -j MARK --set-mark 2
DEBUG:AtcdVService:All tasks started
DEBUG:AtcdVService:VService Active. Awaiting graceful shutdown.
packet_write_wait: Connection to 172.16.19.54 port 22: Broken pipe
##########################################################################
default via 172.16.16.1 dev eth0 src 172.16.19.54 metric 202
172.16.16.0/22 dev eth0 proto kernel scope link src 172.16.19.54 metric 202
192.168.4.0/24 dev wlan0 proto kernel scope link src 192.168.4.1 metric 303
######### iptables-save #########
######### ip r #########
default via 172.16.16.1 dev eth0 src 172.16.19.54 metric 202
172.16.16.0/22 dev eth0 proto kernel scope link src 172.16.19.54 metric 202
192.168.4.0/24 dev wlan0 proto kernel scope link src 192.168.4.1 metric 303
######### ip a #########
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
inet 172.16.19.54/22 brd 172.16.19.255 scope global eth0
valid_lft forever preferred_lft forever
valid_lft forever preferred_lft forever
3: wlan0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
inet 192.168.4.1/24 brd 192.168.4.255 scope global wlan0
valid_lft forever preferred_lft forever
valid_lft forever preferred_lft forever
4: wlan1: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc pfifo_fast state DOWN group default qlen 1000
BUG REPORT INFORMATION
Here are a few questions that will help us get a better understanding of your setup. Please take a minute to answer them, this will avoid some back and forth communication by providing some context to us. --> Meeting the requirements: ATC has a few requirements, this section is used to make sure the requirements are met. Until you can check all the boxes, ATC will not work on your system.
atcd
runs on Linuxatcd
has 2 physical interfacesatcd
atcd
sees the real IP of the devices (e.g there is no NAT on the LAN segment)Checking for special atcd options:
In some cases,
atcd
default configuration may not be suitable for your system. Use:do change those default to suit your setup. For instance, if your lan interface is
wlan0
, you should startatcd
using:Steps to reproduce the issue: Guides that I followed: For the first one, I only do the first part. I don't set up the bridge.
https://github.com/SurferTim/documentation/blob/6bc583965254fa292a470990c40b145f553f6b34/configuration/wireless/access-point.md
For the second part, I use the following guide which explains quite well how to set up atcd in a virtualenv.
https://miteshshah.github.io/sysadmin/how-to-setup-atc/
And I found some bugfixes and an overall overview on how to do it on a raspberry pi on here:
https://www.jianshu.com/p/0a10ead567c3
Describe the results you received: I get a crash of my raspberry Pi when atcd should start shaping the traffic of my phone. For example l'll do the stup log in the wifi it works fine after that I go to 192.168.4.1:8000/atc_demo_ui
I autorize my phone with the token and the ip-address the I select a package for example 2g and click on update shaping.
And then the wifi doesnt work anymore and get broken pipe on my terminal and I can't ssh to my raspberry.
Describe the results you expected: It shouldn't crash.
Any additional information that you think is important:
Dumping system info:
While this may not be required in many cases, providing the following information will help us better understand your setup.
I couldn't find any error at all. but that is the output that atcd gives me:
###################################################### (venv) pi@raspberrypi:~/dev/atc/venv/bin $ sudo ./atcd --atcd-lan wlan0 --atcd-wan eth0 INFO:AtcdVService.AtcdNBServerTask:AtcdNBServerTask Server Started on 127.0.0.1:9090 INFO:AtcdVService.AtcdLinuxShaper:Calling initialize_shaping_system INFO:AtcdVService.AtcdLinuxShaper:Running /sbin/iptables -t mangle -F FORWARD INFO:AtcdVService.AtcdLinuxShaper:deleting root QDisc on wlan0 WARNING:AtcdVService.AtcdLinuxShaper:could not delete root QDisc. There might have been nothing to delete INFO:AtcdVService.AtcdLinuxShaper:setting root qdisc on wlan0 INFO:AtcdVService.AtcdLinuxShaper:deleting root QDisc on eth0 WARNING:AtcdVService.AtcdLinuxShaper:could not delete root QDisc. There might have been nothing to delete INFO:AtcdVService.AtcdLinuxShaper:setting root qdisc on eth0 INFO:AtcdVService.AtcdLinuxShaper:Restoring shaped connection from DB INFO:AtcdVService.AtcdLinuxShaper:Request startShaping TrafficControl(device=TrafficControlledDevice(controllingIP='192.168.4.19', controlledIP='192.168.4.19'), timeout=81905.05380916595, settings=TrafficControlSetting(down=Shaping(loss=Loss(percentage=0.0, correlation=0.0), delay=Delay(delay=0, jitter=0, correlation=0.0), rate=20, iptables_options=[], corruption=Corruption(percentage=0.0, correlation=0.0), reorder=Reorder(percentage=0.0, correlation=0.0, gap=0)), up=Shaping(loss=Loss(percentage=0.0, correlation=0.0), delay=Delay(delay=0, jitter=0, correlation=0.0), rate=20, iptables_options=[], corruption=Corruption(percentage=0.0, correlation=0.0), reorder=Reorder(percentage=0.0, correlation=0.0, gap=0)))) INFO:AtcdVService.AtcdLinuxShaper:Shaping ip 192.168.4.19 on interface eth0 INFO:AtcdVService.AtcdLinuxShaper:create new HTB class on IFID eth0, classid 1:2,parent 1:0, rate 20kbits INFO:AtcdVService.AtcdLinuxShaper:create new Netem qdisc on IFID eth0, parent 1:2, loss 0.0%, delay 0 INFO:AtcdVService.AtcdLinuxShaper:create new FW filter on IFID eth0, classid 1:2, handle 2, rate: 20kbits INFO:AtcdVService.AtcdLinuxShaper:Running /sbin/iptables -t mangle -A FORWARD -d 192.168.4.19 -i eth0 -j MARK --set-mark 2 INFO:AtcdVService.AtcdLinuxShaper:Shaping ip 192.168.4.19 on interface wlan0 INFO:AtcdVService.AtcdLinuxShaper:create new HTB class on IFID wlan0, classid 1:2,parent 1:0, rate 20kbits INFO:AtcdVService.AtcdLinuxShaper:create new Netem qdisc on IFID wlan0, parent 1:2, loss 0.0%, delay 0 INFO:AtcdVService.AtcdLinuxShaper:create new FW filter on IFID wlan0, classid 1:2, handle 2, rate: 20kbits INFO:AtcdVService.AtcdLinuxShaper:Running /sbin/iptables -t mangle -A FORWARD -s 192.168.4.19 -i wlan0 -j MARK --set-mark 2 DEBUG:AtcdVService:All tasks started DEBUG:AtcdVService:VService Active. Awaiting graceful shutdown. packet_write_wait: Connection to 172.16.19.54 port 22: Broken pipe ##########################################################################
Run https://github.com/facebook/augmented-traffic-control/blob/master/utils/dump_system_info.sh and upload the content of the logs to https://gist.github.com/
./dump_system_info.sh eth0 wlan0
######### uname -a #########
Linux raspberrypi 4.14.71-v7+ #1145 SMP Fri Sep 21 15:38:35 BST 2018 armv7l GNU/Linux
######### cat /etc/os-release #########
PRETTY_NAME="Raspbian GNU/Linux 9 (stretch)" NAME="Raspbian GNU/Linux" VERSION_ID="9" VERSION="9 (stretch)" ID=raspbian ID_LIKE=debian HOME_URL="http://www.raspbian.org/" SUPPORT_URL="http://www.raspbian.org/RaspbianForums" BUG_REPORT_URL="http://www.raspbian.org/RaspbianBugs"
######### python -V #########
Python 2.7.13
######### pip freeze #########
atc-thrift==0.1.6 atcd==0.1.6 daemonize==2.4.7 Django==1.11.16 django-atc-api==0.1.6 django-atc-demo-ui==0.1.6 django-atc-profile-storage==0.1.6 django-bootstrap-themes==3.3.6 django-static-jquery==1.11.1 djangorestframework==3.3.0 futures==3.2.0 pyotp==1.4.1 pyroute2==0.3.3 pytz==2018.5 six==1.11.0 sparts==0.7.1 thrift==0.11.0
######### ip r #########
default via 172.16.16.1 dev eth0 src 172.16.19.54 metric 202 172.16.16.0/22 dev eth0 proto kernel scope link src 172.16.19.54 metric 202 192.168.4.0/24 dev wlan0 proto kernel scope link src 192.168.4.1 metric 303
######### iptables-save #########
######### ip r #########
default via 172.16.16.1 dev eth0 src 172.16.19.54 metric 202 172.16.16.0/22 dev eth0 proto kernel scope link src 172.16.19.54 metric 202 192.168.4.0/24 dev wlan0 proto kernel scope link src 192.168.4.1 metric 303
######### ip a #########
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000 link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 inet 127.0.0.1/8 scope host lo valid_lft forever preferred_lft forever inet6 ::1/128 scope host valid_lft forever preferred_lft forever 2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000 inet 172.16.19.54/22 brd 172.16.19.255 scope global eth0 valid_lft forever preferred_lft forever valid_lft forever preferred_lft forever 3: wlan0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000 inet 192.168.4.1/24 brd 192.168.4.255 scope global wlan0 valid_lft forever preferred_lft forever valid_lft forever preferred_lft forever 4: wlan1: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc pfifo_fast state DOWN group default qlen 1000
######### tc qdisc show dev eth0 #########
qdisc pfifo_fast 0: root refcnt 2 bands 3 priomap 1 2 2 2 1 2 0 0 1 1 1 1 1 1 1 1
######### tc class show dev eth0 #########
######### tc filter show dev eth0 #########
######### tc qdisc show dev wlan0 #########
qdisc mq 0: root qdisc pfifo_fast 0: parent :4 bands 3 priomap 1 2 2 2 1 2 0 0 1 1 1 1 1 1 1 1 qdisc pfifo_fast 0: parent :3 bands 3 priomap 1 2 2 2 1 2 0 0 1 1 1 1 1 1 1 1 qdisc pfifo_fast 0: parent :2 bands 3 priomap 1 2 2 2 1 2 0 0 1 1 1 1 1 1 1 1 qdisc pfifo_fast 0: parent :1 bands 3 priomap 1 2 2 2 1 2 0 0 1 1 1 1 1 1 1 1
######### tc class show dev wlan0 #########
class mq :1 root class mq :2 root class mq :3 root class mq :4 root
######### tc filter show dev wlan0 #########