Limit the speed of a network interface.
I am setting up a linux router, It routes to 2 different networks, one is a full internal lan, the other exists only for a wireless router to connect to. I will explain my reasons for this after my question:
I do nto want to limit the speed of any other interface, however 'eth1' the interface that connects directly to a wireless router (and provides that wireless router w/ it's internet connection) needs to be limited. I am going to open up that wifi for people to connect to freely, and I do not want it to suck up all my bandwidth. I am hoping to avoid using complicated traffic shaping to accomplish this, I would like to just be able to point at the interface and say hey, no more than 128kbps either direction, or possibly specify a slightly higher download but that upload. The setup: The router has 5 network cards, 1 is connected to a static ip on a dsl router, the other has a static ip on a cable router. I have configured the system to use load balancing to utilize both connections (3/4 connections use cable, 1/4 use the dsl). I then route this into 2 seperate internal networks, one exists solely to provide internet to my public wifi router, the other is a full internal network with several stations. The final interface is used to directly connect with another station and has no routing configured for it. The bandwidth limiting on a specific interface is the only part that I do not have covered. |
I don't really have the answer, but I saw this post and decided to reply since I have to do the same thing on Monday for a lab test for a customer. (I have to limit bandwidth to mimic a 512K WAN link to test an application.) I've done some research so far and found the following info just doing google searches and reading some forum posts. I think I am going to try 'tc' first since 'tc'. Here is some links to check out:
Wondershaper: http://lartc.org/wondershaper/ rshaper: http://freshmeat.net/projects/rshaper/ tc cbq: http://lartc.org/howto/lartc.qdisc.c...l.html#AEN1072 http://www.knowplace.org/pages/howto...x/examples.php http://www.experts-exchange.com/Netw..._20819743.html linux traffic shaper: http://lwn.net/1998/1119/shaper.html |
Thank you, I also found the last link you listed, thats the one I think meets my needs th ebest, of course in the newest kernel that module is listed as obsolete :-(
|
http://lartc.org/howto/lartc.qdisc.c...l.html#AEN1072
This was most useful, initally I followed the stuff at the bottom, then on other pages. Just a tip for you, you can only throttle packets leaving your system, so if you want to limit both directions you need to limit the outgoing (easy by the bottom of that page) but then you need to limit the outgoing on the internet facing interface as well, if you do not want to limit all internet traffic, only that being routed to the internal network (as I did) then you can mark the packets comming in from the internal interface using ip tables then specify a different rule/filter thingy for them when they exit the internet interface VS other traffic leaving the interface. The guide is nto the most clear, but the information is all there, if you have trouble w/ it though let me know and I will give you a commented copy of my script for details. |
exodist
The thread is old - I just found it and thought this could be useful: http://wiki.leipzig.freifunk.net/Tra...ochens_Version The site is in german only - sorry. If you are interested - I made a version with english comments too. The first script there is made for a Wireless Home Router like WRT54GL and does not shape but merely prioritize traffic to the internet - you put yourself (your IP) in the highest priority - and whenever you access the net - you are the first to get served. That way I share my connection with others - without even noticing that I do so. The project is a wireless mesh network to provide (among other more important goals) access to the net for people who do not have the opportunity to have their own line. One alone rarely ever uses the bandwidth of a highspeed line. I would be interested to see your approach - is it available somewhere? PM? |
I have since changed my setup and no longer use throttling, and the completed and working script is lost. However I checked and I have atemp copy of the script that I did not delete. I am not sure if it works as is, there may be a typeo or an invalid command somewhere in it I was debugging, however it will show you what need to be done. Keep in mind this script also has 2 other features that can make it confusing when everything is thrown together. The other features are ethernet bonding, and dual internet connections. As well there are 2 or 3 internal networks...
Code:
#!/sbin/runscript |
Thank you for digging it out - I see what it did (knowing the background) as such a thing is always specially made to suit a need.
|
Hi, I've like to do something very similar, however, firstly, I'd like to apologize, as I am very new to Linux, so this is probably a very simple question:
How would I limit only the upload of a specific interface? My network setup: Internet: eth0 LAN: br0 (eth1,eth2,ath0) The interface I'd like to limit is ath0, which is the wifi. |
the tc command from the iproute2 package has some great filters for specify bandwidth usage (like the tbf filter).
|
All times are GMT -5. The time now is 03:34 AM. |