On Sat, Jan 18, 2003 at 02:01:20PM -0800, Todd A. Jacobs wrote:
> On Sat, 18 Jan 2003, Kent Borg wrote:
> 
> > I am wondering what it takes to have a Red Hat (7.0) machine on two
> > different internet connections at once.
> 
> The main problem is that, unless you're advertising via BGP, you can't 
> load-balance inbound on WAN links. While you can potentially (I say 
> *potentially*) send traffic outbound that way, unless the IP layer is 
> bonding the traffic or the application layer is specifying a single 
> source address, you may get unpredictable results.

I am getting further and further by the day.

First, I know I am not going to be issued an autonmous system number
for my little server that is temporarily on two different DSL
connections.  

Now for my progress report.  The Advanced Routing HOWTO (Check out
<http://www.ibiblio.org>.)  turns out to have been key.  I have now
moved from the world of "ifconfig" to the world of "ip".  Here is the
script I put together:

  #!/bin/sh
  #
  # I found this (edited) info at
  # <http://lartc.org/howto/lartc.rpdb.multiple-links.html>.
  #
  # Let us first set some symbolical names. 
  #
  # $IF1 the first interface: eth0
  # $IF2 the second interface: eth1
  #
  # $IP1 the IP address associated with $IF1: 192.168.100.2
  # $IP2 the IP address associated with $IF2: 192.168.1.2
  #
  # $P1 the IP address of the gateway at Provider 1: 192.168.100.1
  # $P2 the IP address of the gateway at provider 2: 192.168.1.1
  #
  # $P1_NET the IP network $P1 is in: 192.168.100.0
  # $P2_NET the IP network $P2 is in: 192.168.1.0
  
  
  # One creates two additional routing tables, say T1 and T2. These are
  # added in /etc/iproute2/rt_tables. Then you set up routing in these 
  # tables as follows:
  #
  
  # ip route add $P1_NET       dev $IF1 src $IP1          table T1
  ip route add 192.168.100.0 dev eth0 src 192.168.100.2 table 1
  
  # ip route add default via $P1                          table T1
  ip route add default via 192.168.100.1                table 1
  
  # ip route add $P2_NET       dev $IF2 src $IP2          table T2
  ip route add 192.168.1.0   dev eth1 src 192.168.1.2   table 2
  
  # ip route add default via $P2                          table T2
  ip route add default via 192.168.1.1                  table 2
  
  # Nothing spectacular, just build a route to the gateway and build a 
  # default route via that gateway, as you would do in the case of a
  # single upstream provider, but put the routes in a separate table per
  # provider. Note that the network route suffices, as it tells you how to
  # find any host in that network, which includes the gateway, as
  # specified above.
  #
  # Next you set up the main routing table. It is a good idea to route
  # things to the direct neighbour through the interface connected to that
  # neighbour. Note the `src' arguments, they make sure the right outgoing
  # IP address is chosen.
  
  # ip route add $P1_NET         dev $IF1 src $IP1  
  ip route add 192.168.100.0   dev eth1 src 192.168.100.2 
   
  # ip route add $P2_NET         dev $IF2 src $IP2  
  ip route add 192.168.1.0     dev eth1 src 192.168.1.2 
   
  
  # Then, your preference for default route:
  
  # ip route add default via $P1
  # ip route add default via 192.168.100.1
  
  
  # Next, you set up the routing rules. These actually choose what
  # routing table to route with. You want to make sure that you route out
  # a given interface if you already have the corresponding source
  # address:
  
  # ip rule add from $IP1 table T1
  ip rule add from 192.168.100.2 table 1
  
  # ip rule add from $IP2 table T2  
  ip rule add from 192.168.1.2   table 2
  
Now, it seems that connections from both sides are answered correctly.

As for load balancing, the next section from the HOWTO talks about
*exactly* that.  But as I am not interested in that right now (I am
planning to dump the old DSL connection once I get the new one the way
I like it) I haven't tried that.  I have far too many other things on
my plate (including understanding how the above actually works).

One of my outstanding puzzles is I think that /etc/iproute2/rt_tables
is supposedly how I set this up at each boot, but I can't figure out
how to use that file.  I certainly can't just put my script there, I
get complaints.  Anyone know how to make this stuff happen at each
boot?

In the mean time, I am going to try sourcing my script from
/etc/rc.d/rc.local (/etc/rc.local doesn't seem to do anything), but
that seems wrong somehow, I would like to find the elegant way.


-kb, the Kent who has been learning a lot.



-- 
redhat-list mailing list
unsubscribe mailto:[EMAIL PROTECTED]?subject=unsubscribe
https://listman.redhat.com/mailman/listinfo/redhat-list

Reply via email to