rendered paste body/sbin/tc qdisc add dev eth1 handle 1: root htb default 1
/usr/local/sbin/iptables -t mangle -N ms-all
/usr/local/sbin/iptables -t mangle -N ms-all-chains
/usr/local/sbin/iptables -t mangle -N ms-prerouting
/usr/local/sbin/iptables -t mangle -A PREROUTING -j ms-prerouting
/usr/local/sbin/iptables -t mangle -A ms-prerouting -j CONNMARK --restore-mark
/usr/local/sbin/iptables -t mangle -A ms-prerouting -m physdev --physdev-in eth0 -j ms-all
/usr/local/sbin/iptables -t mangle -A POSTROUTING -m physdev --physdev-out eth1 -j ms-all-chains
/sbin/tc class add dev eth1 parent 1: classid 1:1 htb rate 4000Kbit
/sbin/tc filter add dev eth1 parent 1:0 protocol all u32 match u32 0 0 classid 1:1
######### boost ACK packets
/sbin/tc class add dev eth1 parent 1:1 classid 1:2 htb rate 450Kbit ceil 500Kbit burst 1000Kbit prio 1 quantum 1532
/sbin/tc qdisc add dev eth1 handle 2: parent 1:2 sfq
/usr/local/sbin/iptables -t mangle -A ms-all-chains -p tcp -m length --length :64 -j CLASSIFY --set-class 1:2
/usr/local/sbin/iptables -t mangle -A ms-all-chains -p tcp -m length --length :64 -j RETURN
######### Incoming Rules
######### chain WAN
/sbin/tc class add dev eth1 parent 1:1 classid 1:11 htb rate 4000Kbit ceil 4000Kbit burst 4000Kbit quantum 1532
/usr/local/sbin/iptables -t mangle -N ms-chain-eth1-1:11
/usr/local/sbin/iptables -t mangle -A ms-all-chains -m connmark --mark 0x78512774 -j ms-chain-eth1-1:11
/usr/local/sbin/iptables -t mangle -A ms-all -m physdev --physdev-in eth0 -j MARK --set-mark 0x78512774
/usr/local/sbin/iptables -t mangle -A ms-all -m physdev --physdev-in eth0 -j RETURN
######### generating pipes for WAN
######### pipe Ping
/sbin/tc class add dev eth1 parent 1:11 classid 1:12 htb rate 450Kbit ceil 500Kbit burst 1000Kbit prio 1 quantum 1532
/sbin/tc qdisc add dev eth1 handle 12: parent 1:12 sfq
/usr/local/sbin/iptables -t mangle -A ms-chain-eth1-1:11 -p 1 -j CLASSIFY --set-class 1:12
/usr/local/sbin/iptables -t mangle -A ms-chain-eth1-1:11 -p 1 -j RETURN
######### pipe SSH
/sbin/tc class add dev eth1 parent 1:11 classid 1:13 htb rate 450Kbit ceil 500Kbit burst 1000Kbit prio 1 quantum 1532
/sbin/tc qdisc add dev eth1 handle 13: parent 1:13 sfq
/usr/local/sbin/iptables -t mangle -A ms-chain-eth1-1:11 -p 6 --tcp-flags ACK ACK -m multiport --port 22 -j CLASSIFY --set-class 1:13
/usr/local/sbin/iptables -t mangle -A ms-chain-eth1-1:11 -p 6 --tcp-flags ACK ACK -m multiport --port 22 -j RETURN
######### pipe Web Traffic
/sbin/tc class add dev eth1 parent 1:11 classid 1:14 htb rate 50Kbit ceil 50Kbit burst 50Kbit prio 5 quantum 1532
/sbin/tc qdisc add dev eth1 handle 14: parent 1:14 sfq
/usr/local/sbin/iptables -t mangle -A ms-chain-eth1-1:11 -m layer7 --l7proto http-freshdownload -j CLASSIFY --set-class 1:14
/usr/local/sbin/iptables -t mangle -A ms-chain-eth1-1:11 -m layer7 --l7proto http-freshdownload -j RETURN
/usr/local/sbin/iptables -t mangle -A ms-chain-eth1-1:11 -m layer7 --l7proto httpcachehit -j CLASSIFY --set-class 1:14
/usr/local/sbin/iptables -t mangle -A ms-chain-eth1-1:11 -m layer7 --l7proto httpcachehit -j RETURN
/usr/local/sbin/iptables -t mangle -A ms-chain-eth1-1:11 -m layer7 --l7proto httpcachemiss -j CLASSIFY --set-class 1:14
/usr/local/sbin/iptables -t mangle -A ms-chain-eth1-1:11 -m layer7 --l7proto httpcachemiss -j RETURN
/usr/local/sbin/iptables -t mangle -A ms-chain-eth1-1:11 -m layer7 --l7proto httpvideo -j CLASSIFY --set-class 1:14
/usr/local/sbin/iptables -t mangle -A ms-chain-eth1-1:11 -m layer7 --l7proto httpvideo -j RETURN
/usr/local/sbin/iptables -t mangle -A ms-chain-eth1-1:11 -m layer7 --l7proto http-dap -j CLASSIFY --set-class 1:14
/usr/local/sbin/iptables -t mangle -A ms-chain-eth1-1:11 -m layer7 --l7proto http-dap -j RETURN
/usr/local/sbin/iptables -t mangle -A ms-chain-eth1-1:11 -m layer7 --l7proto httpaudio -j CLASSIFY --set-class 1:14
/usr/local/sbin/iptables -t mangle -A ms-chain-eth1-1:11 -m layer7 --l7proto httpaudio -j RETURN
/usr/local/sbin/iptables -t mangle -A ms-chain-eth1-1:11 -m layer7 --l7proto http-itunes -j CLASSIFY --set-class 1:14
/usr/local/sbin/iptables -t mangle -A ms-chain-eth1-1:11 -m layer7 --l7proto http-itunes -j RETURN
/usr/local/sbin/iptables -t mangle -A ms-chain-eth1-1:11 -m layer7 --l7proto html -j CLASSIFY --set-class 1:14
/usr/local/sbin/iptables -t mangle -A ms-chain-eth1-1:11 -m layer7 --l7proto html -j RETURN
/usr/local/sbin/iptables -t mangle -A ms-chain-eth1-1:11 -m layer7 --l7proto http -j CLASSIFY --set-class 1:14
/usr/local/sbin/iptables -t mangle -A ms-chain-eth1-1:11 -m layer7 --l7proto http -j RETURN
/usr/local/sbin/iptables -t mangle -A ms-chain-eth1-1:11 -m layer7 --l7proto http-rtsp -j CLASSIFY --set-class 1:14
/usr/local/sbin/iptables -t mangle -A ms-chain-eth1-1:11 -m layer7 --l7proto http-rtsp -j RETURN
/sbin/tc class add dev eth1 parent 1:11 classid 1:199 htb rate 50Kbit ceil 50Kbit burst 50Kbit prio 5 quantum 1532
/sbin/tc qdisc add dev eth1 handle 199: parent 1:199 sfq
/usr/local/sbin/iptables -t mangle -A ms-chain-eth1-1:11 -j CLASSIFY --set-class 1:199
/usr/local/sbin/iptables -t mangle -A ms-chain-eth1-1:11 -j RETURN
/sbin/tc qdisc add dev eth0 handle 1: root htb default 1
/usr/local/sbin/iptables -t mangle -A ms-prerouting -m physdev --physdev-in eth1 -j ms-all
/usr/local/sbin/iptables -t mangle -A POSTROUTING -m physdev --physdev-out eth0 -j ms-all-chains
/sbin/tc class add dev eth0 parent 1: classid 1:1 htb rate 4000Kbit
/sbin/tc filter add dev eth0 parent 1:0 protocol all u32 match u32 0 0 classid 1:1
######### Outgoing Rules
######### chain WAN
/sbin/tc class add dev eth0 parent 1:1 classid 1:11 htb rate 4000Kbit ceil 4000Kbit burst 4000Kbit quantum 1532
/usr/local/sbin/iptables -t mangle -N ms-chain-eth0-1:11
/usr/local/sbin/iptables -t mangle -A ms-all-chains -m connmark --mark 0xc0ed4017 -j ms-chain-eth0-1:11
/usr/local/sbin/iptables -t mangle -A ms-all -m physdev --physdev-in eth1 -j MARK --set-mark 0xc0ed4017
/usr/local/sbin/iptables -t mangle -A ms-all -m physdev --physdev-in eth1 -j RETURN
######### generating pipes for WAN
######### pipe Ping
/sbin/tc class add dev eth0 parent 1:11 classid 1:12 htb rate 450Kbit ceil 500Kbit burst 1000Kbit prio 1 quantum 1532
/sbin/tc qdisc add dev eth0 handle 12: parent 1:12 sfq
/usr/local/sbin/iptables -t mangle -A ms-chain-eth0-1:11 -p 1 -j CLASSIFY --set-class 1:12
/usr/local/sbin/iptables -t mangle -A ms-chain-eth0-1:11 -p 1 -j RETURN
######### pipe SSH
/sbin/tc class add dev eth0 parent 1:11 classid 1:13 htb rate 450Kbit ceil 500Kbit burst 1000Kbit prio 1 quantum 1532
/sbin/tc qdisc add dev eth0 handle 13: parent 1:13 sfq
/usr/local/sbin/iptables -t mangle -A ms-chain-eth0-1:11 -p 6 --tcp-flags ACK ACK -m multiport --port 22 -j CLASSIFY --set-class 1:13
/usr/local/sbin/iptables -t mangle -A ms-chain-eth0-1:11 -p 6 --tcp-flags ACK ACK -m multiport --port 22 -j RETURN
######### pipe Web Traffic
/sbin/tc class add dev eth0 parent 1:11 classid 1:14 htb rate 50Kbit ceil 50Kbit burst 50Kbit prio 5 quantum 1532
/sbin/tc qdisc add dev eth0 handle 14: parent 1:14 sfq
/usr/local/sbin/iptables -t mangle -A ms-chain-eth0-1:11 -m layer7 --l7proto http-freshdownload -j CLASSIFY --set-class 1:14
/usr/local/sbin/iptables -t mangle -A ms-chain-eth0-1:11 -m layer7 --l7proto http-freshdownload -j RETURN
/usr/local/sbin/iptables -t mangle -A ms-chain-eth0-1:11 -m layer7 --l7proto httpcachehit -j CLASSIFY --set-class 1:14
/usr/local/sbin/iptables -t mangle -A ms-chain-eth0-1:11 -m layer7 --l7proto httpcachehit -j RETURN
/usr/local/sbin/iptables -t mangle -A ms-chain-eth0-1:11 -m layer7 --l7proto httpcachemiss -j CLASSIFY --set-class 1:14
/usr/local/sbin/iptables -t mangle -A ms-chain-eth0-1:11 -m layer7 --l7proto httpcachemiss -j RETURN
/usr/local/sbin/iptables -t mangle -A ms-chain-eth0-1:11 -m layer7 --l7proto httpvideo -j CLASSIFY --set-class 1:14
/usr/local/sbin/iptables -t mangle -A ms-chain-eth0-1:11 -m layer7 --l7proto httpvideo -j RETURN
/usr/local/sbin/iptables -t mangle -A ms-chain-eth0-1:11 -m layer7 --l7proto http-dap -j CLASSIFY --set-class 1:14
/usr/local/sbin/iptables -t mangle -A ms-chain-eth0-1:11 -m layer7 --l7proto http-dap -j RETURN
/usr/local/sbin/iptables -t mangle -A ms-chain-eth0-1:11 -m layer7 --l7proto httpaudio -j CLASSIFY --set-class 1:14
/usr/local/sbin/iptables -t mangle -A ms-chain-eth0-1:11 -m layer7 --l7proto httpaudio -j RETURN
/usr/local/sbin/iptables -t mangle -A ms-chain-eth0-1:11 -m layer7 --l7proto http-itunes -j CLASSIFY --set-class 1:14
/usr/local/sbin/iptables -t mangle -A ms-chain-eth0-1:11 -m layer7 --l7proto http-itunes -j RETURN
/usr/local/sbin/iptables -t mangle -A ms-chain-eth0-1:11 -m layer7 --l7proto html -j CLASSIFY --set-class 1:14
/usr/local/sbin/iptables -t mangle -A ms-chain-eth0-1:11 -m layer7 --l7proto html -j RETURN
/usr/local/sbin/iptables -t mangle -A ms-chain-eth0-1:11 -m layer7 --l7proto http -j CLASSIFY --set-class 1:14
/usr/local/sbin/iptables -t mangle -A ms-chain-eth0-1:11 -m layer7 --l7proto http -j RETURN
/usr/local/sbin/iptables -t mangle -A ms-chain-eth0-1:11 -m layer7 --l7proto http-rtsp -j CLASSIFY --set-class 1:14
/usr/local/sbin/iptables -t mangle -A ms-chain-eth0-1:11 -m layer7 --l7proto http-rtsp -j RETURN
/sbin/tc class add dev eth0 parent 1:11 classid 1:199 htb rate 50Kbit ceil 50Kbit burst 50Kbit prio 5 quantum 1532
/sbin/tc qdisc add dev eth0 handle 199: parent 1:199 sfq
/usr/local/sbin/iptables -t mangle -A ms-chain-eth0-1:11 -j CLASSIFY --set-class 1:199
/usr/local/sbin/iptables -t mangle -A ms-chain-eth0-1:11 -j RETURN
/usr/local/sbin/iptables -t mangle -A ms-prerouting -j CONNMARK --save-mark