Hi all
I've built a Linux router/gateway for a network pictured below. The router has two providers.
Code:
________
+------------+ /
| | |
+-------------+ Provider 1 +-------
__ | | | /
___/ \_ +------+-------+ +------------+ |
_/ \__ | if1 | /
/ \ | | |
| Local network - if0+ Linux router | | Internet
\_ __/ | | |
\__ __/ | if2 | \
\___/ +------+-------+ +------------+ |
| | | \
+-------------+ Provider 2 +-------
| | |
+------------+ \________
Local network: 192.168.0.0/24
if0: 192.168.0.254
if1: 192.168.10.1
Provider 1 router: 192.168.10.254
if2: 192.168.20.1
Router 2 router: 192.168.20.254
Provider 2 is the "main" link for web access etc and Provider 1 is going to be dedicated for mail. At the moment though I haven't set any of this up, everything is simply being routed out through Provider 2.
What I want to achieve is if Provider 2 goes down, all local traffic gets routed and NAT'd out through Provider 1.
I also want to provide fallback for mail. So mail will come down and go out Provider 1, however if Provider 1 goes down, mail will need to come down Provider 2 and out Provider 2. The former is easily achieved through a secondary MX.
So having little experience with iptables and routing on Linux, I was wondering if someone can provide advice on what routes I'll need and the tools I need to use. Can it just be done with 'route' command or will I need 'ip' etc?
Thanks in advance.