Created
April 20, 2011 14:10
-
-
Save jhsu/931423 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
set -v | |
# initial setup | |
tc qdisc del dev eth0 root # clear eth0 | |
tc qdisc add dev eth0 root handle 2 htb default 1 # set default class |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
iptables -N TRAFFIC_ACCT | |
iptables -I INPUT -j TRAFFIC_ACCT # or FORWARD | |
iptables -A TRAFFIC_ACCT -p tcp | |
iptables -A TRAFFIC_ACCT -p udp | |
iptables -A TRAFFIC_ACCT -p icmp | |
# view | |
iptables -L TRAFFIC_ACCT -n -v -x | |
# iptables -Z TRAFFIC_ACCT # Zero out counters | |
# iptables -F TRAFFIC_ACCT # Remove all rules for chain |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment