Why does tc-netem on loopback also affects other interfaces?
4
votes
1
answer
780
views
I'm trying to modify the network behaviour of my server(s), to simulate *external/WAN connection behaviours* (what ever that means).
After doing
tc qdisc add dev lo root netem delay 100ms
, I can successfully add 100ms delay to all traffic from (and to?) 127.0.0.1
. E.g. ping 127.0.0.1
will have 200ms response time.
However, this also affect my traffic to other interfaces. For example, I have interface eth1
with IP address 192.168.0.1
on the current server A
. If I do ping 192.168.0.1
, it will also have the 100ms delay (resulting in 200ms response time).
I'm confused by this behaviour. I would expect lo
has nothing to do with eth1
, but it seems not to be the case.
I assume this means Linux kernel automatically identifies 192.168.0.1
is a local address, and re-routes all traffic (originally to eth1
) to lo
?
And if so, is there a way to **disable** this behaviour?
----
Background:
I would like to simulate *external network* behaviour even when processes on server A
want to communicate to each other (through TCP/IP on the given local addresses and ports, of course). Essentially I want to add delay to eth1
, but that's above this question (see my other question ).
My servers are running Ubuntu 18.04, but I believe that does not matter.
Asked by renyuneyun
(449 rep)
Sep 21, 2022, 09:35 AM
Last activity: Sep 21, 2022, 12:07 PM
Last activity: Sep 21, 2022, 12:07 PM