Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- iface="eth1"
- tc qdisc del dev eth1 root handle 1: >/dev/null 2>&1
- tc qdisc add dev eth1 root handle 1: htb default 4
- tc class add dev eth1 parent 1: classid 1:1 htb rate 20mbit ceil 20mbit
- tc class add dev eth1 parent 1:1 classid 1:4 htb rate 10mbit ceil 20mbit
- tc class add dev eth1 parent 1:1 classid 1:5 htb rate 5mbit ceil 20mbit prio 1 # VPN (tun0, src/dst:192.168.100.0/24)
- tc class add dev eth1 parent 1:1 classid 1:6 htb rate 3mbit ceil 20mbit # single Application dest-ip
- tc class add dev eth1 parent 1:1 classid 1:7 htb rate 1mbit ceil 1mbit # WLAN Traffic
- tc qdisc add dev eth1 parent 1:4 handle 4: sfq perturb 10
- tc qdisc add dev eth1 parent 1:5 handle 5: sfq perturb 10
- tc qdisc add dev eth1 parent 1:6 handle 6: sfq perturb 10
- tc qdisc add dev eth1 parent 1:7 handle 7: sfq perturb 10
- tc filter add dev eth1 protocol ip parent 1: prio 1 handle 5 fw flowid 1:5
- tc filter add dev eth1 protocol ip parent 1: prio 2 handle 6 fw flowid 1:6
- tc filter add dev eth1 protocol ip parent 1: prio 2 handle 7 fw flowid 1:7
- # iptables
- iptables -t mangle -A PREROUTING -s 192.168.100.0/24 -j MARK --set-mark 5
- iptables -t mangle -A PREROUTING -d 192.168.100.0/24 -j MARK --set-mark 5
- iptables -t mangle -A PREROUTING -d 78.47.160.248 -j MARK --set-mark 6
- iptables -t mangle -A PREROUTING -s 192.168.50.181 -j MARK --set-mark 7
- # root@choke:/usr/local/bin# tc -s qdisc ls dev eth1
- qdisc htb 1: root refcnt 2 r2q 10 default 4 direct_packets_stat 0
- Sent 16113687 bytes 62076 pkt (dropped 0, overlimits 7105 requeues 0)
- rate 0bit 0pps backlog 0b 0p requeues 0
- qdisc sfq 4: parent 1:4 limit 127p quantum 1514b perturb 10sec
- Sent 16103352 bytes 61602 pkt (dropped 0, overlimits 0 requeues 0)
- rate 0bit 0pps backlog 0b 0p requeues 0
- qdisc sfq 5: parent 1:5 limit 127p quantum 1514b perturb 10sec
- Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0)
- rate 0bit 0pps backlog 0b 0p requeues 0
- qdisc sfq 6: parent 1:6 limit 127p quantum 1514b perturb 10sec
- Sent 4812 bytes 58 pkt (dropped 0, overlimits 0 requeues 0)
- rate 0bit 0pps backlog 0b 0p requeues 0
- qdisc sfq 7: parent 1:7 limit 127p quantum 1514b perturb 10sec
- Sent 5523 bytes 28 pkt (dropped 0, overlimits 0 requeues 0)
- rate 0bit 0pps backlog 0b 0p requeues 0
- # root@choke:/usr/local/bin# tc -s filter ls dev eth1
- filter parent 1: protocol ip pref 1 fw
- filter parent 1: protocol ip pref 1 fw handle 0x5 classid 1:5
- filter parent 1: protocol ip pref 2 fw
- filter parent 1: protocol ip pref 2 fw handle 0x6 classid 1:6
- filter parent 1: protocol ip pref 2 fw handle 0x7 classid 1:7
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement