ISDN - HDLC/PPP

[ home --> isdn --> isdn4k-utils --> X.75/UUCP --> HDLC/PPP --> voicemail --> miscellaneous --> links ]

Setting up an HDLC (PPP) link

Setting up an HDLC (PPP) link is a bit more complicated, as it involves kernel routing tables etc. This setup has been working fine for some time now.

The following script, invoked as /usr/local/bin/isdn, is used to set up or shut down an auto-dialing PPP link. Use 'isdn -h' for a short explanation of the commandline syntax.

#!/bin/sh
#
# $Id: HDLC.m4,v 1.2 1999/04/26 12:22:53 ed Exp $
#
# This enables/disables an auto-dialing ISDN PPP link.
#
# Steps in setting up an auto-dialing link:
#	Create the interface
#	Start daemon on the interface
#	Configure the interface
#	Set default route to the interface
#	Point the resolver to a valid set of nameservers

SEMAFILE=/tmp/.isdn-status

# Check commandline syntax
#
if [ "$1" = "" ]; then
	/bin/echo
	/bin/echo "ISDN  - Enable/disable auto-dialing ISDN PPP link"
	/bin/echo "Usage : isdn [ on / off ]"
	if [ -e $SEMAFILE ]; then
		/bin/echo "Status: ISDN is ON"
	else
		/bin/echo "Status: ISDN is OFF"
	fi
	exit 0
fi


# Enable PPP link
#
if [ "$1" = "on" ]; then
	echo Switching on the auto-dialing ISDN PPP link...
	/bin/touch $SEMAFILE & >/dev/null

	##################################################################
	# Setup the ISDN part

	# Create interface
	/sbin/isdnctrl addif ippp0
	# Set provider's telephone number
	/sbin/isdnctrl addphone ippp0 out 0402606606
	# Assign the used MSN/EAZ, use a separate one for separate billing
	/sbin/isdnctrl eaz ippp0 402926299
	# Timeout setting
	/sbin/isdnctrl huptimeout ippp0 90
	# This device doesn't accept any connections
	/sbin/isdnctrl secure ippp0 on
	# HDLC as protokol for security layer
	/sbin/isdnctrl l2_prot ippp0 hdlc
	# Handshaking is PPP
	/sbin/isdnctrl encap ippp0 syncppp
	# ippp0 is firmly linked to interface 0
	# (When using several ipppd daemons, for several PPP connections !)
	/sbin/isdnctrl pppbind ippp0 0
	echo

	##################################################################
	# Setup the IPPPD part

	/sbin/ipppd ipcp-accept-local ipcp-accept-remote lock -bsdcomp -vj -vjccomp -detach mru 1524 -proxyarp user Pevoncken /dev/ippp0 &

	# The IP numbers (local pointopoint remote) are dummies,
	# they are replaced by ipppd after connecting.
	/sbin/ifconfig ippp0 -arp 192.168.1.64 pointopoint 194.151.64.2 netmask 255.255.255.0 metric 1 

	# Just serves automated connection creation
	# and after that is overwritten by ipppd
	/sbin/route del default
	/usr/bin/sleep 1
	/sbin/route add default ippp0

	# Set up the resolver configuration for remote use
#	/bin/cp -a /etc/resolv.conf.on /etc/resolv.conf

	echo Done.
	exit 0
fi


# Disable PPP link, wait some, and restore default route
#
if [ "$1" = "off" ]; then
	echo Switching off the auto-dialing ISDN PPP link...
	/bin/rm $SEMAFILE & >/dev/null

	# Reset the resolver configuration for local use
#	/bin/cp -a /etc/resolv.conf.off /etc/resolv.conf
	# Remove the route pointing to the ippp0 device
	/sbin/route del default
	# Shut down the interface
	/sbin/ifconfig ippp0 down
	/bin/kill -SIGTERM /sbin/pidof ipppd` 2> /dev/null
	/usr/bin/sleep 2
	/bin/kill -SIGKILL `/sbin/pidof ipppd` 2> /dev/null
	/usr/bin/sleep 1
	# Delete the interface
	/sbin/isdnctrl delif ippp0
	# Insert a 'local' default route
	/sbin/route add default gw 192.168.1.1 metric 1

	echo Done.
	exit 0
fi


# If we get here, there was no valid commandline option
#
/bin/echo
/bin/echo "Syntax error"
/bin/echo "usage: isdn [ on / off ]"
/bin/echo
exit 0

A semaphore file (/tmp/.isdn-status) is created and removed to indicate the status of the ISDN autodialer. You may want to disable this feature if it bothers you.

Furthermore, the script can copy different resolver file versions to /etc/resolv.conf (on and off respectively). I use the 'online version only, so I disabled the copy-operations for now. /etc/resolv.conf.on contains something like this:

search hal.iaehv.nl iaehv.nl
domain iaehv.nl
nameserver 194.151.64.2
nameserver 194.151.65.2
nameserver 131.155.2.3
nameserver 131.155.2.7
You will probably need to change all those references to hostnames, domains and nameservers. /etc/resolv.conf.off would look like this:
domain iaehv.nl

Hint: You can view the status of the interface using /sbin/isdnctrl list ippp0. To remove the entire interface, use /sbin/isdnctrl delif ippp0 (after executing /sbin/ifconfig ippp0 down).

It is possible to poll UUCP using the X75 lines. If you want to use the HDLC lines for UUCP, you must use a TCP dialer for UUCP. Currently, I do not have such a setup.

top$Id: HDLC.m4,v 1.2 1999/04/26 12:22:53 ed Exp $

Sending unsolicited (commercial) email
to any address on these pages strictly prohibited!

Caught in a frame? Go to http://www.iaehv.nl/users/evoncken/index.html
Questions? Remarks? Contact Ed Voncken evoncken@iaehv.nl