Netem and virtual interfaces
Asked Answered
A

0

11

I need to emulate a network, introducing for instance random delay, and I need help to use NetEm. The scenario consists in two Ubuntu 14.04 machines: A and B.

A and B have ip addresses 192.168.0.1 and 192.168.0.2 on eth1. To avoid to mess with the NICs eth1, I have set virtual interfaces eth1:

sudo ifconfig eth1:1 192.168.1.x/24 up

At this point, only on B, I add the delay as follows:

sudo tc qdisc add dev eth1:1 root netem delay 50ms 10ms 25%

The problem is that this delay is experienced also on the physical NICs eth1. I mean, if I ping the addresses on eth1 (192.168.0.1 pings 192.168.0.2), the packets are delayed as if they were heading to eth1:1. Instead, I would expect delay only on eth1:1.

What happened? How can I solve this problem?

Moreover, I read that in this way, the network impairments affect only the egress traffic. How can I introduce delays both for the egress and the ingress traffic?

Aeolis answered 2/7, 2015 at 13:30 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.