Networking Forums

Networking Forums > Computer Networking > Linux Networking > emulating WAN latency for certain ip addresses - code wrong?

Reply
Thread Tools Display Modes

emulating WAN latency for certain ip addresses - code wrong?

 
 
vet26@hotmail.co.uk
Guest
Posts: n/a

 
      12-21-2006, 04:14 PM
hi-

I'd like to use tc and netem to cause network delay, but only to
certain other machines.

I found this page which (apparently) describes how to do it:
http://linux-net.osdl.org/index.php/Netem

I can get outgoing network delay using:
tc qdisc add dev eth0 root netem delay 200ms

but this adds latency to all outbound traffic.

Further down the page I linked to above, it mentions how to delay to
only one IP address and gives the following code:

tc qdisc add dev eth0 root handle 1: prio
tc qdisc add dev eth0 parent 1:3 handle 30: netem \
delay 200ms 10ms distribution normal
tc qdisc add dev eth0 parent 30:1 tbf rate 20kbit buffer 1600 limit
3000
tc filter add dev eth0 protocol ip parent 1:0 prio 3 u32 \
match ip dst 65.172.181.4/32 flowid 10:3

However, when I've tried this, I get network delay to all ip addresses
- I can't seem to filter to just one ip address.

Does anyone know the solution?

 
Reply With Quote
 
 
 
 
Allen McIntosh
Guest
Posts: n/a

 
      12-21-2006, 05:46 PM
(E-Mail Removed) wrote:
> hi-
>
> I'd like to use tc and netem to cause network delay, but only to
> certain other machines.


Have you tried (or at least considered) nistnet?
 
Reply With Quote
 
vet26@hotmail.co.uk
Guest
Posts: n/a

 
      12-22-2006, 08:24 AM
tc comes as part of the iproute2 package and is already installed on
(work) servers. Nistnet requires a separate install and all the
associated bureaucratic hassles.

Thanks for the advice though.

Back to original question - does anyone know why this code won't work?

tc qdisc add dev eth0 root handle 1: prio
tc qdisc add dev eth0 parent 1:3 handle 30: netem \
delay 200ms 10ms distribution normal
tc qdisc add dev eth0 parent 30:1 tbf rate 20kbit buffer 1600 limit
3000
tc filter add dev eth0 protocol ip parent 1:0 prio 3 u32 \
match ip dst 65.172.181.4/32 flowid 10:3

As I said before, I get the 200ms delay to all outbound traffic, not
just to the ip address specified by the tc filter.

Allen McIntosh wrote:

> (E-Mail Removed) wrote:
> > hi-
> >
> > I'd like to use tc and netem to cause network delay, but only to
> > certain other machines.

>
> Have you tried (or at least considered) nistnet?


 
Reply With Quote
 
Andy Furniss
Guest
Posts: n/a

 
      12-28-2006, 01:33 PM
(E-Mail Removed) wrote:
> tc comes as part of the iproute2 package and is already installed on
> (work) servers. Nistnet requires a separate install and all the
> associated bureaucratic hassles.
>
> Thanks for the advice though.
>
> Back to original question - does anyone know why this code won't work?
>
> tc qdisc add dev eth0 root handle 1: prio
> tc qdisc add dev eth0 parent 1:3 handle 30: netem \
> delay 200ms 10ms distribution normal
> tc qdisc add dev eth0 parent 30:1 tbf rate 20kbit buffer 1600 limit
> 3000
> tc filter add dev eth0 protocol ip parent 1:0 prio 3 u32 \
> match ip dst 65.172.181.4/32 flowid 10:3
>
> As I said before, I get the 200ms delay to all outbound traffic, not
> just to the ip address specified by the tc filter.


Maybe it's because your test traffic would have gone to 1:3 because prio
looks at tos. Try adding

tc filter add dev eth0 protocol ip parent 1:0 prio 4 u32 match u32 0 0
flowid 1:2

Andy.
 
Reply With Quote
 
 
 
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Emulating multiple nics with one Mambazo Linux Networking 7 11-07-2007 04:16 PM
tc, netem: Emulating multiple connections, problem with limit on the number of PRIO bands Patrick Reinhardt Linux Networking 1 08-28-2007 06:37 PM
Thinkpad IP addresses wrong Dave_s Windows Networking 0 11-11-2006 01:51 PM
DHCP assigning wrong addresses on vlan with correct gateway addres havin.issues Windows Networking 1 08-22-2006 03:03 PM
Wrong WEP code Roger Broadband Hardware 2 02-17-2004 12:37 PM



1 2 3 4 5 6 7 8 9 10 11