|
|
|
¸®´ª½ºÆÁ Go Unix Power Tools Online Book
Go Bash Guide
|
|
Read No. 160 article |
2002-05-23 04:51:04 |
|
|
|
|
|
|
Traffic Shaper For Linux
This is the current ALPHA release of the traffic shaper for Linux. It works
within the following limits:
o Minimum shaping speed is currently about 9600 baud (it can only
shape down to 1 byte per clock tick)
o Maximum is about 256K, it will go above this but get a bit blocky.
o If you ifconfig the master device that a shaper is attached to down
then your machine will follow.
o The shaper must be a module.
Setup:
A shaper device is configured using the shapeconfig program.
Typically you will do something like this
shapecfg attach shaper0 eth1
shapecfg speed shaper0 64000
--
shapecfg attach shaper0 eth0
shapecfg speed shaper0 5120000 ( 5Mbit/sec )
--
ifconfig shaper0 myhost netmask 255.255.255.240 broadcast 1.2.3.4.255 up
route add -net some.network netmask a.b.c.d dev shaper0
ifconfig shaper0 host netmask mask broadcast bcast up
route add -net net netmask mask dev shaper0
--
ifconfig shaper0 casper netmask 255.255.255.0 broadcast 210.118.169.255 up
route add -net 210.118.169.0 netmask 255.255.255.0 dev shaper0
ip 210.118.169.13
netmask 255.255.255.0
gateway 210.118.169.1
network 210.118.169.0
broadcast 210.118.169.255
--
route delete default eth0
route add default gw gateway shaper0
--
route add default gw 210.118.169.1 shaper0
route delete default eth0 (¸®¸ðµå ÀÛ¾÷½Ã ³×Æ®¿÷ÀÌ Á×À»¼ö ÀÖÀ¸¹Ç·Î ÁÖÀÇ)
--
The shaper should have the same IP address as the device it is attached to
for normal use.
Gotchas:
The shaper shapes transmitted traffic. It's rather impossible to
shape received traffic except at the end (or a router) transmitting it.
Gated/routed/rwhod/mrouted all see the shaper as an additional device
and will treat it as such unless patched. Note that for mrouted you can run
mrouted tunnels via a traffic shaper to control bandwidth usage.
The shaper is device/route based. This makes it very easy to use
with any setup BUT less flexible. You may well want to combine this patch
with Mike McLagan 's patch to allow routes to be
specified by source/destination pairs.
There is no "borrowing" or "sharing" scheme. This is a simple
traffic limiter. I'd like to implement Van Jacobson and Sally Floyd's CBQ
architecture into Linux one day (maybe in 2.1 sometime) and do this with
style.
|
|
Page Loading [ 0.03 Sec ]
SQL Time [ 0 Sec ]
|
|
|