Rename tc-gen.sh to tc-gen

This commit is contained in:
hk 2017-10-23 18:42:49 +02:00
parent 06eaebfb28
commit dc515aea3f
2 changed files with 17 additions and 17 deletions

View File

@ -4,37 +4,37 @@ policing on linux. It tries to use best practices whenever possible while still
being generic and easy to use. The script is using HTB with fq_codel to do being generic and easy to use. The script is using HTB with fq_codel to do
the heavy lifting. the heavy lifting.
Run tc-gen.sh without parameters to see more details. Run tc-gen without parameters to see more details.
## Examples of common use ## Examples of common use
Shape egress to 25 mbit/s Shape egress to 25 mbit/s
tc-gen.sh -i eth0 -u 25 tc-gen -i eth0 -u 25
Shape egress to 5 mbit/s and ingress to 10 mbit/s using IFB-interface Shape egress to 5 mbit/s and ingress to 10 mbit/s using IFB-interface
tc-gen.sh -i eth0 -u 5 -d 10 -f ifb0 tc-gen -i eth0 -u 5 -d 10 -f ifb0
Shape egress to 1500 kbit/s and police ingress to 20 mbit/s Shape egress to 1500 kbit/s and police ingress to 20 mbit/s
tc-gen.sh -i eth0 -u 1500k -d 20M tc-gen -i eth0 -u 1500k -d 20M
Display current configuration Display current configuration
tc-gen.sh -i eth0 tc-gen -i eth0
Remove configuration Remove configuration
tc-gen.sh -i eth0 -x tc-gen -i eth0 -x
## /etc/network/interfaces examples ## /etc/network/interfaces examples
# Simple DHCP WAN config # Simple DHCP WAN config
allow-auto eth1 allow-auto eth1
iface eth1 inet dhcp iface eth1 inet dhcp
post-up /usr/local/bin/tc-gen.sh -i ${IFACE} -u 10 -d 100 -f ifb0 post-up /usr/local/bin/tc-gen -i ${IFACE} -u 10 -d 100 -f ifb0
# More advanced example with an additional tc filter exclude for # More advanced example with an additional tc filter exclude for
# UDP-encapsulated IPsec ESP-traffic to avoid double counting IPsec data on # UDP-encapsulated IPsec ESP-traffic to avoid double counting IPsec data on
# ingress # ingress
allow-auto bond0.12 allow-auto bond0.12
iface bond0.12 inet dhcp iface bond0.12 inet dhcp
post-up /usr/local/bin/tc-gen.sh -i ${IFACE} -u 10 -d 100 -f ifb0 post-up /usr/local/bin/tc-gen -i ${IFACE} -u 10 -d 100 -f ifb0
post-up /sbin/tc filter add dev ${IFACE} parent ffff: protocol ip prio 1 u32 match ip protocol 17 0xff match ip dport 4500 0xffff action pass post-up /sbin/tc filter add dev ${IFACE} parent ffff: protocol ip prio 1 u32 match ip protocol 17 0xff match ip dport 4500 0xffff action pass
# Example with egress shaping on gre-tunnel # Example with egress shaping on gre-tunnel
@ -46,4 +46,4 @@ Remove configuration
endpoint 10.1.2.2 endpoint 10.1.2.2
mode gre mode gre
mtu 1400 mtu 1400
post-up /usr/local/bin/tc-gen.sh -i ${IFACE} -u 25 post-up /usr/local/bin/tc-gen -i ${IFACE} -u 25

View File

@ -1,7 +1,7 @@
#!/bin/bash #!/bin/bash
VERSION="1.1.6" VERSION="1.2.0"
TC=$(command -v tc) TC=$(command -v tc)
ETHTOOL=$(command -v ethtool) ETHTOOL=$(command -v ethtool)
IP=$(command -v ip) IP=$(command -v ip)
@ -22,7 +22,7 @@ set -o errtrace -o pipefail
print_usage () { print_usage () {
cat << EOF cat << EOF
tc-gen.sh -i IF_NAME [OPTIONS] tc-gen -i IF_NAME [OPTIONS]
-i IF_NAME -i IF_NAME
If this is the only option, the current filter, qdisc and class If this is the only option, the current filter, qdisc and class
@ -66,19 +66,19 @@ OPTIONS
EXAMPLES OF COMMON USE EXAMPLES OF COMMON USE
Shape egress to 25 mbit/s Shape egress to 25 mbit/s
tc-gen.sh -i eth0 -u 25 tc-gen -i eth0 -u 25
Shape egress to 5 mbit/s and ingress to 10 mbit/s using IFB-interface Shape egress to 5 mbit/s and ingress to 10 mbit/s using IFB-interface
tc-gen.sh -i eth0 -u 5 -d 10 -f ifb0 tc-gen -i eth0 -u 5 -d 10 -f ifb0
Shape egress to 1500 kbit/s and police ingress to 20 mbit/s Shape egress to 1500 kbit/s and police ingress to 20 mbit/s
tc-gen.sh -i eth0 -u 1500k -d 20M tc-gen -i eth0 -u 1500k -d 20M
Display current configuration Display current configuration
tc-gen.sh -i eth0 tc-gen -i eth0
Remove configuration Remove configuration
tc-gen.sh -i eth0 -x tc-gen -i eth0 -x
Always use ingress shaping vs policing if you want the best results. An Always use ingress shaping vs policing if you want the best results. An
additional bonus is that GRO normally can be left on when not using additional bonus is that GRO normally can be left on when not using
@ -125,7 +125,7 @@ EOF
} }
print_version () { print_version () {
echo "tc-gen.sh v${VERSION}" echo "tc-gen v${VERSION}"
} }
get_htb_quantum () { get_htb_quantum () {