Skip to contentSkip to conversation

route mail through different gateway

LARTC Michael 2 participants 2 messages Aug 4, 2006 – Aug 7, 2006

lore
Share & tools
lore

Michael

author
#0 lore raw

Hi All,

I've got server with one LAN card eth0 ip=10.0.0.5

default access t ointernety done through ADSL router gw 10.0.0.1 we got second internet access through another ADSL router gw 10.0.0.2

I want to send all e-mail out through gw 10.0.0.2
How it can be done?
I've tried to mark packets:
iptables -t mangle -A OUTPUT -p tcp --dport 25 -j MARK --set-mark 0x1 and
ip ru add fwmark 0x1 table mail.out
ip ro add default via 10.0.0.2 lookup mail.out

But it is dosen't work
Any help?

Signature · 2 lines
--
Michael

_______________________________________________
LARTC mailing list
[email protected]
http://mailman.ds9a.nl/cgi-bin/mailman/listinfo/lartc

#1 lore raw

Silly mistake I always make is too forget to put in NAT on GW. But what you have done should work. Have you confirmed that this works

on 10.0.0.5
ip route del default
ip route add default via 10.0.0.2
ip route flush cache

If that works maybe try
# Dont know which one of these I think your right it should be output iptables -t mangle -A PREROUTING -p tcp --dport 25 -j MARK --set-mark 0x1
iptables -t mangle -A OUTPUT -p tcp --dport 25 -j MARK --set-mark 0x1 ip rule add from 10.0.0.0/8 fwmark 1 lookup 200
ip route add default via 10.0.0.2 table 200

# The I would try tcpdump -vv -ni eth? and look at the MACs

# or  and check the mark
iptables -I POSTROUTING -p tcp --dport 25 -j LOG
Quoted 15 lines · Michael

Hi All,

I've got server with one LAN card eth0 ip.0.0.5

default access t ointernety done through ADSL router gw 10.0.0.1 we got second internet access through another ADSL router gw 10.0.0.2

I want to send all e-mail out through gw 10.0.0.2
How it can be done?
I've tried to mark packets:
iptables -t mangle -A OUTPUT -p tcp --dport 25 -j MARK --set-mark 0x1 and
ip ru add fwmark 0x1 table mail.out
ip ro add default via 10.0.0.2 lookup mail.out

Quoted 9 lines

But it is dosen't work
Any help?

Signature · 5 lines
--
Michael 
_______________________________________________
LARTC mailing list
[email protected]://mailman.ds9a.nl/cgi-bin/mailman/listinfo/lartc

_______________________________________________
LARTC mailing list
[email protected]
http://mailman.ds9a.nl/cgi-bin/mailman/listinfo/lartc