IP Routing based on fwmark
Hi there, I have just set up my 2.4 kernel here on our router and I am trying to allocate different services to our two internet connections. I want all of our smtp traffic to go via our normal leased line and all other traffic to go via our faster, but less reliable ADSL line. I have set the default route to go via the ADSL line and added a ip routing table for the mail: popper:~ # ip route list 213.210.21.240/29 dev eth2 proto kernel scope link src 213.210.21.242 213.38.116.168/29 dev eth1 proto kernel scope link src 213.38.116.170 10.0.0.0/16 dev eth0 proto kernel scope link src 10.0.0.2 127.0.0.0/8 dev lo scope link default via 213.210.21.241 dev eth2 popper:~ # ip route list table mail.out default via 213.38.116.170 dev eth1 Then I have set up ip rules: popper:~ # ip rule list 0: from all lookup local ... 32761: from all fwmark 3 lookup mail.out ... 32766: from all lookup main 32767: from all lookup default Then I have added a mangling rule: popper:~ # iptables -A PREROUTING -t mangle -p tcp --dport 25 -j MARK --set-mark 3 All the traffic from the internal network happily obeys the rules and goes via the leased line, but any traffic originating from the router itself on port 25 just goes via the ADSL line and seems not to get marked. Is there a way to implement policy based routing for the router as well? Mark ---------------------------------------------------------------- Dr Mark O. Stitson, Senior Systems Administrator Yospace Ltd, 7 The Courtyard, High Street, Staines, UK, TW18 4DP Tel: +44 1784 466388 Fax: +44 1784 466387 WWW: http://www.yospace.com
participants (1)
-
Mark O. Stitson