Loading ...
Sorry, an error occurred while loading the content.

Add a "backup" gateway

Expand Messages
  • Rodolfo José Castellanos J.
    Hi friends, nice to write you again. I have a computer with Squid Proxy Cache service running in it, that has the following configuration: [root@lanServer /]#
    Message 1 of 4 , Nov 7, 2005
    • 0 Attachment
      Hi friends, nice to write you again.

      I have a computer with Squid Proxy Cache service
      running in it, that has the following configuration:

      [root@lanServer /]# cat /etc/sysconfig/network
      NETWORKING=yes
      HOSTNAME=lanServer
      GATEWAY=192.168.0.1

      [root@lanServer /]# cat
      /etc/sysconfig/network-scripts/ifcfg-eth0
      DEVICE=eth0
      BOOTPROTO=static
      IPADDR=192.168.0.21
      NETMASK=255.255.255.0
      ONBOOT=yes
      TYPE=Ethernet

      [root@lanServer /]# route -n
      Kernel IP routing table
      Destination Gateway Genmask Flags
      Metric Ref Use Iface
      192.168.0.0 0.0.0.0 255.255.255.0 U
      0 0 0 eth0
      169.254.0.0 0.0.0.0 255.255.0.0 U
      0 0 0 eth0
      0.0.0.0 192.168.0.1 0.0.0.0 UG
      0 0 0 eth0


      How you can see, the default gateway is 192.168.0.1,
      which is a router that provides us Internet
      connection. All is fine. Now, we have another router
      which also offers Internet connection via another ISP.
      This second router has IP address 192.168.0.4. Well I
      have this idea: suppose that our first ISP connection
      fails (situation that sometimes occurs), then to solve
      this in a transparent way to our squid clients, the
      second gateway (192.168.0.4) replaces it.

      Thanks in advance by your time and answers.

      Bye,
      Rodolfo José Castellanos Jaimes.



      __________________________________________________
      Correo Yahoo!
      Espacio para todos tus mensajes, antivirus y antispam ¡gratis!
      Regístrate ya - http://correo.espanol.yahoo.com/
    • Shawn Tan
      ... hi.. i d advise you to look at http://lartc.org/ for advanced routing control.. it shows you how to control routing.. then, all you need to do is to write
      Message 2 of 4 , Nov 7, 2005
      • 0 Attachment
        On 11/7/05, Rodolfo José Castellanos J. <rodolfojcj@...> wrote:
        > How you can see, the default gateway is 192.168.0.1,
        > which is a router that provides us Internet
        > connection. All is fine. Now, we have another router
        > which also offers Internet connection via another ISP.
        > This second router has IP address 192.168.0.4. Well I
        > have this idea: suppose that our first ISP connection
        > fails (situation that sometimes occurs), then to solve
        > this in a transparent way to our squid clients, the
        > second gateway (192.168.0.4) replaces it.

        hi.. i'd advise you to look at http://lartc.org/ for advanced routing
        control.. it shows you how to control routing.. then, all you need to
        do is to write a utility that monitors gateway #1 for failure, and
        rewrite the routing rules to push all traffic through gateway #4..
        This may affect existing connections though.. You can monitor failure
        through the network or through a secondary channel (like a serial
        port)..

        cheers..

        with metta,
        Shawn Tan.
      • Rivera, Angel R
        That s your gateway. ... eth0
        Message 3 of 4 , Nov 7, 2005
        • 0 Attachment
          That's your gateway.

          > 0.0.0.0 192.168.0.1 0.0.0.0 UG 0 0 0
          eth0
        • ed
          On Mon, 7 Nov 2005 09:43:33 -0600 (CST) ... I=$( ping -c1 isp1firsthop ); if [ $I != 0 ] ; then route delete default gw route add default isp2gw fi; ...
          Message 4 of 4 , Nov 7, 2005
          • 0 Attachment
            On Mon, 7 Nov 2005 09:43:33 -0600 (CST)
            "Rodolfo José Castellanos J." <rodolfojcj@...> wrote:

            > Well I have this idea: suppose that our first ISP connection
            > fails (situation that sometimes occurs), then to solve this in a
            > transparent way to our squid clients, the second gateway
            > (192.168.0.4) replaces it.

            I=$( ping -c1 isp1firsthop );

            if [ "$I" != "0" ] ;
            then
            route delete default gw
            route add default isp2gw
            fi;

            ...

            There's something on bsd called ifstated or something, that allows you
            to do this type of task with a little more elegance.

            --
            Regards, Ed http://www.usenix.org.uk - http://irc.is-cool.net
            A TCP/IP stack was the worst feature windows ever got
            ~
            ~
            :wq
          Your message has been successfully submitted and would be delivered to recipients shortly.