All of lore.kernel.org
 help / color / mirror / Atom feed
From: gypsy <gypsy@iswest.com>
To: lartc@vger.kernel.org
Subject: [LARTC] nano howto
Date: Tue, 26 Aug 2003 02:16:24 +0000	[thread overview]
Message-ID: <marc-lartc-106186398906359@msgid-missing> (raw)
In-Reply-To: <marc-lartc-106183621310109@msgid-missing>

Andres Gregori wrote:
> In others words, since ISP provide me a IPE1 and IPE2,
> how
> must I to complete # HERE lines ?
>
> Thank you very much for your help !!! (TIA)
> 
> Best regards,
> 
> Andres.

Here is the script I use to get a dynamically assigned IP address:
> /sbin/ifconfig ppp0 | awk '/P-t-P/{split($3,x,":"); print x[2]}' >/etc/firewall/remoteIP
> /sbin/ifconfig ppp0 | awk '/inet addr/{split($2,x,":"); print x[2]}' >/etc/firewall/localIP

Here is the script that brings interfaces up.  Examine the ppp0 stuff
because PEER is a hard to find answer...

> #! /bin/sh
> # /etc/rc.d/rc.nano1
> # This brings up the network interfaces
> # nano1.sh converted to rc.nano1 (which replaces rc.inet1) 6/6/03 JK
> echo -n "rc.nano1: "
> # Abbreviations:
> # IFI		internal interface
> # IPI		IP address of internal interface
> # NWI		internal network IP
> # NMI		netmask for the internal interface
> # IFE1, IFE2	external interfaces
> # IPE1, IPE2	external IP addresses
> # NWE1, NWE2	external network addresses
> # NME1, NME2	masks for the external network in CIDR format (E.G. /24)
> # BRD1, BRD2	broadcast addresses for external networks
> # GWE1, GWE2	gateways for external interfaces
> IFI="eth0"
> IPI="192.168.223.254"
> NWI="192.168.223.0"
> NMI="24"
> IFE1="eth1"
> IFE2="eth2"
> IFE3="eth3"				# cable (search "cable")
> IFE4="ppp0"
> IPE1="168.103.240.89"
> IPE2="168.103.92.1"
> IPE3="127.0.0.1"			# cable
> IPE4=`cat /etc/firewall/localIP`	# dynamic
> NWE1="168.103.240.88"
> NWE2="168.103.92.0"
> NWE3="127.0.0.0"			# cable
> NWE4=`cat /etc/firewall/localIP`
> NME1="29"
> NME2="29"
> NME3="32"				# cable
> NME4="32"
> BRD1="168.103.240.95"			# Broadcast
> BRD2="168.103.92.7"			# Broadcast
> BRD3="127.0.0.255"			# cable
> BRD4=`cat /etc/firewall/remoteIP`	# Broadcast (use "peer" for ppp0)
> GWE1="168.103.240.94"			# Gateway
> GWE2="168.103.92.6"			# Gateway
> GWE3="127.0.0.254"			# cable
> GWE4=`cat /etc/firewall/remoteIP`	# Gateway, dynamic
> 
> ip link set lo up
> ip addr add 127.0.0.1/8 brd + dev lo
> # "+" is shorthand for the broadcast address, here 127.0.0.255
> ip route add 127.0.0.0/8 dev lo
> 
> ip link set $IFI up
> # Assigning an address will cause the kernel to automatically insert an 
> # appropriate route into table main:
> ip addr add $IPI/$NMI brd + dev $IFI
> # We want table main looked at first, so we assign it a low priority:
> ip rule add prio 10 table main
> # We want to make sure there is no default route in table main.  If there isn't
> # one, this will fail (which is fine):
> ip route del default table main
> 
> ip link set $IFE1 up
> # To be sure there are no preexisting IPs assigned to the interface, we flush:
> ip addr flush dev $IFE1
> # BRD# specifies the broadcast address:
> ip addr add $IPE1/$NME1 brd $BRD1 dev $IFE1
> 
> ip link set $IFE2 up
> ip addr flush dev $IFE2
> ip addr add $IPE2/$NME2 brd $BRD2 dev $IFE2
> 
> #cable #ip link set $IFE3 up
> #cable ip addr flush dev $IFE3
> #cable ip addr add $IPE3/$NME3 brd $BRD3 dev $IFE3
> 
> #ip link set $IFE4 up
> #ppp0  ip addr flush dev $IFE4
> #ppp0  ip addr add $IPE4/$NME4 peer $BRD4 dev $IFE4
> 
> # For established connections, we do not want to match the multipath route.
> # We need to make sure we use the same route as before, so we add a table for
> # each interface.  We use a priority that makes sure these routes are found
> # after the main table and before the MP table:
> ip rule add prio 20 from $NWE1/$NME1 table eth1
> # Special-case news.iswest.com to use eth1
> ip rule add prio 21 to 216.166.71.237/32 table eth1
> # These are default routes because they must match any address:
> ip route add default via $GWE1 dev $IFE1 src $IPE1 proto static table eth1
> # If the interface is not working, this acts like REJECT; it causes an ICMP
> # PKT_FILTERED to be sent to the requester:
> ip route append prohibit default table eth1 metric 1 proto static
> 
> ip rule add prio 40 from $NWE2/$NME2 table eth2
> ip route add default via $GWE2 dev $IFE2 src $IPE2 proto static table eth2
> ip route append prohibit default table eth2 metric 1 proto static
> 
> #cable ip rule add prio 60 from $NWE3/$NME3 table eth3
> #cable ip route add default via $GWE3 dev $IFE3 src $IPE3 proto static table eth3
> #cable ip route append prohibit default table eth3 metric 1 proto static
> 
> #ppp0  ip rule add prio 80 from $NWE4/$NME4 table ppp0
> #ppp0  ip route add default via $GWE4 dev $IFE4 src $IPE4 proto static table ppp0
> #ppp0  ip route append prohibit default table ppp0 metric 1 proto static
> 
> # New connections have no local source address.  Neither is there any default
> # route, so we create a multipath default route for them:
> ip rule add prio 90 table 9
> ip route add default table 9 proto static equalize nexthop via $GWE1 dev $IFE1 nexthop via $GWE2 dev $IFE2
> # ip route add default table 9 proto static nexthop via $GWE1 dev $IFE1 nexthop via $GWE2 dev $IFE2
> 
> # Done.

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

      parent reply	other threads:[~2003-08-26  2:16 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-08-25 18:26 [LARTC] nano howto Andres Gregori
2003-08-25 20:25 ` Robert Felber
2003-08-26  2:16 ` gypsy [this message]

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-106186398906359@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.