Ankur Rohatgi wrote:
Ummm ... dont tease me dammit go on ... elaborate :)
- Ankur.


I am a bit hazy about it too. Been a long time since I had last messed with it. I googled around a bit. Take a look at this whole chapter (http://lartc.org/howto/lartc.rpdb.html).




Basically the steps are:

1. Create a policy routing table

echo 100 smtp.out >> /etc/iproute2/rt_tables


Ok. The rest is messy. This only works with source IPs. So it will send all packets (not only smtp but also fetchmail(pop3)/squid(80)/etc. running on this box).


Not destination ports. If you want it to work with a destination port, you have to mark packets which are going to destination port 25, using iptables. You can then send such packets to the rule table.

2. Send marked packets to this table

ip rule add fwmark 1 table smtp.out

3. Set a default route for this table

ip route add default via yyy.yyy.yyy.yyy dev ethx table smtp.out

Replace yyy.yyy.yyy.yyy with the IP address of the gateway that you want to send out packets from, and ethx is the interface to send it out from.

4. Configure iptables to mark the packets

iptables -t mangle -p tcp -d 0/0 --dport 25 -j MARK --set-mark 1


There you are. This should work. The only problem is keeping this config over reboots. The iptable thing can be saved using "service iptables save".


The rest have to be done over a boot up script I think.

- Sandip

--
Sandip Bhattacharya
sandip (at) puroga.com
Puroga Technologies Pvt. Ltd.
Work: http://www.puroga.com        Home: http://www.sandipb.net

GPG: 51A4 6C57 4BC6 8C82 6A65 AE78 B1A1 2280 A129 0FF3


_______________________________________________ ilugd mailinglist -- [EMAIL PROTECTED] http://frodo.hserus.net/mailman/listinfo/ilugd Archives at: http://news.gmane.org/gmane.user-groups.linux.delhi http://www.mail-archive.com/[EMAIL PROTECTED]/

Reply via email to