LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 03-14-2012, 08:48 AM   #1
markings
Member
 
Registered: Nov 2011
Location: Penn
Distribution: OpenSuSE 13.1
Posts: 33

Rep: Reputation: 3
Better understanding Traffic Control in Linux


Hello,

Traffic control is a very complex system which makes it very difficult to understand how it functions to write rules more efficiently. For now I had opted for PHP frontend that wrote the rules automatically to have an example how they're written so I can know how to implement them. Below is a sample of the rules I currently have:

Code:
#Flush mangle table
/usr/sbin/iptables -t mangle -D POSTROUTING -j SHARE_USERS
/usr/sbin/iptables -t mangle -F SHARE_USERS
/usr/sbin/iptables -t mangle -X SHARE_USERS
/usr/sbin/iptables -t mangle -N SHARE_USERS



#Shaper interfaces: eth0
/usr/sbin/tc qdisc del dev eth0 root
/usr/sbin/tc qdisc add dev eth0 root handle 1: htb r2q 2

#Root class:
/usr/sbin/tc class add dev eth0 parent 1: classid 1:1 htb rate 10Mbit ceil 10Mbit

  #Class::10Mbit
  /usr/sbin/tc class add dev eth0 parent 1:1 classid 1:1001 htb rate 10Mbit ceil 10Mbit burst 2Kbit prio 0
  /usr/sbin/tc qdisc add dev eth0 parent 1:1001 handle 1001: sfq perturb 10

      #Class::all
      /usr/sbin/tc class add dev eth0 parent 1:1001 classid 1:1002 htb rate 32Kbit ceil 32Kbit burst 2Kbit prio 3
      /usr/sbin/tc qdisc add dev eth0 parent 1:1002 handle 1002: sfq perturb 10
        #/usr/sbin/iptables -t mangle -A SHARE_USERS -o eth0 --protocol tcp -s 0.0.0.0/0 --sport 80 -d 0.0.0.0/0   -m comment --comment 'Web Server' -j CLASSIFY --set-class 1:1002
        /usr/sbin/iptables -t mangle -A SHARE_USERS -o eth0 --protocol tcp -s 0.0.0.0/0  -d 0.0.0.0/0  -m owner --gid-owner clients -m comment --comment 'All Traffic' -j CLASSIFY --set-class 1:1002
        /usr/sbin/iptables -t mangle -A SHARE_USERS -o eth0 --protocol tcp -s 0.0.0.0/0  -d 0.0.0.0/0  -m owner --gid-owner users -m comment --comment 'All Traffic' -j CLASSIFY --set-class 1:1002


#Shaper interfaces: eth1
/usr/sbin/tc qdisc del dev eth1 root
/usr/sbin/tc qdisc add dev eth1 root handle 1: htb r2q 2

#Root class:
/usr/sbin/tc class add dev eth1 parent 1: classid 1:1 htb rate 100Mbit ceil 100Mbit


#IPTABLES run
/usr/sbin/iptables -t mangle -A POSTROUTING -j SHARE_USERS
My question: The rules that I have above, does it apply for all outgoing traffic in the same group or per connection? IE. If two users where making a connection to two different destinations, will both users be capped at, for example 32Kbit? Or will each user individually be capped at 32Kbit, which will create a combined traffic of 64Kbit?
Best Regards

P.S. I'm far from a networking guru
 
Old 03-16-2012, 04:13 AM   #2
Celyr
Member
 
Registered: Mar 2012
Location: Italy
Distribution: Slackware+Debian
Posts: 321

Rep: Reputation: 81
Hi,

The limit is applied to the whole group 32Kbit for all the users (not each)
 
Old 03-17-2012, 09:50 AM   #3
markings
Member
 
Registered: Nov 2011
Location: Penn
Distribution: OpenSuSE 13.1
Posts: 33

Original Poster
Rep: Reputation: 3
Hello,

Thank you
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Should traffic control root qdsic & child class limit traffic? Washington Ratso Linux - Networking 0 02-23-2011 07:16 PM
tc traffic control tc traffic control Linux QoS control tool(noob help) inv|s|ble Linux - General 1 07-26-2007 11:12 AM
linux traffic control (tc) djsubari Linux - Networking 0 09-14-2006 07:09 AM
understanding linux bandwidth control sixth_sense Linux - Networking 1 05-03-2005 06:06 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 03:51 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration