LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 11-01-2013, 12:35 PM   #1
Black187
LQ Newbie
 
Registered: Nov 2005
Posts: 26

Rep: Reputation: 0
Multiple public IP - redundancy


Hello,

I have two exits to the internet:

Via eth1 - static ip
Via ppp0 - dhcp

On eth0 I have my LAN network, how can I setup networking, that my primary exit from the eth0 to the internet is via eth1, and my backup exit is via ppp0?

I've tried with iptables and postrouting (NAT) for my eth0, but I cannot get the backup exit via ppp0 to work if eth1 is unreachable:

Code:
iptables -t nat -A POSTROUTING -s 192.168.66.0/24 -o eth1 -j MASQUERADE
Where 192.168.66.0/24 is my eth0 network...

Last edited by Black187; 11-01-2013 at 12:39 PM.
 
Old 11-01-2013, 01:28 PM   #2
Ser Olmy
Senior Member
 
Registered: Jan 2012
Distribution: Slackware
Posts: 3,340

Rep: Reputation: Disabled
Short answer: You will need specialized software (like mpath-tools) to implement failover from one ISP connection to another.

Long answer: This can't be done easily, for a number of reasons:

Reason #1: This is a routing issue, and you're not running a routing protocol

In order to switch to an alternate gateway, you'll have to alter the local routing table. If your system was receiving routing information from two different upstream routers via BGP, the switch would happen automatically whenever one link went down (or the upstream router sent a poison update).

The vast majority of Internet connections for businesses (and all residential connections) use static routing. In other words, it's up to your system to figure out when a link is down, and alter the routing table accordingly. The connection itself and the upstream routers provide no hints as to the status of the connection.

(And no, having two gateways with the same metric is not the answer, as that will just cause the IP stack to do round-robin load balancing across both links.)

Reason #2: Detecting line status is hard (what does "eth1 becomes unreachable" mean?)

It's easy to detect when an Ethernet link goes down, but unfortunately that rarely happens when an Internet connection fails. Often the problem is at the ISP end, and the only symptom is that reply packets aren't coming in from Internet hosts. Even when a DSL router or modem fails, the Ethernet side of the unit is often operational.

Without BGP, you'll have to resort to some sort of manual link detection, for instance by pinging or otherwise testing connectivity against one or more remote hosts. Telling the difference between an ISP routing issue and a host going down for other reasons would be a challenge.

Reason #3: NAT messes up everything

No matter what you do, as long as outbound traffic has to be NAT overloaded behind the public address of each interface, a line failure will break all active sessions.

If a remote host is sending data to the IP address at eth1, without BGP there's no way that traffic can be redirected to whatever address is assigned to ppp0 in the event of a line failure. The best you could do would be to use the MASQUERADE target instead of the SNAT target, and take the interface down (and then back up) whenever a line failure is detected. That would purge the conntrack table, and outgoing traffic using the other interface would be NATed behind the correct address.

Last edited by Ser Olmy; 11-01-2013 at 01:30 PM.
 
Old 11-03-2013, 11:24 AM   #3
baldy3105
Member
 
Registered: Jan 2003
Location: Cambridgeshire, UK
Distribution: Mint (Desktop), Debian (Server)
Posts: 891

Rep: Reputation: 184Reputation: 184
On a router I would use a script to ping a number of core IP addresses inside my ISP. If this fails the primary port state would be set down so that the backup path would be used.

I assume that you could set up a shell script and cron it to do the same thing. The backup path would obviously need a default routes with a higher metric pointing at it.

As pointed out this is not a stateful failover. Open connections would die.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
how to transfer multiple file to multiple server using public and private key sampadray81 Linux - Newbie 5 02-27-2012 12:31 PM
[SOLVED] Multiple public IP (5) to multiple servers newbeliever Linux - Networking 1 10-13-2011 11:48 AM
Multiple IP Public like google.com cparapat Linux - Networking 3 10-01-2010 02:59 AM
multiple public ip one server frieza Linux - Networking 3 03-05-2010 03:45 PM
Multiple 'public' ip addresses mcleodnine Linux - Networking 3 05-09-2003 02:04 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 04:09 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration