Re: Question

Linux Advanced Routing and Traffic Control

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Edgar Estrada Lopez wrote:
> 
> Hello:
> 
> I need some help on split access and load balancing:
> 
> I have 2 xDSL (eth1 @ wireless broadband modem;  and ppp0, actually
> connected to eth0 on a phone DSL).
> 
> Both links have dynamic addresses.
> I was reading the examples in the HOWTO:
> --- copied from the howto ---
> 
>           ip route add $P1_NET dev $IF1 src $IP1 table T1
>           ip route add default via $P1 table T1
>           ip route add $P2_NET dev $IF2 src $IP2 table T2
>           ip route add default via $P2 table T2
> --- end copy --
> 
> this is awesome... is there any script that could convert these vars
> ($P1_NET, etc) into the REAL values of my 2 dsl connections?
> 
> I'm still not too good at coding in Linux... can anyone help me?
> 
> Thanks in advance
> 
> Edgar

Since nobody else volunteered:

--cut here --
#!/bin/sh
IFCONFIG="/sbin/ifconfig"
ROUTE="/sbin/route"
IF1="ppp0"
IF2="eth1"

# returns the IP address and netmask assigned to the interface
  IP1=`$IFCONFIG $IF1 2>/dev/null | grep inet | cut -d : -f 2 | cut -d
\  -f 1`
  MASK1=`$IFCONFIG $IF1 2>/dev/null | grep Mask | cut -d : -f 4`
  echo "$IP1/$MASK1"

# returns the network IP address and netmask per the routing table
  MASK1=`$IFCONFIG $IF1 2>/dev/null | grep Mask | cut -d : -f 4`
  P1_NET=`$ROUTE -n | grep $IF1 | grep $MASK | grep -w "U" | cut -d\ 
-f1`
  echo "$P1_NET/$MASK1"

# CAVEAT:  The interfaces must already be up.  Some error checking would
be advisable.  E.G.:

if [ "$P1_NET" = "" ]; then
    echo "no routing entry found for $IF1.  Aborting."
    exit
fi
-- cut here --

You might also look to see if information can be obtained from
/etc/ppp/ip-up.local or /etc/dhcpc/dhcpcd-eth1.info.

buck
_______________________________________________
LARTC mailing list / LARTC@xxxxxxxxxxxxxxx
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/

[Index of Archives]     [LARTC Home Page]     [Netfilter]     [Netfilter Development]     [Network Development]     [Bugtraq]     [GCC Help]     [Yosemite News]     [Linux Kernel]     [Fedora Users]
  Powered by Linux