[CentOS] port based routing

Mon Mar 9 20:32:07 UTC 2009
Marcus Moeller <mmoeller at econet.ch>

Good Evening,

I am trying to set up port based routing on a CentOS 5.2 box as described

http://www.linuxhorizon.ro/iproute2.html (second example)

Therefor I have set up the following mangle and routing rules:

$IPTABLES -A OUTPUT -t mangle -p tcp --dport 1100 -j MARK --set-mark 1
$IPTABLES -A OUTPUT -t mangle -p tcp --dport 1101 -j MARK --set-mark 2
$IPTABLES -A OUTPUT -t mangle -p tcp --dport 1102 -j MARK --set-mark 3

$IP route add default dev ppp100 table SOESTCOM1
$IP route add default dev ppp101 table VERSATEL1
$IP route add default dev ppp102 table TONLINE1

$IP rule add from all fwmark 1 table SOESTCOM1
$IP rule add from all fwmark 2 table VERSATEL1
$IP rule add from all fwmark 3 table TONLINE1

iptables -t mangle -L -vn output:


shows that the packages are marked correctly.

Here is an example ip route show table output:

default dev ppp102  scope link

But it seems (and tcpdump indicates) that packages are still routed via
default route, instead.

Do I need to set some proc flags to activate port based routing?

Best Regards
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.centos.org/pipermail/centos/attachments/20090309/f3d9a552/attachment-0002.html>