All of lore.kernel.org
 help / color / mirror / Atom feed
From: gypsy <gypsy@iswest.com>
To: lartc@vger.kernel.org
Subject: Re: [LARTC] Question
Date: Wed, 17 Dec 2003 03:51:26 +0000	[thread overview]
Message-ID: <marc-lartc-107163401331630@msgid-missing> (raw)
In-Reply-To: <marc-lartc-98373938216811@msgid-missing>

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@mailman.ds9a.nl
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/

  parent reply	other threads:[~2003-12-17  3:51 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-10-18 11:58 [LARTC] Question bkonosky
2002-01-11 17:49 ` =?unknown-8bit?q?Gast=C3=B3n?= Forbice
2002-01-12 13:30 ` bert hubert
2002-12-05  6:58 ` Liviu Faciu
2002-12-05 17:06 ` Stef Coene
2003-12-16  4:31 ` Edgar Estrada Lopez
2003-12-17  3:51 ` gypsy [this message]
  -- strict thread matches above, loose matches on Subject: below --
2000-10-18 16:56 Ben

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=marc-lartc-107163401331630@msgid-missing \
    --to=gypsy@iswest.com \
    --cc=lartc@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.