Skip to content

Instantly share code, notes, and snippets.

@ignisf
Created March 14, 2021 00:17
Show Gist options
  • Save ignisf/61ec6daad383e5abe715f5d27513fdca to your computer and use it in GitHub Desktop.
Save ignisf/61ec6daad383e5abe715f5d27513fdca to your computer and use it in GitHub Desktop.
set -x
tc qdisc del dev eth2 root
tc qdisc del dev eth2 ingress
ip link del eth2slowingress
ip link del eth2slowegress
ip link del eth2fastingress
ip link del eth2fastegress
tc qdisc del dev eth2 handle ffff: clsact
tc filter del dev eth2
tc filter del dev eth2 ingress
tc filter del dev eth2 egress
#tc qdisc add dev eth2 root handle 1: cake bandwidth 90mbit nat
tc qdisc add dev eth2 root pfifo
ip link add name eth2slowingress type ifb
ip link add name eth2slowegress type ifb
ip link set eth2slowingress up
ip link set eth2slowegress up
tc qdisc add dev eth2slowingress root cake bandwidth 90mbit ethernet ether-vlan nat ingress
tc qdisc add dev eth2slowegress root cake bandwidth 90mbit ethernet ether-vlan nat
ip link add name eth2fastingress type ifb
ip link add name eth2fastegress type ifb
ip link set up eth2fastingress
ip link set up eth2fastegress
tc qdisc add dev eth2fastingress root cake bandwidth 270mbit ethernet nat ingress metro
tc qdisc add dev eth2fastegress root cake bandwidth 270mbit ethernet nat metro
tc qdisc add dev eth2 handle ffff: clsact
#tc filter add dev eth2 egress protocol ip prio 99 u32 match ip dst 0.0.0.0/0 flowid 1:1 action mirred egress redirect dev slowegress
#tc filter add dev eth2 ingress protocol ip prio 99 u32 match ip src 0.0.0.0/0 flowid 1:1 action mirred egress redirect dev slowingress
#tc filter add dev eth2 egress protocol ip prio 1 u32 match ip dst 185.117.82.66/32 flowid 1:
#tc filter add dev eth2 ingress protocol ip prio 1 u32 match ip src 185.117.82.66/32 flowid 1:1 action mirred egress redirect dev ifb4eth2
tc filter add dev eth2 egress protocol ip prio 10 basic match "ipset(bulgaria dst)" action mirred egress redirect dev eth2fastegress
tc filter add dev eth2 ingress protocol ip prio 10 basic match "ipset(bulgaria src)" action mirred egress redirect dev eth2fastingress
#tc filter add dev eth2 egress protocol ip prio 10 basic match "not(ipset(bulgaria dst))" action mirred egress redirect dev eth2slowegress
#tc filter add dev eth2 ingress protocol ip prio 10 basic match "not(ipset(bulgaria src))" action mirred egress redirect dev eth2slowingress
tc filter add dev eth2 egress protocol ip prio 90 matchall action mirred egress redirect dev eth2slowegress
tc filter add dev eth2 ingress protocol ip prio 90 matchall action mirred egress redirect dev eth2slowingress
#tc filter add dev eth2 egress protocol ip prio 90 u32 match ip src 0.0.0.0/0 action mirred egress redirect dev eth2slowegress
#tc filter add dev eth2 ingress protocol ip prio 90 u32 match ip src 0.0.0.0/0 action mirred egress redirect dev eth2slowingress
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment