Re: Two gateways on same network
One way to do that is to set the network like this ...
router 192.168.1.6 - no change
router 192.168.1.1 - add secondary ip address like 192.168.2.1 (on
on the mail machine set default gw with metric 5 to 192.168.1.6
and set default gw with metric 10 to 192.168.2.1 gateway (of course
with the proper IP on interface :) ) ....
last thing is to guarante to use 192.168.2.1 if the mail is from this
route .... it coud be done by several ways ...
one way, the simplest one, is to use snat on this router for incoming
connection to your mail server:)... not clean :( ...
or the clean, properly and harder way is to set the mail server to be
more like router(it must route packets thru 2 interfaces :) ..
http://lartc.org/howto/lartc.rpdb.multiple-links.html (same config but
imagine instead of "Linux router" your mail server
There coud be another X ways to do that, for example (my favourite )-
set only the router 192.168.1.6 as gw for all your network, and setup
this router to route the packets thru the provider and thru router
so there are possibilities :)
PS: NO SECONDARY NIC IS NEEDED !!!! (not this time ;) )
Hans du Plooy napsal(a):
I'm setting up a Debian antispam mail relay. I have two gateways on the
network (two separate internet connections):
4mbit ADSL = 192.168.1.6
128k line = 192.168.1.1
Both have NAT firewalls, both forward port 25 to the Debian box. I'm
trying to do the following:
Always use 192.168.1.6 as the default gateway, except when:
1. Connections are received via 192.168.1.1. Because if it doesn't
reply via the same gateway, the connection just times out.
2. 192.168.1.6's connection goes down, for whatever reason.
So basically the leased line would be a backup MX.
I have put two network cards in, both with IPs on the same network, but
with different gateways specified in /etc/network/interfaces. But for
some reason both try to use 192.168.1.1 as the gateway, regardless.
If the second network card is not necessary, that would be OK too.