I need to emulate a network with random latency, and I need help using NetEm. The script consists of two Ubuntu 14.04 machines: A and B.
A and B have the IP addresses 192.168.0.1 and 192.168.0.2 on eth1. To avoid mess with NIC eth1, I installed eth1 virtual interfaces:
sudo ifconfig eth1:1 192.168.1.x/24 up
At this point, only on B, I add a delay as follows:
sudo tc qdisc add dev eth1:1 root netem delay 50ms 10ms 25%
The problem is that this delay also occurs on the physical NIC eth1. I mean, if I ping addresses on eth1 (192.168. 0 .1 ping 192.168. 0 .2), packets are deferred as if they were routed to eth1: 1. Instead, I expect a delay only on eth1: 1.
What happened? How can I solve this problem?
In addition, I read that in this way network violations affect only outgoing traffic. How can I enter delays for both output and incoming traffic?
source
share