routing based on content and source


A good while back I asked if anyone knew how to have a machine respond properly over two interfaces. We'll after some actually looking (read: using google for a bit) I found out how. As a note this assumes your using linux, I have no idea how one would accomplish this using fbsd, obsd, or solaris.

Compile in Advanced routing and enable some of the sub options as your feel. If you want to route based on content/iptables rules, I suggest enabling iptables and enabling the route based on mark stuff.

Once the kernel is all set, install iproute2. Use the ip addr command to add another ip (if you don't have one in mind already). Then, edit /etc/iproute2/rt_tables and add a table to the list for your second gateway (i used cable). Once you've done that run ip rule add from <src ip here> table cable. Then run ip route add default via <other gateway here> table cable. Once that is all set your should be able to route to that machine from both gateways. The iptables rule integration is another blog entry. Suffice it to say that if you want your torrents using one pipe and your ftp traffic another, it is indeed possible.

As a side note, I am currently quite annoyed with valve, over what seems to be hlds' inability to listen on multiple ip addresses. I have assigned two addresses on different subnets to a box and can only hit one. The other can be hit if hlds is explicitly told to listen on that ip. Very frustrating when your trying to split the bandwidth over multiple pipes.