Talk About Network

Google





Software > Linux Debian Maint Firewall > Policy routing ...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 7 Topic 1608 of 1645
Post > Topic >>

Policy routing on local packets

by Jason Voorhees <jvoorhees1@[EMAIL PROTECTED] > Sep 23, 2008 at 07:40 PM

Hi friends:

I have a linux box with multiple ip addresses:

eth0 -> IP1
eth0:0 -> IP2
eth0:1 -> IP3
eth0:2 -> IP4

All outgoing traffic is using IP1 as source address. But now I want to 
use a different IP address (IP1, IP2, IP3 or IP4) as the source address 
for all smtp outgoing packets locally generated in my linux box.

I decided to mark such packets like this:

iptables -t mangle -A PREROUTING -p tcp --d****t 25 -j MARK --set-mark 0x19

Then I created a new table in /etc/iproute2/rt_tables adding this:

252	mytable

Now the rules and routes:

ip rule add priority 32765 fwmark 0x19 table mytable
ip route add to default dev eth0 via IP_GATEWAY src IP2 table mytable
ip route flush cached

When I do telnet to some smtp host I can see my linux box is still using 
IP1 instead of IP2. Then I check iptables statistics "iptables -t mangle 
  -L -nv" and the number of packets matched (marked) is increasing so... 
I think something is not working in my iproute rules.

Does anybody know what am I doing wrong? Thanks


-- 
To UNSUBSCRIBE, email to debian-firewall-REQUEST@[EMAIL PROTECTED]
 a subject of "unsubscribe". Trouble? Contact
listmaster@[EMAIL PROTECTED]

 




 7 Posts in Topic:
Policy routing on local packets
Jason Voorhees <jvoorh  2008-09-23 19:40:11 
Re: Policy routing on local packets
Jason Voorhees <jvoorh  2008-09-23 20:50:10 
Re: Policy routing on local packets
Pascal Hambourg <pasca  2008-09-24 12:00:27 
Re: Policy routing on local packets
Andreas Onderka <andre  2008-09-24 14:20:26 
Re: Policy routing on local packets
Gerardo Castillo Alvarado  2008-09-24 17:40:08 
Re: Policy routing on local packets
Pascal Hambourg <pasca  2008-09-24 18:10:10 
Re: Policy routing on local packets
Jason Voorhees <jvoorh  2008-09-24 19:20:09 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
localhost-V2008-12-19 Fri Jan 9 16:04:11 PST 2009.