Hallo liebe Community,
als Netzwerk-(und Linux-)Anfänger versuche ich gerade verschiedene Bandbreiten und Latenzen zu simulieren.
Dazu bin ich auf tc qdisc, netem und tbf gestoßen. Funktioniert alles auch soweit recht gut, bis auf die Bandbreiten-Beschränkung mit tbf.
Um den eingehenden Verkehr ebenfalls regulieren zu können habe ich folgendes konfiguriert:
1 2 3 4 5 | # modprobe ifb # ip link set dev ifb0 up # tc qdisc add dev eth1 ingress # tc filter add dev eth1 parent ffff: \ protocol ip u32 match u32 0 0 flowid 1:1 action mirred egress redirect dev ifb0 |
um dann per tc qdisc, tbf und netem Bandbreite und Latenz wie folgt einzustellen:
1 2 3 4 | # tc qdisc add dev eth1 root handle 1: tbf rate 100mbit buffer 102400 limit 102400 # tc qdisc add dev eth1 parent 1: handle 10: netem delay 5ms 1ms # tc qdisc add dev ifb0 root handle 1: tbf rate 100mbit buffer 102400 limit 102400 # tc qdisc add dev ifb0 parent 1: handle 10: netem delay 5ms 1ms |
Für den eingehenden Traffic (ifb0) funktioniert dies recht gut. Für den ausgehenden Traffic (eth1) scheint egal zu sein, was ich konfiguriere - sobald ich per tbf irgendeine Bandbreite eingebe spuckt er sehr variabel 4 bis 25 kbps aus (getestet durch Downloads von einem Win2k3 und einem Ubuntu 10.04). Sobald ich eth1 in qdisc wieder lösche, zieht er wieder voll durch.
Fällt jemandem was dazu ein?
Beste Grüße,
Corvin
Anbei weitere Informationen:
1 2 3 4 5 | # tc qdisc qdisc pfifo_fast 0: dev eth0 root refcnt 2 bands 3 priomap 1 2 2 2 1 2 0 0 1 1 1 1 1 1 1 1 qdisc tbf 1: dev eth1 root refcnt 2 rate 100000Kbit burst 100Kb lat 0us qdisc ingress ffff: dev eth1 parent ffff:fff1 ---------------- qdisc tbf 1: dev ifb0 root refcnt 2 rate 100000Kbit burst 100Kb lat 0us |
Informationen wie hier gewünscht: http://forum.ubuntuusers.de/topic/vor-dem-erstellen-eines-neuen-beitrags-bitte-/
1 2 | # uname -a Linux ubuntu 2.6.32-37-generic #81-Ubuntu SMP Fri Dec 2 20:32:42 UTC 2011 x86_64 GNU/Linux |
1 2 3 4 5 6 7 8 | # lspci -nnk | grep -i net -A2 02:01.0 Ethernet controller [0200]: Intel Corporation 82545EM Gigabit Ethernet Controller (Copper) [8086:100f] (rev 01) Kernel driver in use: e1000 Kernel modules: e1000 -- 02:05.0 Ethernet controller [0200]: Intel Corporation 82545EM Gigabit Ethernet Controller (Copper) [8086:100f] (rev 01) Kernel driver in use: e1000 Kernel modules: e1000 |
1 2 3 4 5 6 7 8 9 10 11 12 | # egrep -v "^$|^#" /etc/network/interfaces auto lo iface lo inet loopback auto eth0 iface eth0 inet static address 192.168.100.100 netmask 255.255.255.0 gateway 192.168.100.1 auto eth1 iface eth1 inet static address 192.168.200.1 netmask 255.255.255.0 |
1 2 3 4 | # egrep -v "^$|^#" /etc/resolv.conf domain localdomain search localdomain nameserver 192.168.178.1 |
1 2 3 4 5 6 7 8 | # egrep -v "^$|^#" /etc/hosts 127.0.0.1 localhost 127.0.1.1 ubuntu.localdomain ubuntu ::1 localhost ip6-localhost ip6-loopback fe00::0 ip6-localnet ff00::0 ip6-mcastprefix ff02::1 ip6-allnodes ff02::2 ip6-allrouters |
1 2 3 4 5 6 7 8 9 10 11 12 | # cat /etc/udev/rules.d/70-persistent-net.rules # This file was automatically generated by the /lib/udev/write_net_rules # program, run by the persistent-net-generator.rules rules file. # # You can modify it, as long as you keep each rule on a single # line, and change only the value of the NAME= key. # PCI device 0x8086:0x100f (e1000) SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:0c:29:96:b2:d1", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0" # PCI device 0x8086:0x100f (e1000) SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:0c:29:96:b2:db", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="eth1" |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 | # ifconfig eth0 Link encap:Ethernet Hardware Adresse 00:0c:29:96:b2:d1 inet Adresse:192.168.100.100 Bcast:192.168.100.255 Maske:255.255.255.0 inet6-Adresse: fe80::20c:29ff:fe96:b2d1/64 Gültigkeitsbereich:Verbindung UP BROADCAST RUNNING MULTICAST MTU:1500 Metrik:1 RX packets:64 errors:0 dropped:0 overruns:0 frame:0 TX packets:223 errors:0 dropped:0 overruns:0 carrier:0 Kollisionen:0 Sendewarteschlangenlänge:1000 RX bytes:8032 (8.0 KB) TX bytes:25727 (25.7 KB) eth1 Link encap:Ethernet Hardware Adresse 00:0c:29:96:b2:db inet Adresse:192.168.200.1 Bcast:192.168.200.255 Maske:255.255.255.0 inet6-Adresse: fe80::20c:29ff:fe96:b2db/64 Gültigkeitsbereich:Verbindung UP BROADCAST RUNNING MULTICAST MTU:1500 Metrik:1 RX packets:397240 errors:0 dropped:0 overruns:0 frame:0 TX packets:128550 errors:0 dropped:0 overruns:0 carrier:0 Kollisionen:0 Sendewarteschlangenlänge:1000 RX bytes:577076469 (577.0 MB) TX bytes:9887714 (9.8 MB) ifb0 Link encap:Ethernet Hardware Adresse c2:a0:ab:f8:08:a2 inet6-Adresse: fe80::c0a0:abff:fef8:8a2/64 Gültigkeitsbereich:Verbindung UP BROADCAST RUNNING NOARP MTU:1500 Metrik:1 RX packets:397047 errors:0 dropped:3 overruns:0 frame:0 TX packets:397044 errors:0 dropped:0 overruns:0 carrier:0 Kollisionen:0 Sendewarteschlangenlänge:32 RX bytes:576729346 (576.7 MB) TX bytes:576729136 (576.7 MB) lo Link encap:Lokale Schleife inet Adresse:127.0.0.1 Maske:255.0.0.0 inet6-Adresse: ::1/128 Gültigkeitsbereich:Maschine UP LOOPBACK RUNNING MTU:16436 Metrik:1 RX packets:149 errors:0 dropped:0 overruns:0 frame:0 TX packets:149 errors:0 dropped:0 overruns:0 carrier:0 Kollisionen:0 Sendewarteschlangenlänge:0 RX bytes:18058 (18.0 KB) TX bytes:18058 (18.0 KB) |
1 2 3 4 5 6 7 | # route -n Kernel-IP-Routentabelle Ziel Router Genmask Flags Metric Ref Use Iface 192.168.100.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0 192.168.200.0 0.0.0.0 255.255.255.0 U 0 0 0 eth1 169.254.0.0 0.0.0.0 255.255.0.0 U 1000 0 0 eth1 0.0.0.0 192.168.100.1 0.0.0.0 UG 100 0 0 eth0 |
1 2 3 4 5 6 7 8 9 10 | # iwconfig lo no wireless extensions. eth0 no wireless extensions. eth1 no wireless extensions. ifb0 no wireless extensions. ifb1 no wireless extensions. |
1 2 3 4 5 6 7 8 9 10 | # ping -c 4 192.168.178.1 PING 192.168.178.1 (192.168.178.1) 56(84) bytes of data. 64 bytes from 192.168.178.1: icmp_seq=1 ttl=63 time=3.02 ms 64 bytes from 192.168.178.1: icmp_seq=2 ttl=63 time=0.446 ms 64 bytes from 192.168.178.1: icmp_seq=3 ttl=63 time=0.448 ms 64 bytes from 192.168.178.1: icmp_seq=4 ttl=63 time=0.452 ms --- 192.168.178.1 ping statistics --- 4 packets transmitted, 4 received, 0% packet loss, time 3002ms rtt min/avg/max/mdev = 0.446/1.092/3.024/1.115 ms |
1 2 3 4 5 6 7 8 9 10 | # ping -c 4 www.ubuntuusers.de PING ubuntuusers.de (213.95.41.13) 56(84) bytes of data. 64 bytes from lisa.ubuntu-eu.org (213.95.41.13): icmp_seq=1 ttl=52 time=22.0 ms 64 bytes from lisa.ubuntu-eu.org (213.95.41.13): icmp_seq=2 ttl=52 time=21.7 ms 64 bytes from lisa.ubuntu-eu.org (213.95.41.13): icmp_seq=3 ttl=52 time=21.6 ms 64 bytes from lisa.ubuntu-eu.org (213.95.41.13): icmp_seq=4 ttl=52 time=21.7 ms --- ubuntuusers.de ping statistics --- 4 packets transmitted, 4 received, 0% packet loss, time 3007ms rtt min/avg/max/mdev = 21.695/21.822/22.089/0.216 ms |
1 2 3 4 5 6 7 8 9 10 | # ping -c 4 213.95.41.11 PING 213.95.41.11 (213.95.41.11) 56(84) bytes of data. 64 bytes from 213.95.41.11: icmp_seq=1 ttl=52 time=21.7 ms 64 bytes from 213.95.41.11: icmp_seq=2 ttl=52 time=21.2 ms 64 bytes from 213.95.41.11: icmp_seq=3 ttl=52 time=21.1 ms 64 bytes from 213.95.41.11: icmp_seq=4 ttl=52 time=21.2 ms --- 213.95.41.11 ping statistics --- 4 packets transmitted, 4 received, 0% packet loss, time 3006ms rtt min/avg/max/mdev = 21.186/21.357/21.711/0.273 ms |