Re: Changing the NAT IP on demand?

From: Fred Souza (fred_at_storming.org)
Date: 10/05/03

  • Next message: Don Bowman: "RE: Hyperthreading slowdown"
    Date: Sun, 5 Oct 2003 11:54:31 -0300
    To: Paul Robinson <paul@iconoplex.co.uk>
    
    
    

    > Depends on how much money you have, but had you considered getting your
    > own address range and BGP peering with your ISPs? I'd consider talking
    > to them about it. It'll take some time to setup, but it means your
    > "switching" is done at the router, not at the NAT box, which is the
    > wrong place to do it anyway.

      I think I have an inelegant solution to this, but one that could be
      implemented with even a simple script.

      If I understood what Leo asked correctly, what's needed is to change
      the default route on the FreeBSD gateway whenever an event tells it
      to (in this case, the increase/decrease in performance for the ISPs).
      The concern here is to keep currently-stablished connections alive, so
      the process is carried out seamlessly.

      Unless my tests were wrong, there's a way around it with the very base
      system tools. The idea is simple: Say the box has two valid IP
      addresses A.A.A.A and B.B.B.B, and that at a given moment A.A.A.A is
      being used as the default route. Whenever the event telling the system
      to switch the routes to B.B.B.B happens, you could parse the current
      routing table and the current list of open connections, and add a
      temporary, static route for each of these entries pointing A.A.A.A
      (the current default gateway) as their gateway (route add X.X.X.X
      A.A.A.A (or A.A.A.A's remote peer) - where X.X.X.X is the address of
      one of the open connections). Once you do that for all the current
      active connections, they'll be guaranteed to stay up when the next
      step takes place.

      Now you'd remove the default gateway entry in your routing table and
      add B.B.B.B (or its remote peer) as the default gateway. From this
      point on, all connections will use this route as the default, and
      noone should see the change.

      The downpoint of this approach is that the system will have to monitor
      the active connections periodically and remove the static routes after
      their previously active connections finish; This is because if you
      don't do so, all connections to a given address will be routed out
      through the default route at the time the first switch was made and
      there was a connection to that address. Another concern would be the
      decrease in perfomance on the FreeBSD gateway if its routing table
      gets too large (over tens of thousands of static routes).

      What makes this to work is that static routes have priority over
      default ones. One could work this up from this point.
      
      
      Fred

    -- 
    "Real programmers argue with the systems analyst as a matter of principle."
    
    


    • application/pgp-signature attachment: stored

  • Next message: Don Bowman: "RE: Hyperthreading slowdown"

    Relevant Pages

    • Re: W2003 VPN Setup
      ... I've set the second adapter to 10.0.0.12 without a gateway and it's ... Do I route the second interface to the first? ... VPN connections. ... I ran the RAS setup for VPN and the second adapter is telling me there ...
      (microsoft.public.windows.server.networking)
    • Re: Multiple internet connections routing.
      ... >> connections end up on the same gateway machine) whenever first ... >> register their addresses as your primary and secondary DNS ... A connection surveillance mechanism, triggering a route switching ... And the route switching script itself. ...
      (comp.os.linux.networking)
    • Packet routing by source IP
      ... I have two internet connections and a lan on which I run a server. ... ISP connection 1 goes into a linux router and the connection 2 goes ... iptables has a ROUTE target and can route the packets by source IP. ...
      (comp.os.linux.networking)
    • Re: Network Setup Advice
      ... This lets inbound connections work for mail, ... lest you have the neighborhood skript-kiddy surfing pr0n and sending ... and that is going to have to be the route ... are going to have considerable confusion over which interface to use. ...
      (comp.os.linux.networking)
    • Re: adsl + cable multiple connection problem
      ... >> But when the ADSL connection fails, ... the whole multipath route. ... probably alive gateways). ... The benefit is only the proper routing for NAT connections over ...
      (comp.os.linux.networking)