Shaping in Linux (vlan + nat + in / out)?
Asked by anggraini
I know that a great many articles have been written about this, but unfortunately so far all of them have not clarified. = (
There is a linux router (in a small home provider, distro - gentoo), distributing the Internet to 150+ users.
It is necessary to provide a speed limit for both in and out for users according to their tariffs.
Each house has its own vlan, then all these vlans come to the router. At the exit, one eth interface to the Internet. All users sit at nat.
The scheme is as follows:
{vlan1, vlan2, ..., vlann} eth0 = & gt; (pc-router) [nat] = & gt; eth1
It is necessary accordingly to limit the speed of both incoming and outgoing for each of the users according to its TP.
Do not offer: Separation for different cars, tsiska.
Need to do it on one wheelbarrow. At least, the fryakh with this task in another segment copes with a bang (I will go to it if I still don’t master the shaper in Linux, but still I don’t feel like giving up)
In theory, you need to make a virtual ifb interface, but I can not figure out how to make friends with it in + out + nat + vlan.
Answers
In general, I want to find a simpler way. - flissc
But personally, I have experience of using ipfw quite large and having felt and built iptables, I understood that iptables is a hundred times more transparent and simple in configuration. - ollie latham
$ TC filter add dev $ VLAN parent ffff: protocol ip prio 1 u32 match u32 0 0 flowid 1: 1 action ipt -j MARK --set-mark $ VID action mirred egress redirect dev $ IFB
In short, put fryahu there, if you understand it, it will be easier for you and more reliable for users.
Shape will respectively outcome from the interface. NAT is absolutely not a hindrance since traffic coloring occurs before it.