#!/bin/sh -a

# $Id: ip-up,v 1.90 1998/06/10 03:43:32 czyborra Exp $

# Jan 7 20:51:38 sickchick syslog: /etc/ppp/ip-up ppp0 /dev/modem
# 115200 130.149.17.227 130.149.17.20 TERM=dumb HOSTTYPE=i386
# PATH=/usr/local/bin:/bin:/usr/bin:. SHELL=/bin/bash OSTYPE=Linux
# SHLVL=1 _=/usr/bin/printenv

PATH=/bin:/usr/bin:/sbin:/usr/sbin:/usr/X11/bin

# pppd supplies the following arguments:

INTERFACE=$1
   DEVICE=$2
    SPEED=$3
    LOCAL=${LOCAL-`ifconfig | sed -n 's/.*addr://;s/P-t-P:.*//p'`}
   REMOTE=${5-medvic}
  IPPARAM=$6
     USER=`perl -0pe '/Uid:\s*(\d+)/;$_=getpwuid($1)' /proc/$PPID/status`

# output device:

exec >>/proc/$PPID/fd/2 2>&1
DISPLAY=:0.0 XAUTHORITY=/home/$USER/.Xauthority
tcpdump -i $INTERFACE &

# Localization:

case $REMOTE in

130.149.1.**) DOMAIN=zrz.tu-berlin.de;;
130.149.17.*) DOMAIN=cs.tu-berlin.de;;
149.********) DOMAIN=compuserve.com;;
194.25.*****) DOMAIN=t-online.de;;
194.64.**.**) DOMAIN=snafu.de;;
194.109.6.**) DOMAIN=xs4all.nl;;
194.109.?0.*) DOMAIN=dds.nl;;
194.112.92.*) DOMAIN=sofort.net;;
           *) DOMAIN=cs.tu-berlin.de;;
esac

# Support your local dealers

case $DOMAIN in

zrz.tu-berlin.de)

	DNS1=130.149.4.20		# names.zrz.tu-berlin.de
	DNS2=130.149.4.10		# mailgzrz.tu-berlin.de
	SMTPSERVER="130.149.4.10	mailgzrz.tu-berlin.de"
	NNTPSERVER="130.149.4.16	news.zrz.tu-berlin.de"
	IRCSERVER="160.45.10.24  	irc.fu-berlin.de"
	WWWSERVER="130.149.4.46		www.tu-berlin.de"
	WWWPROXY="130.149.4.44		proxy.zrz.tu-berlin.de"
	PROXYPORT=3128;;

cs.tu-berlin.de)

	DNS1=130.149.17.163		# saludo.cs.tu-berlin.de
	DNS2=130.149.17.13		# mail.cs.tu-berlin.de
	SMTPSERVER="130.149.17.13	mail.cs.tu-berlin.de"
	NNTPSERVER="130.149.17.10	news.cs.tu-berlin.de"
	IRCSERVER="160.45.10.24  	irc.fu-berlin.de"
	WWWSERVER="130.149.17.15	andele.cs.tu-berlin.de"
	WWWPROXY="130.149.4.44		proxy.zrz.tu-berlin.de"
	PROXYPORT=3128;;

sofort.net)
	DNS1=194.112.92.65		# martin.birch.de
	DNS2=194.112.93.226		# margaret.birch.de
	SMTPSERVER="194.112.92.59	berlin.sofort.net"
	NNTPSERVER="194.112.92.59	ian.birch.net"
	IRCSERVER="160.45.10.24  	irc.fu-berlin.de"
	WWWSERVER="194.112.93.141	sofort.net"
	WWWPROXY="194.112.92.59		ian.birch.net"
	PROXYPORT=3128;;

compuserve.com)
	DNS1=149.174.211.5		# arl-name-svc-1.compuserve.com
	DNS2=149.174.213.5		# dup-name-svc-1.compuserve.com
	;;

snafu.de)
	DNS1=194.64.64.1		# berlin.snafu.de
	;;

t-online.de)
	DNS1=194.25.2.129		# mail00.btx.dtag.de
	;;

dds.nl)

	DNS1=194.109.20.8		# alibaba.dds.nl
	DNS2=194.109.21.25		# www.dds.nl
	SMTPSERVER="194.109.21.19	mail.dds.nl"
	NNTPSERVER="194.109.20.8	alibaba.dds.nl"
	IRCSERVER="194.109.20.8 	alibaba.dds.nl"
	WWWSERVER="194.109.21.25	www.dds.nl www"
	WWWPROXY="194.109.20.21		fatima.dds.nl"
	PROXYPORT=8080;;


xs4all.nl)

	DNS1=194.109.6.66		# ns.xs4all.nl
	DNS2=194.109.9.99		# ns2.xs4all.nl
	# NNTPSERVER="194.109.6.70	news.xs4all.nl"
	SMTPSERVER="194.109.6.52	smtp.xs4all.nl"
	IRCSERVER="194.109.6.67 	irc.xs4all.nl"
	WWWSERVER="194.109.6.92 	www.xs4all.nl"
	WWWPROXY="194.109.6.90		wwwproxy.xs4all.nl"
	PROXYPORT=8080;;

esac

# Where am I?  Germany or Holland?

FQDN=cs.tu-berlin.de; case $DOMAIN in *.nl) FQDN=dds.nl; esac
domainname $FQDN; HOSTFQDN=czyborra.$FQDN

# Linux pppd doesn't speak RFC 1877 yet:

echo > /etc/resolv.conf "# resolv.conf for nslookup
# generated by $0 with $REMOTE
search $DOMAIN
nameserver $DNS1
nameserver $DNS2"

echo > /etc/host.conf "# host.conf
# generated by $0 with $REMOTE
order hosts, bind
multi on"

# DYNAME=${DYNAME-`host $LOCAL | sed -n s/Name:.//p`}

# Use dummy device for loopback connections to my own IP:

ifconfig dummy $LOCAL && route add $LOCAL dev dummy

# I like convenient host aliases:

echo > /etc/hosts "# /etc/hosts
# generated by $0
# \$Id: ip-up,v 1.90 1998/06/10 03:43:32 czyborra Exp $

# Who am I?

127.0.0.1       laptop smtp localhost
${LOCAL-
10.0.0.10}	$HOSTFQDN $DYNAME ${HOST=`hostname`}

# Support your local dealers

${SMTPSERVER-#}	mail
${NNTPSERVER-#}	news
${IRCSERVER-#}	irc
${WWWSERVER-#}	www
${WWWPROXY-#}	proxy

# Informatik-Rechnerbetrieb

130.149.17.3    tubvm
130.149.17.4    fiesta user
130.149.17.5    opal ns loghost
130.149.17.7    quepasa wwwwbs
130.149.17.10   news.cs.tu-berlin.de news.cs
130.149.17.12   caramba ftp.cs ftp
130.149.17.13   mail.cs.tu-berlin.de mail.cs
130.149.17.15   andele cs.tu-berlin.de
130.149.17.16   basta pub
130.149.17.20   arriba
130.149.17.21	maelaren irb ntps1-0 irb ntp
130.149.17.59	jeder
130.149.19.87	da webster
130.149.17.163	saludo ns

# Workstations

130.149.17.80   dec cesium
130.149.17.104  sun moth
130.149.17.116  sol curie

# Asynchron

130.149.17.213  anonymous213.ppp.cs.tu-berlin.de
# ...
130.149.17.236  anonymous236.ppp.cs.tu-berlin.de

# WBS

130.149.29.114  cobra
130.149.29.116  snake wbs
130.149.29.119  medvic
130.149.29.120  laplink

# ZRZ

130.149.1.80	ts3.zrz.tu-berlin.de ts3
130.149.1.81	async081.zrz.tu-berlin.de
130.149.1.86	async086.zrz.tu-berlin.de

130.149.1.100	ts2.zrz.tu-berlin.de ts2
130.149.1.101	async101.zrz.tu-berlin.de
130.149.1.110	async110.zrz.tu-berlin.de

130.149.1.120	ts1.zrz.tu-berlin.de ts1

130.149.1.159   ts5.zrz.tu-berlin.de ts5
130.149.1.160   ts4.zrz.tu-berlin.de ts4
130.149.1.161   dial1-01.zrz.tu-berlin.de
130.149.1.249	dial1-89.zrz.tu-berlin.de

130.149.4.10	mailgzrz.tu-berlin.de mailgzrz
130.149.4.15	mail.zrz.tu-berlin.de mail.zrz
130.149.4.16	news.zrz.tu-berlin.de mamenchi
130.149.4.20	names.zrz.tu-berlin.de names.zrz names
130.149.4.44	proxy.zrz.tu-berlin.de proxy.zrz server05
130.149.4.46	www.tu-berlin.de
130.149.5.34    w250zrz.zrz.tu-berlin.de w250.zrz w250
130.149.5.114	cetus.zrz.TU-Berlin.DE sp.zrz.tu-berlin.de sp
130.149.5.139	calvados.zrz.tu-berlin.de calvados linux.zrz.tu-berlin.de linux
130.149.5.172	zitrone.zrz.tu-berlin.de zitrone
130.149.5.180	lychee.zrz.tu-berlin.de lychee mmx

# TU

130.149.11.17   fb3-c21.math.tu-berlin.de fb3 c21
130.149.62.6	sandmann.prz.tu-berlin.de proxy.prz.tu-berlin.de

# FU

160.45.10.24	irc.fu-berlin.de pascal.zedat.fu-berlin.de
160.45.10.8     osiris.zedat.fu-berlin.de time.fu-berlin.de time

# Netscape

194.25.242.193	home.netscape.com www-de1.netscape.com

# Snafu

194.64.64.1     berlin.snafu.de www.snafu.de berlin snafu
194.64.64.23	mail.snafu.de
194.121.224.3	pop.snafu.de

# XS4ALL

194.109.6.21    ftp.xs4all.nl
194.109.6.42	xs1.xs4all.nl xs4all xs xs1
194.109.6.43	xs4all.nl xs2.xs4all.nl xs2
194.109.6.51	mail.xs4all.nl pop.xs4all.nl
194.109.6.52	smtp.xs4all.nl
194.109.6.66	ns.xs4all.nl
194.109.6.67	irc.xs4all.nl frodo.xs4all.nl
# 193.109.6.70	news.xs4all.nl
194.109.6.90	wwwproxy.xs4all.nl toutatis.xs4all.nl
194.109.6.92	www.xs4all.nl
194.109.9.99	fddi.xs4all.net ns2.xs4all.nl

194.109.6.101	asd-pm1.xs4all.net
194.109.6.120	asd-pm20.xs4all.net
194.109.45.21	asd09-20.dial.xs4all.nl
194.109.45.119	asd12-22.dial.xs4all.nl

# De Digitale Stad

194.109.20.16	annex.dds.nl ppp.dds.nl
194.109.10.131	dyna131.dial.dds.nl
194.109.10.156	dyna151.dial.dds.nl

194.109.20.8	alibaba.dds.nl forum.dds.nl news.dds.nl irc.dds.nl
194.109.21.19	mail.dds.nl pop.dds.nl smtp.dds.nl k9.dds.nl k9
194.109.20.21	fatima.dds.nl ftp.dds.nl proxy.dds.nl fatima huis
194.109.20.24	dds.nl dds dds.dds.nl telnet.dds.nl proxy.dds.nl
194.109.21.25	www.dds.nl finger.dds.nl shaman.dds.nl

# bi.org

194.217.250.201	bi.org bi

# netscape.com

198.95.249.40	news.mozilla.org

# czyborra.com

209.204.208.78  czyborra.com com
"

# Clock synchronisation:

clock -u -s
case $DOMAIN in cs.tu-berlin.de)
    netdate tcp irb && clock -u -w
esac
date > /etc/ppp/connect-time

# Caching WWW proxy cascade:

perl -pe 's/(no_proxy).*/$1\t\t'$DOMAIN'/; s/\bon/off/
if /^CacheNoConnect/;s/3128|8080/'$PROXYPORT/ -i /usr/www/etc/httpd

# User-editable ip-up functions (sendmail -q, fetchmail, etc.):

exec su $USER -c 'exec ~/.ip-up || source ~/.ip-up'
