SUMMARY: IP-Routing: Setting up two uni-directional links

From: Peter Bray (pbray@ind.tansu.com.au)
Date: Thu Feb 09 1995 - 04:55:50 CST


The original script posted the other day as undergone some changes to
support a new host naming conventions here, but the answer can be found
in both the comments under the Routing heading and in the extra "route
add ..." at the end of the script. The solution has been verified on
the hardware present, an in simultaneous testing of the link (about
60K+ packets mainly FTP) we experienced NO Ierrs/Oerrs/Collis, with
data transfer rates between 800 to 1100 Kb/s (FTP stats)

Thanks to all especially Michael Sullivan.

Regards
Peter

------------------------------------------------------------------------------
Peter Bray: Intelligent Network Development Phone : (02) 395 3958
            Network Technology Group - Telecom Aust. Fax : (02) 395 3225
Street : Lvl 9, Telecom Plaza, 320 Pitt St, Sydney Email :
Mail : PO Box A792, Sydney South, NSW, 2000 pbray@ind.tansu.com.au
------------------------------------------------------------------------------

#!/bin/sh
#
# Set up static routes between the Database BackEnd (BE) and the Database
# FrontEnd (FE). This script should be able to be run on both machines
# and should live in /etc/rc2.d (Remembering we simulate rc2.d on SunOS)
#
# $Id: $
#
# The BE (Solaris) has a Sun QEC (Quad Ethernet Controller) and
# the FE (SunOS) has two FS/BE (Fast SCSI/Buffered Ethernet) cards.
#
# These are to be configured to provide uni-directional networks
# between the two machines, providing a theoretical 20Mb (10Mb each
# way), with a practical 12Mb. The networks are to be private, and not
# used for any other traffic.
#
# Physically:
#
# ____________ ______________
# | qe0| | |
# | qe1|----X----|le1 |
# /-|le0 BE qe2|----X----|le2 FE le0|---\
# | | qe3| | | |
# | -------------- -------------- |
# | |
# | SITE ETHERNET (UTP) |
# -----------------------------------------------
#
# The le0 interfaces attach to the Site network, and qe1/le1 and
# qe2/le2 are connected as private networks (with 10 Base T
# cross-overs).
#
# Host Naming Conventions:
#
# Interface The Database Backend The Database Frontend
#-----------------------------------------------------------------------
#
# le0 ${Site}_${DBType}be ${Site}_${DBType}fe
# le1 ${Site}_${DBType}fe_le1
# le2 ${Site}_${DBType}fe_le2
# qe0 ${Site}_${DBType}be_qe0
# qe1 ${Site}_${DBType}be_qe1
# qe2 ${Site}_${DBType}be_qe2
# qe3 ${Site}_${DBType}be_qe3
#
# Note : SunOS 4.x "uname -n" can not handle hostnames longer than
# 9 characters, so if GNU uname exists we use it :-)
#
# Routing:
# The important thing to remember when setting up the routing is
# that the source address of packets will be
# ${Site}_${DBType}${OtherEnd}_${OutgoingInterface} and not
# ${Site}_${DBType}${OtherEnd} where ${OtherEnd} is the Backend for a
# FrontEnd Machine (ie OtherEnd=be) and FrontEnd when setting up a
# BackEnd Machine (ie OtherEnd=fe)
#
# So it is simply not good enough to say route all packets for
# ${Site}_${DBType}${OtherEnd} to
# ${Site}_${DBType}${OtherEnd}_${IncomingInterface} you must also stop
# packets returning on our incoming interface by routing all packets
# for ${Site}_${DBType}${OtherEnd}_${OutgoingInterface} to
# ${Site}_${DBType}${OtherEnd}_${IncomingInterface}.
#
# Broadcast Addresses:
# It should be noted that SunOS 4.x and Solaris 2.x use
# different broadcast addresses (SunOS uses all zeros while Solaris
# uses all ones) This does not seem to be a problem.
#

if [ -f /opt/utils/bin/uname ]
then
        UNAME=/opt/utils/bin/uname
else
        UNAME=uname
fi

ME=`${UNAME} -n`
SITE=`echo ${ME} | sed -e 's/_.*//'`
OS_VERSION=`${UNAME} -r`

case ${ME} in
        ????_sms?e)
                DBTYPE=sms
                ;;
        ????_sdp?e)
                DBTYPE=sdp
                ;;
        *)
                DBTYPE=UNKNOWN
                ;;
esac

case ${ME} in
        ????_???be)
                IFTYPE=qe
                IFNUMS="1 2" # Could be "0 1 2 3"
                THEM=${SITE}_${DBTYPE}fe
                THEM_INCOMING=le1
                THEM_OUTGOING=le2
                ;;

        ????_???fe)
                IFTYPE=le
                IFNUMS="1 2"
                THEM=${SITE}_${DBTYPE}be
                THEM_INCOMING=qe2
                THEM_OUTGOING=qe1
                ;;
esac

for i in ${IFNUMS}
do
        case ${OS_VERSION} in
                5.*) # Initialise TCP/IP streams for i/f
                        ifconfig ${IFTYPE}$i plumb
                        ;;
         esac

        ifconfig ${IFTYPE}$i ${ME}_${IFTYPE}$i netmask + broadcast + private up
done

# Diagnostics to see if we configured them properly
ifconfig -a

# Now add the route to the other machine

route add host ${THEM} ${THEM}_${THEM_INCOMING} 1
route add host ${THEM}_${THEM_OUTGOING} ${THEM}_${THEM_INCOMING} 1



This archive was generated by hypermail 2.1.2 : Fri Sep 28 2001 - 23:10:15 CDT