<< | Thread Index | >> ]    [ << | Date Index | >> ]

Subject: Re: Multiple CIPE interfaces on one server?
From: Heinz Ulrich Stille <ulrich,AT,design-d,DOT,de>
Date: Tue, 6 Feb 2001 11:03:35 +0100
In-reply-to: <B6A4A803.35C9%basil.hussain@specialreserve.net>

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi!

I took a different approach: I decided to integrate with the other RedHat
scripts in /etc/sysconfig/network-scripts.
It is important *not* to have an /etc/cipe/options, at least not one with
a `key' entry.

The main script is ifup-cipcb:
- ----------------------------------------------
#!/bin/sh
PATH=/sbin:/usr/sbin:/bin:/usr/bin

cd /etc/sysconfig/network-scripts
. network-functions

CONFIG=$1
[ -f "${CONFIG}" ] || CONFIG=ifcfg-${1}
source_config

if [ "${2}" = "boot" -a "${ONBOOT}" = "no" ]; then
  exit
fi

[ -x /usr/sbin/ciped-cb ] || {
  echo "/usr/sbin/ciped-cb does not exist or is not executable"
  echo "ifup-cipcb for ${DEVICE} exiting"
  logger -p daemon.info -t ifup-cipcb \
    "/usr/sbin/ciped-cb does not exist or is not executable for ${DEVICE}"
  exit 1
}

[ -n "${SRCDEV}" ] && SRCIP=$(ifconfig ${SRCDEV} | \
  awk '/inet addr/ {sub ("addr: ",""); print $2}')
[ -z "${SRCPORT}" ] && SRCPORT=${PORT}
[ -z "${DSTPORT}" ] && DSTPORT=${PORT}

umask 077
keyfile=/var/run/cipe/${DEVICE}.key
echo "key=${KEY}" > ${keyfile}

opts="maxerr=-1 dynip=true"
[ -n "${DEVICE}" ] && opts="${opts} device=${DEVICE}"
[ -n "${IPADDR}" ] && opts="${opts} ipaddr=${IPADDR}"
[ -n "${PTPADDR}" ] && opts="${opts} ptpaddr=${PTPADDR}"
[ -n "${SRCIP}" -a -n "${SRCPORT}" ] && opts="${opts} me=${SRCIP}:${SRCPORT}"
if [ -n "${DSTIP}" -a -n "${DSTPORT}" ]; then
        opts="${opts} peer=${DSTIP}:${DSTPORT} ping=300"
else
        opts="${opts} peer=0.0.0.0:${DSTPORT}"
fi

(logger -p daemon.info -t ifup-cipcb \
  "ciped-cb started for ${DEVICE}" &)&
exec /usr/sbin/ciped-cb ${opts} -o ${keyfile}
- ----------------------------------------------

The config (ifcfg-cipcb{0,1,2,...}) looks like:
- ----------------------------------------------
DEVICE=cipcb0
ONBOOT=yes

SRCDEV=eth0
DSTIP=server.domain.de
PORT=2345

IPADDR=192.168.1.1
PTPADDR=192.168.1.2

KEY="623877d907bf3b74d6d12f595482a006"
- ----------------------------------------------

MfG, Ulrich

- -- 
The wages of sin is death but so is the salary of virtue, and at least the
evil get to go home early on Fridays.
                                            T. Pratchett, "Witches Abroad"
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.4 (GNU/Linux)
Comment: pgpenvelope 2.9.0 - http://pgpenvelope.sourceforge.net/

iEYEARECAAYFAjp/x0QACgkQ6lMTfnOybHjENwCff6j4I2l2W2IM1NNNIG5Jop3T
X7cAnjs9J0YXU6aErZ8kaImZ4mx3fTby
=NVWP
-----END PGP SIGNATURE-----





<< | Thread Index | >> ]    [ << | Date Index | >> ]