Re: Traffic shaping on multiple interfaces

Linux Advanced Routing and Traffic Control

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Terry Baume wrote:
I'm trying to setup traffic shaping on my linux gateway/router.

The system has 3 interfaces:
eth0 - My LAN - with IP address 192.168.0.254
eth1 - The ethernet connection to which my ADSL modem is connected. This has a 10.25.x.x IP, more on this later. The ADSL link has an upstream of ~1.2mbit.
ppp0 - The PPP connection which is my WAN connection, with a real world IP.

The system acts a router, performing NAT for my LAN. This works perfectly, as does traffic shaping on ppp0 - I get very good results.

The trouble is that my ISP allows me to user another service over my ADSL line, as a bonus. Basically the modem has 2 virtual circuits, one being for my WAN connection, and the other being a private network between other users of the same ISP, on the same telephone exchange - this is where the 10.25.x.x IP on eth1 comes from. To make things clear, low latency on the eth1 interface is not important, this interface is only used for file sharing and such. Latency on ppp0 is obviously important, being my WAN connection.

My IPTables rules provide NAT for both connections, the only thing I cannot get working correctly is traffic shaping.

So far, I have experimented with wondershaper, shaping on the ppp0 interface. This works well to keep latency down when traffic is on the ppp0 interface.

Wondershaper is slightly flawed, depending on how it's setup. You need to make sure the rateds of children don't add up to more that the parent class.

Unless you patch for atm overheads (which is going to be tricky for your case) make sure you back off say 20% from the line rate - but then this bit works for you anyway - I just say because it can appear to be OK testing with bulk traffic, but then fail when you have a lot of small packets going out.


If there is traffic on eth1 (the 'private' network of
10.25.x.x), with no traffic on the ppp0 interface, latency on ppp0 remains low, regardless of whether traffic shaping is active. I believe this has something to do with the way my ISP has configured priorities at the telephone exchange. I begin to run in to trouble when I am uploading heavily on eth1 & ppp0 simultaneously. Once this happens, ping times over ppp0 rise dramatically, to well over 1200ms (normal is around 7ms). I have tried shaping on eth1 instead of ppp0 (as eth1 should contain all the packets for ppp0, I believe), but this does not yield lower latency, though I did note that it did limit the speed of the connection if I set the upstream and downstream values absurdly low.

You could in theory do it all on eth - but you would have to use the right tc filter ethertypes to get the pppoe and ip.

I think what I need to do is somehow setup a script where traffic directed to 10.25.0.0 on eth1 is somehow counted against the bandwidth specified for ppp0, but I'm really not sure. Could someone offer some advice?

I would use ifb it's been in kernel for a while so you don't need to patch as you would with imq.

You can redirect all ip traffic going out on ppp0/eth1 to ifb0 and add your htb rules to that.

Something like -

tc qdisc add dev eth1 handle 1:0 root prio
tc qdisc add dev ppp0 handle 1:0 root prio
modprobe ifb
ip link set up dev ifb0

tc filter add dev ppp0 parent 1:0 protocol ip prio 1 u32 match u32 0 0 flowid 1:1 action mirred egress redirect dev ifb0

tc filter add dev eth1 parent 1:0 protocol ip prio 1 u32 match u32 0 0 flowid 1:1 action mirred egress redirect dev ifb0

then add your htb rules on dev ifb0

Andy.
_______________________________________________
LARTC mailing list
LARTC@xxxxxxxxxxxxxxx
http://mailman.ds9a.nl/cgi-bin/mailman/listinfo/lartc

[Index of Archives]     [LARTC Home Page]     [Netfilter]     [Netfilter Development]     [Network Development]     [Bugtraq]     [GCC Help]     [Yosemite News]     [Linux Kernel]     [Fedora Users]
  Powered by Linux