1

I have 3 servers configured with IPv6 address and I want to add some delay to a couple of servers say S1 and S3. For IPv4, I'm using 'tc' command and it's working fine.

Commands using for IPv4 address:

tc qdisc ls dev eth1 
tc qdisc add dev eth1 root handle 1: prio
tc qdisc add dev eth1 parent 1:1 handle 2: netem delay 1000ms
tc filter add dev eth1 parent 1:0 protocol ip pref 55 handle ::55 u32 match ip 
   src 20.1.1.1 flowid 2:1
 tc filter add dev eth1 parent 1:0 protocol ip pref 55 handle ::55 u32 match 
   ip src 20.1.1.3 flowid 2:1

I want to add the same policy to Ipv6 address. Any help would be appreciated. Thanks in advance

metadata
  • 121
  • 5

1 Answers1

1

Since those filters apply to outgoing packets and match source IPs, and also the last two tc commands are clashing because reusing the same handle, I understand the rules are added directly to each server, or to a router if the handles are changed. It doesn't matter in the answer, where the handle won't be specified, thus leaving the system to choose them.

To switch to an equivalent IPv6 rule is quite simple: protocol ip is replaced with protocol ipv6 while match ip is replaced with match ip6. Thanks for the inconsistency! The same pref/prio can't be used when switching protocol. Reference for the two previous points: Using tc with IPv6 and IPv4 . Just add a handle if needed (with unique ::nodeid within the same pref).

So, to add a delay for the two additional addresses 2001:db8::10 and 2001:db8::20, keep all the previous rules in the Question and add those two rules:

tc filter add dev eth1 parent 1:0 protocol ipv6 pref 56 u32 match ip6 src 2001:db8::10 flowid 2:1
tc filter add dev eth1 parent 1:0 protocol ipv6 pref 56 u32 match ip6 src 2001:db8::20 flowid 2:1

The filter being called u32 really means it's working on 32bits. So each rule will actually use 4 matches because the IPv6 address is using 128bits.

A.B
  • 11,090
  • 2
  • 24
  • 45