
Hi, In order to test some software I am developing I need to introduce a network delay between a machine and the rest of my LAN. After a bit of web searching I discovered that this is supposed to be simple to do, you just set up Linux as a transparent bridge and use the iproute tools to simulate network behaviour. However I can't get it to work how I want. I have an old AMD K6/500 box with 2 10bT ethernet cards running Xubuntu 7.10. One card is connected to my office LAN switch and the other to a hub, like this: MachineA---switch---eth0/bridge/eth1---hub---MachineB I have installed bridge-utils and iproute and I have configured the bridge machine according to the bridge-utils documentation by removing the eth0 and eth1 entries and adding a br0 to /etc/network/interfaces : auto br0 iface br0 inet static address 192.168.1.251 network 192.168.1.0 netmask 255.255.255.0 broadcast 192.168.1.255 gateway 192.168.1.1 bridge_ports eth0 eth1 This works fine and MachineB can get an address via DHCP and see the rest of the network. Now I need to add a delay so that all traffic between MachineB and the rest of the network has some latency. In order to add a delay, according to [1] I just need to do this: $ tc qdisc add dev DEV root netem delay 100ms I have done this for various combinations of eth0, eth1 and br0 but it only seems to delay traffic to and from the bridge itself, not traffic being relayed through the bridge. Does anyone know how to set this up to delay traffic going through the bridge? Glenn [1] http://www.linux-foundation.org/en/Net:Netem#Emulating_wide_area_network_del... -- Glenn Ramsey <glenn(a)componic.co.nz> 07 8627077 http://www.componic.co.nz

Glenn - haven't got much time to reply at present but also look at: http://www.linux-foundation.org/en/Net:DCCP_Testing A few notes: - I use with a third machine in middle and route/traffic shape on this - makes it much simpler - client boxes don't need to be modified - make sure you look at the limit parameter or else your behaviour is real bad - use a kernel with HZ=1000 if possible and/or a machine with hrtimers (new kernels). Netem in past always introduces minimum one tick delay (which new netem/hrtimer resolves but haven't tested). Feel free to ask me more as I have used a lot (and wrote that Wiki page I linked to). Not much time to respond quickly though often! ian On 11/29/07, Glenn Ramsey <glenn(a)componic.co.nz> wrote:
Hi,
In order to test some software I am developing I need to introduce a network delay between a machine and the rest of my LAN.
After a bit of web searching I discovered that this is supposed to be simple to do, you just set up Linux as a transparent bridge and use the iproute tools to simulate network behaviour. However I can't get it to work how I want.
I have an old AMD K6/500 box with 2 10bT ethernet cards running Xubuntu 7.10. One card is connected to my office LAN switch and the other to a hub, like this:
MachineA---switch---eth0/bridge/eth1---hub---MachineB
I have installed bridge-utils and iproute and I have configured the bridge machine according to the bridge-utils documentation by removing the eth0 and eth1 entries and adding a br0 to /etc/network/interfaces :
auto br0 iface br0 inet static address 192.168.1.251 network 192.168.1.0 netmask 255.255.255.0 broadcast 192.168.1.255 gateway 192.168.1.1 bridge_ports eth0 eth1
This works fine and MachineB can get an address via DHCP and see the rest of the network.
Now I need to add a delay so that all traffic between MachineB and the rest of the network has some latency.
In order to add a delay, according to [1] I just need to do this:
$ tc qdisc add dev DEV root netem delay 100ms
I have done this for various combinations of eth0, eth1 and br0 but it only seems to delay traffic to and from the bridge itself, not traffic being relayed through the bridge.
Does anyone know how to set this up to delay traffic going through the bridge?
Glenn
[1] http://www.linux-foundation.org/en/Net:Netem#Emulating_wide_area_network_del...
-- Glenn Ramsey <glenn(a)componic.co.nz> 07 8627077 http://www.componic.co.nz _______________________________________________ wlug mailing list | wlug(a)list.waikato.ac.nz Unsubscribe: http://list.waikato.ac.nz/mailman/listinfo/wlug
-- Web1: http://wand.net.nz/~iam4/ Web2: http://www.jandi.co.nz Blog: http://iansblog.jandi.co.nz

Thanks Ian, I have it working now. I had followed those instructions and the reason for it not working was that I had connected it up wrong (probably I need less coffee and more sleep!). I am impressed that the amount of setup required to do this is trivial. Glenn Ian McDonald wrote:
Glenn - haven't got much time to reply at present but also look at: http://www.linux-foundation.org/en/Net:DCCP_Testing
A few notes: - I use with a third machine in middle and route/traffic shape on this - makes it much simpler - client boxes don't need to be modified - make sure you look at the limit parameter or else your behaviour is real bad - use a kernel with HZ=1000 if possible and/or a machine with hrtimers (new kernels). Netem in past always introduces minimum one tick delay (which new netem/hrtimer resolves but haven't tested).
Feel free to ask me more as I have used a lot (and wrote that Wiki page I linked to). Not much time to respond quickly though often!
ian
On 11/29/07, Glenn Ramsey <glenn(a)componic.co.nz> wrote:
Hi,
In order to test some software I am developing I need to introduce a network delay between a machine and the rest of my LAN.
After a bit of web searching I discovered that this is supposed to be simple to do, you just set up Linux as a transparent bridge and use the iproute tools to simulate network behaviour. However I can't get it to work how I want.
I have an old AMD K6/500 box with 2 10bT ethernet cards running Xubuntu 7.10. One card is connected to my office LAN switch and the other to a hub, like this:
MachineA---switch---eth0/bridge/eth1---hub---MachineB
I have installed bridge-utils and iproute and I have configured the bridge machine according to the bridge-utils documentation by removing the eth0 and eth1 entries and adding a br0 to /etc/network/interfaces :
auto br0 iface br0 inet static address 192.168.1.251 network 192.168.1.0 netmask 255.255.255.0 broadcast 192.168.1.255 gateway 192.168.1.1 bridge_ports eth0 eth1
This works fine and MachineB can get an address via DHCP and see the rest of the network.
Now I need to add a delay so that all traffic between MachineB and the rest of the network has some latency.
In order to add a delay, according to [1] I just need to do this:
$ tc qdisc add dev DEV root netem delay 100ms
I have done this for various combinations of eth0, eth1 and br0 but it only seems to delay traffic to and from the bridge itself, not traffic being relayed through the bridge.
Does anyone know how to set this up to delay traffic going through the bridge?
Glenn
[1] http://www.linux-foundation.org/en/Net:Netem#Emulating_wide_area_network_del...
-- Glenn Ramsey <glenn(a)componic.co.nz> 07 8627077 http://www.componic.co.nz _______________________________________________ wlug mailing list | wlug(a)list.waikato.ac.nz Unsubscribe: http://list.waikato.ac.nz/mailman/listinfo/wlug
-- Glenn Ramsey <glenn(a)componic.co.nz> 07 8627077 http://www.componic.co.nz
participants (2)
-
Glenn Ramsey
-
Ian McDonald