I would like to match 4 IP addresses as src and other 4 IP addresses as dst when using tc filter
I do know I could use subnets in match but unfortunately my addresses does not form a subnet instead I have distinct IP addresses.
I have a working script with 1 IP address as src and 1 IP address as dst
export IF=enp0s8
export IP1=10.1.2.11
export IP2=10.1.2.15
tc qdisc del dev $IF root
tc qdisc add dev $IF root handle 1:0 htb
tc class add dev $IF parent 1:0 classid 1:1 htb rate 20mbit
tc filter add dev $IF protocol ip parent 1:0 prio 1 u32 match ip dst $IP1/32 match ip src $IP2/32 flowid 1:1
tc filter add dev $IF protocol ip parent 1:0 prio 1 u32 match ip dst $IP2/32 match ip src $IP1/32 flowid 1:1
Because I have 4 src and 4 dst IP addresses I can accomplish the task by adding total of 32 lines of tc filter... but I am not sure there is not more efficient way.
I've tried to google for match syntax with no success. As a guesswork here is what I've tried with no success:
export IPGROUP1=10.1.2.11, 10.1.2.12, 10.1.2.13, 10.1.2.14
export IPGROUP2=10.1.2.15, 10.1.2.16, 10.1.2.17, 10.1.2.18
tc filter add dev $IF protocol ip parent 1:0 prio 1 u32 match ip dst $IPGROUP1 match ip src $IPGROUP2 flowid 1:1
tc filter add dev $IF protocol ip parent 1:0 prio 1 u32 match ip dst $IPGROUP2 match ip src $IPGROUP1 flowid 1:1
tc˛. Anyway I found something promising:--src-range ip-ip...