1

I need to simulate network environment with bad network connections for about 1000 hosts.

Can tc (with netem) be used with virtual network interfaces (like eth0:0, eth0:1)?

When I try to use tc on many virtual interfaces with different parameters - it seems that all virtual interfaces have one tc configuration.

My problem is similar to this:

https://stackoverflow.com/questions/31186010/netem-and-virtual-interfaces

2

Can tc be used with virtual network interfaces

Yes.

(like eth0:0, eth0:1)?

No.

Those aren't virtual network interfaces. They're aliases for network interfaces. There's a huge difference.

It's an oldfashioned way to specify more than one address per interface, instead of the modern approach of ip address add/change/replace/del $ip dev $interface.

https://www.kernel.org/doc/Documentation/networking/alias.txt

IP-aliases are an obsolete way to manage multiple IP-addresses/masks per interface.

And that's pretty much all you can use them for. Best not to use them at all. Aliases make you think they're virtual devices with all the bells and whistles but they're not. Aliases exist in name only - they don't do anything.

If you need a genuine virtual network device, you can have a look at bridge devices (virtualization), or tun/tap devices (openvpn). For tc specifically, you might also be interested in IMQ / IFB.

If you just want to filter by IP address, you can specify those in tc filter or mark them in iptables and then filter by mark.

  • When I'm adding new address I can't see it in ifconfig. Is this normal? – Kamil Sep 21 '18 at 8:57
  • Yes... even the ifconfig manpage says "Please use ip link ..." ;-) ...basically you don't use ifconfig and route anymore. Now it's ip link, ip address, ip route, ... – frostschutz Sep 21 '18 at 9:57
  • Oh dear. I have to learn Linux again... – Kamil Sep 22 '18 at 21:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.