LinuxQuestions.org
Review your favorite Linux distribution.
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 10-31-2016, 10:48 AM   #1
forrie
Member
 
Registered: Sep 2003
Distribution: RedHat
Posts: 41

Rep: Reputation: 15
Limiting network speed, per interface, for testing


There appear to be a number of ways to throttle or otherwise limit network speed in Linux. In our application, I propose to use a multiport ethernet card and, either through scripting or otherwise, assign each port a network speed role, such as 3G, DSL, 100MB, 1GB, etc. This is for testing and QA of our video streams performance. Presumably, some form of latency tweaking.

My question is what is the easiest way to provide this? Especially, in a manner that won't require sysadmin assistance with any frequency.

I do have access to some HP switches, and I'd considered whether that might be an option, but for now, I would like to explore the server-based solution. The information out there is dizzying--I've not pulled this off before, so I would appreciate some pointers.

Thank you.
 
Old 10-31-2016, 04:08 PM   #2
jefro
Moderator
 
Registered: Mar 2008
Posts: 22,025

Rep: Reputation: 3632Reputation: 3632Reputation: 3632Reputation: 3632Reputation: 3632Reputation: 3632Reputation: 3632Reputation: 3632Reputation: 3632Reputation: 3632Reputation: 3632
I guess you could do it in switches, some are pretty darn smart.

Suggest you at least look at tc command. Not sure what you mean about sysadmin.
https://www.google.com/search?q=linu...mmand+examples
 
Old 11-01-2016, 03:09 PM   #3
nini09
Senior Member
 
Registered: Apr 2009
Posts: 1,860

Rep: Reputation: 162Reputation: 162
You can use Linux traffic shaper to limit port speed to any number.
 
Old 11-01-2016, 03:16 PM   #4
szboardstretcher
Senior Member
 
Registered: Aug 2006
Location: Detroit, MI
Distribution: GNU/Linux systemd
Posts: 4,278

Rep: Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694
From the relevent stackexchange article @ http://unix.stackexchange.com/questi...ific-interface by TheSqrtMinus1 (cc by-sa 3.0)

ethtool
You can change the aggregate speed of the NIC port using ethtool. This will set the port to 10MB, for example.
Code:
sudo ethtool -s eth0 speed 10
wondershaper
You can also use the tool wondershaper to do it as well. NOTE: Speed should be in kilobits per second.
Code:
sudo wondershaper eth1 downspeed upspeed
sudo wondershaper eth0 10000 280
trickle
A 3rd option is Trickle. Trickle can be used per program by users or as a daemon that throttles the NIC completely.
Code:
sudo trickle -d 20 -u 20 wget http://www.google.com/bigfile
Will throttle 20K/s for both up and down traffic for just this wget, everything else will not be limited.
In daemon mode, trickled can limit a group of programs to a fixed limit of bandwidth. To start the daemon, run the trickled command:
Code:
sudo trickled -d 20 -u 20

Last edited by szboardstretcher; 11-01-2016 at 03:18 PM.
 
Old 11-07-2016, 09:59 AM   #5
forrie
Member
 
Registered: Sep 2003
Distribution: RedHat
Posts: 41

Original Poster
Rep: Reputation: 15
Comcast

We found a tool on Github Comcast that is a wrapper around the "tc" and "iptables" commands, which will suffice.

I've actually not done this before, and the box we have is Ubuntu (I'm more familiar with CentOS). It appears what this needs is a firewall-routing setup, whereby eth0 is the "external" routing interface, even though it will be on an internal network, and eth1 will be an RFC interface that is throttled. Or could I simply use an IPv4 address, I would think that would route out the main eth0 which has a gateway attached to it. Whichever is simplest.

Another approach may be to simply add an iptables NAT/MASQUERADE on the RFC interface, running dhcpd on there, to a switch... then any host connected will/should route out the primary interface?


Thanks.

Last edited by forrie; 11-07-2016 at 11:54 AM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Limiting download speed on a network Firefox54 Linux - Networking 1 05-11-2011 12:47 AM
Upload speed limiting to increase download speed dangerousdave Linux - Networking 6 02-16-2010 03:19 PM
Limit the speed of a network interface. exodist Linux - Networking 8 08-15-2008 10:37 PM
Setting Network Interface Speed ITJedi Linux - Networking 4 05-14-2004 11:02 PM
limiting bandwidth on a specific network interface. Passive Linux - Networking 3 05-01-2002 04:20 AM

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

All times are GMT -5. The time now is 06:59 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