tylertreat / comcast

Simulating shitty network connections so you can build better systems.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Add support for network exclusion parameter

dastergon opened this issue · comments

Hi,

It would be great to see an exclusion parameter in comcast which will exclude the rules to a specific network.

e.g., Apply the delay to everyone but 192.16.0.10:

comcast --device=eth0 --latency=250 --target-bw=1000 --packet-loss=10% -exclude-network 192.168.0.10

or to a specific CIDR:

comcast --device=eth0 --latency=250 --target-bw=1000 --packet-loss=10% -exclude-network 192.168.0.10/24

Example of tc command for network exclusion of packets of 192.168.1.15 with destination port 9001:

tc filter add dev eth0 protocol ip parent 1:0 prio 3 u32 match ip src 0/0 flowid 1:3
tc filter add dev eth0 protocol ipv6 parent 1:0 prio 4 u32 match ip6 src ::/0 flowid 1:3

tc filter add dev eth0 protocol ip parent 1:0 prio 1 u32 match ip dport 22 0xffff flowid 1:2
tc filter add dev eth0 protocol ip parent 1:0 prio 1 u32 match ip sport 22 0xffff flowid 1:2
tc filter add dev eth0 protocol ip parent 1:0 prio 1 u32 match ip src 192.168.1.15 match ip dport 9001 0xffff flowid 1:2

tc filter add dev eth0 protocol ipv6 parent 1:0 prio 2 u32 match ip6 dport 22 0xffff flowid 1:2
tc filter add dev eth0 protocol ipv6 parent 1:0 prio 2 u32 match ip6 sport 22 0xffff flowid 1:2
tc filter add dev eth0 protocol ipv6 parent 1:0 prio 2 u32 match ip6 dport 9001 0xffff flowid 1:2

Thanks,
Pavlos