Linux - NetworkingThis forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Distribution: Redhat, Fedora, Open BSD, FreeBSD, SlackWare
Posts: 115
Rep:
TC traffic control with htb
Dear all Gurus,
you kind attention and help required in TC traffic control with htb, as i am still beginner in TC (traffic control).
I want to understand priority setting in TC and its filter.
I am using following lines in my script but when I check with (watch -n 0 tc -s class ls dev eth0) command, it shows different priorities on my rules.
Please help, if you dont aggree with my script lines then kindly only help me with how to set priorities. with your own simple TC lines.
# Name of the traffic control command.
TC=/sbin/tc
IPTABLES=/sbin/iptables
# ISP1 Download limit (in mega bits)
ISP1DNLD=100 (ISP1 interface download speed) # ISP2 Download limit (in mega bits)
ISP2DNLD=100 (ISP2 interface download speed) # Proxy Browsing to-words Users
PDNLD=100 (Proxy download speed)
# The network interface we're planning on limiting bandwidth.
# LOCAL LAN Interface
LOCALIF=eth0 # ISP2 Interface
ISP2IF=eth4 # ISP1 Interface
ISP1IF=eth2
#LOCAL LAN Interface Speed
LOCALIFDN=100 (download speed)
LOCALIFUP=100 (upload speed)
# IP address of the machine OR NETWORK we are controlling
LOCALNET=192.168.0.0
$TC qdisc add dev $LOCALIF root handle 1: htb default 1
$TC class add dev $LOCALIF parent 1: classid 1:1 htb prio 60 rate $[LOCALIFDN]mbit ceil $[LOCALIFDN]mbit # email traffic form ISP1 to user
$TC class add dev $LOCALIF parent 1:1 classid 1:10 htb prio 1 rate $[ISP1DNLD/30]mbit ceil $[TWDNLD/30]mbit #for ports 1-65535 from ISP1 to user and for port 443 from ISP1 to user
$TC class add dev $LOCALIF parent 1:1 classid 1:20 htb prio 10 rate $[ISP1DNLD/20]mbit ceil $[TWDNLD/20]mbit #for Proxy port 8080 to user / proxy serving towords user
$TC class add dev $LOCALIF parent 1:1 classid 1:30 htb prio 0 rate $[PDNLD/15]mbit ceil $[PDNLD/15]mbit #for port 443 from ISP2 to user and for port 1-65535 from ISP2 to user
$TC class add dev $LOCALIF parent 1:1 classid 1:40 htb prio 12 rate $[ISP2DNLD/15]mbit ceil $[ISP2DNLD/15]mbit
$TC class add dev $LOCALIF parent 1:1 classid 1:50 htb prio 15 rate $[ISP2DNLD/15]mbit ceil $[ISP2DNLD/15]mbit
# email traffic form ISP1 to user
$TC filter add dev $LOCALIF protocol ip parent 1:0 prio 0 handle 11 fw flowid 1:10 #for ports 1-65535 from ISP1 to user and for port 443 from ISP1 to user
$TC filter add dev $LOCALIF protocol ip parent 1:0 prio 2 handle 12 fw flowid 1:20
$TC filter add dev $LOCALIF protocol ip parent 1:0 prio 55 handle 13 fw flowid 1:20 #for Proxy port 8080 to user / proxy serving towords user
$TC filter add dev $LOCALIF protocol ip parent 1:0 prio 0 handle 14 fw flowid 1:30 #for port 443 from ISP2 to user and for port 1-65535 from ISP2 to user
$TC filter add dev $LOCALIF protocol ip parent 1:0 prio 13 handle 15 fw flowid 1:40
$TC filter add dev $LOCALIF protocol ip parent 1:0 prio 0 handle 16 fw flowid 1:50
Hard to believe that you've been here for 13 years, and asking about TC for 12, that you're a 'beginner in TC'.
Quote:
I want to understand priority setting in TC and its filter. I am using following lines in my script but when I check with (watch -n 0 tc -s class ls dev eth0) command, it shows different priorities on my rules.
Right...because you have SET different priorities on your rules.
Quote:
Please help, if you dont aggree with my script lines then kindly only help me with how to set priorities. with your own simple TC lines.
So you want us to just FIX your script for you, but not help you do it yourself? Read the man page on TC...pay special attention to the part where it mentions "prio".
And a better question here would be, what is the actual PROBLEM with what you've done/tried? What's it doing/not-doing?
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.