Re: [SLE] connection redundancy

From: James Wright (jwright_at_blackriverproduce.com)
Date: 04/26/05

  • Next message: Alfredo Cole: "Re: [SLE] SuSE 9.2 goes blank after starting Yast"
    Date: Tue, 26 Apr 2005 11:48:24 -0400
    To: suse-linux-e@suse.com
    
    

    >>Problem is, when the 64k line goes down, the mail server still tries to
    >>reply via the usual gateway, which is the router just this side of the
    >>line. In other words it doesn't know that the line has gone down,
    >>because it's own gateway is still up.
    >>
    >>Is it possible to set a timeout to all traffic to the default gateway,
    >>and have it try a backup gateway?

    This may help you. It is a simple setup, that I copied from a web
    article at http://enterprise.linux.com/article.pl?sid=05/04/10/2132252

    It is a basic setup that may need some tweaking. Good luck!

    - James W.

    By: Rohit Girhotra

    Today, it's hard to imagine an organization operating without taking
    advantage of the vast resources and opportunities that the Internet
    provides. The Internet's role has become so significant that no
    organization can afford to have its Net connection going down for too
    long. Consequently, most organizations have some form of a secondary or
    backup connection ready (such as a leased line) in case their primary
    Net connection fails. However, the process of switching over from the
    primary to the backup connection, if done manually by the system
    administrator, can take some time, depending upon how ready the backup
    setup is and on the availability of the administrator at the right
    moment. The process can even become a costly affair if the organization
    must buy dedicated routers for the purpose of automatic switchover. But
    there is an easy and cost-effective alternative -- setting up a Linux
    failover router.

    In this article we will look at setting up an existing Linux machine as
    a failover router to provide quick and automatic switchover from a dead
    Internet connection (the primary connection) to one that is operational
    (the secondary connection).

    To begin, you'll need a PC with any recent GNU/Linux distro installed.
    You'll also need three network cards to put into this Linux box. Two of
    the three network cards, say eth0 and eth1, will connect to the Internet
    routers/gateways of your primary ISP (say ISP1) and secondary ISP (say
    ISP2). The third network card, say eth2, will connect to your internal LAN.

    Setting up the network

    Begin by setting up your network based on the configuration information
    available to you. You can make the configurations from the X Window GUI
    using the Network utility. To do so, open the Network utility from Main
    Menu > System Settings > Network. This will open up a network
    configuration window displaying a list of all the network cards
    installed on your system. Double-click on the network card you wish to
    configure, select the Statically Set IP Addresses option, and assign the
    IP address along with the subnet mask. There is also a Default Gateway
    Address field; tou can leave it blank for the time being, as it can be
    specified later on from the command line.

    Assign the IP addresses provided to you by your ISPs to the two network
    cards, eth0 and eth1. In our setup, we assigned eth0=61.16.130.100 and
    eth1=200.15.110.101 (which are public IP addresses), along with the
    subnet mask 255.255.255.224.

    Assign a private IP address based on your internal LAN subnet to your
    third card. We assigned eth2=10.0.0.1, where 10.0.0.0/24 was the address
    range for our internal LAN setup. Save your changes and exit.

    Now turn on IP packet forwarding on the Linux box by changing the value
    of net.ipv4.ip_forward to 1 in the /etc/sysctl.conf file and executing
    the command:

    # sysctl -p

    Next, you need to configure iptables by adding certain rules, so that
    your internal LAN can route packets to the Internet. For this, issue the
    following commands as root:

    # iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE

    # iptables -t nat -A POSTROUTING -o eth1 -j MASQUERADE

    # iptables -A FORWARD -s 10.0.0.0/24 -j ACCEPT

    # iptables -A FORWARD -d 10.0.0.0/24 -j ACCEPT

    # iptables -A FORWARD -s ! 10.0.0.0/24 -j DROP

    The above commands turn on masquerading in the NAT table by appending a
    POSTROUTING rule (-A POSTROUTING) for all outgoing packets on the two
    Ethernet interfaces, eth0 and eth1. The next two lines accept forwarding
    of all packets to and from the 10.0.0.0/24 network. The last line drops
    the packets that do not come from the 10.0.0.0/24 network.

    To make the iptables rules permanent, save them as follows:

    # iptables-save > /etc/sysconfig/iptables

    Now you must restart your network, as well as iptables:

    # /etc/init.d/network restart

    # /etc/init.d/iptables restart

    To see if your new iptables rules have gone into effect, type iptables --L.

    Enabling failover routing

    After you have configured your network, the next step is to enable
    failover routing on your Linux box, so that if the first route dies the
    router will automatically switch over to the next route. To do so,
    you'll need to add the default gateway routes provided to you by your
    ISPs for both your network cards:

    # route add default gw 61.16.130.97 dev eth0

    # route add default gw 200.15.110.90 dev eth1

    Here, 61.16.130.97 is the gateway address given by ISP1 and
    200.15.110.90 is the gateway address given by ISP2. Replace them with
    the addresses available to you. These routes will disappear every time
    you reboot the system. In order to make these routes permanent add the
    above two commands in the /etc/rc.d/rc.local file, which is run at boot
    time.

    Also make sure that all the computers on your internal LAN (10.0.0.0/24)
    have their default gateway address set as the IP address of the eth3
    Ethernet interface (i.e. 10.0.0.1) of your failover router.

    Finally, modify the /proc/sys/net/ipv4/route/gc_timeout file. This file
    contains a numerical value that denotes the time in seconds after which
    the kernel declares a route to be inactive and automatically switches to
    the other route if available. Open the file in any text editor and
    change its default value of 300 to some smaller value, say 10 or 15.
    Save the changes and exit.

    Now your Linux machine is ready to serve as a failover router,
    automatically and quickly switching to the secondary route every time
    the primary route fails.

    -- 
    Check the headers for your unsubscription address
    For additional commands send e-mail to suse-linux-e-help@suse.com
    Also check the archives at http://lists.suse.com
    Please read the FAQs: suse-linux-e-faq@suse.com
    

  • Next message: Alfredo Cole: "Re: [SLE] SuSE 9.2 goes blank after starting Yast"

    Relevant Pages

    • Re: AIX 1.3 Failures and Fables
      ... DESTINATION GATEWAY FLGS REFCNT USE INTERFACE ... Is my interpretation of the AIX 1.3 #man route correct? ... Manually manipulates the routing tables. ... Is the destination host or network. ...
      (comp.sys.ibm.ps2.hardware)
    • Re: Cant access secure Web pages
      ... and which need to be contacted via the Default Gateway. ... The Default Gateway being the software process that does the network ... Gateway (as set up by your ISP's DHCP packet to the router), ... me so I can send it directly (to the MAC address discovered by ARP). ...
      (uk.comp.sys.mac)
    • Re: AIX 1.3 Failures and Fables
      ... I don't know if 1.3 has SMIT or its equivalent but there should be some way to add a default gateway which is your router. ... Is my interpretation of the AIX 1.3 #man route correct? ... Manually manipulates the routing tables. ... Is the destination host or network. ...
      (comp.sys.ibm.ps2.hardware)
    • Re: Routing for Verizon FIOS -- Reward for answer
      ... The problem we have is this:  Verizon's gateway is 70.x.x.1. ... address for our router ...  What do we use as an address for the outside interface ... route outbound through the gateway. ...
      (comp.dcom.sys.cisco)
    • Re: Setup of Router machine with FreeBSD
      ... Given the dual-homed nature of the machine it's routing table will already contain each of the interfaces on the two networks, and as such the router machine will 'know' how to connect to each of the networks it is on. ... it will elaborate as to how you can turn on and off the function to act as a gateway for other hosts. ... Running the command 'ifconfig -a' will list your active network interfaces and should show the 'media state' as being connected and at what speed/duplex - check there first and work your way back. ... It seems to me your problem is in your route configuration. ...
      (freebsd-questions)