Click to See Complete Forum and Search --> : how to do failover ip with no lan - distressed newbe


booniedog
08-04-2006, 01:51 AM
Hi,

I've been searching all over and can't find many info on doing an ip failover for stand alone servers whether it be mail/www. I'm not fimiliar with network config in Linux so I might be doing something wrong and need help.

I have 2 nics on 1 server and 2 isp with 2 routers-1 isp for each router. How can I configure it so if eth0 with isp1 fails, it'll auto switch to eth1 with isp2? If it's possible, I would like to also make it so eth0 is for incoming and eth1 for outgoing at the same time still have the failover and if this will not cause complications.

I've found 1 article on doing only auto failover for something like a proxy server with 2 wan and 1 lan. I tried using only the part for the 2 wan section but it's not working. Here's what I did.

I configured eht0 to isp1 static ip with their gw and eth1 to isp2 static ip with their gw.

I enabled IP forwarding by changing the value of net.ipv4.ip_forward to 1 in the /etc/sysctl.conf. I probably didn't need to do this but I'm not sure.

I added "route add default gw xxx.Public.IP.xxx dev eth0" and same for eth1 to the /etc/rc.d/rc.local file.

I modified the /proc/sys/net/ipv4/route/gc_timeout file from 300 to 10.

After I rebooted, everything was working as if only one is avail. I even checked to make sure that eth1 was enabled during bootup and is active and it was. But when I disconnect eth0, eth1 doesn't kick in even after 2 minutes.

The aricle that I got this from said that after these configs, I now have a failover router. I didn't have it configed as a router so I turned on the routing feature and it was worse, I have no internet connection unless I deactivate eth1 so I disabled the routing feature but the damage was done so now I have to disable eth1 in order for eth0 to work.

So now I'm back at square 1 but worse. At least before, I can have both activated and eth0 will still work, just not failover.

I apprciate it if anyone can help me.

dkeav
08-04-2006, 02:28 AM
you probably need to bond/truncate your nics together

dkeav@srv01 ~ $ /sbin/ifconfig -a
bond0 Link encap:Ethernet HWaddr 00:30:48:87:89:06
inet addr:192.168.1.100 Bcast:192.168.1.255 Mask:255.255.255.0


less /etc/conf.d/net

slaves_bond0=("eth0 eth1")
config_bond0=("dhcp")

Modorf
08-04-2006, 03:52 PM
the other issue is that your ISPs need to know about the alternate route to your network. This is done with BGP routing.

eg, you have 2 external IPs, one from each isp. to the isp, your computer is a node off their network, issolated from the rest of the internet, even though we know that isn't the case. with BGP routing protical set on the ISPs routers, it can be told there are two or more routes (ways to your network). So if your primary connection with that provider is down, there are alternate routes.

To set this up, the ISPs have their own policies with proving that you own/assigned the alternate IP destination.

As for using one link as in and the other as out.
In bound is determined by shortest path from point - point.
Out bound is determined by default route with lowest metric.
you can set one path to a higher metric to make it "longer path" / "more costly" to use.

Bonding a pair of nics sets 2 or more network ports as 1 virtual network port. This is done for redunancy. I don't think it actually allows for higher data rates.

booniedog
08-06-2006, 09:43 PM
Wow, what's BGP? I'm still learning. What I did do though is I have already had my host provider (which is also my 1st ISP) set the 2nd MX to the 2nd ISP. I haven't tried bonding yet. I'll have to test this on another system 1st.

If it's too complicated to do one in and the other out, I'm not going to do that now. I at least want to do the failover first. Would I still need to bond the 2 nics? If not, what am I doing wrong? And is there something else I need to do?

I read that kernel 2.2 and above would need to be compiled with some arguments to accept this kind of advance setup. I'm using 2.6. I assume and am hoping that 2.6 already has it built into the kernel by now without needing for it to be compiled for this.

I also need to correct my description of the setup I'm trying to do. I set the public IPs on the routers and private IPs on the servers.

dkeav
08-06-2006, 10:31 PM
http://openbgp.org/