The Care and Feeding of ISDN4BSD | ||
---|---|---|
13.3 Userland PPP setup | 13.3 Userland PPP setup | 13.3.2 Site-B Setup |
13.3.1 Site-A Setup:
If Site-A wants to establish a connection, it dials out to Site-B which rejects the call and in turn calls back Site-A to establish the connection.
- /etc/isdn/isdnd.rc:
The isdnd.rc is straightforward, there are only two remarkable configuration items:
# SYSTEM section:
- calledbackwait is set to 30 seconds because Site-B has a strange PBX where the callback call gets out about 20 seconds after the initial setup call from Site-A
- regexpr and regprog are setup to execute a script called /etc/isdn/ppp_in_trigger_siteb as soon as a connection has been made successfully from Site-B to Site-A. The reason for this is explained later in detail.
system
ratesfile = /etc/isdn/isdnd.rates
useacctfile = yes
acctall = on
acctfile = /var/log/isdnd.acct
rtprio = 25
regexpr = "PPP2SITEB incoming call active"
regprog = ppp_in_trigger_siteb
# ENTRY section:
entry
name = PPP2SITEB
usrdevicename = rbch
usrdeviceunit = 0
isdncontroller = 0
isdnchannel = -1
local-phone-incoming = 25
remote-phone-incoming = 0987654321
local-phone-dialout = 25
remote-phone-dialout = 0987654321
remdial-handling = first
dialin-reaction = accept
dialout-type = calledback
b1protocol = hdlc
idletime-incoming = 300
idletime-outgoing = 30
ratetype = 0
unitlength = 90
unitlengthsrc = rate
dialretries = 3
dialrandincr = off
recoverytime = 5
calledbackwait = 30
usedown = off
- /etc/ppp/ppp.conf:
This is the configuration file for ppp(8) running in daemon mode on Site-A. The ``set server'' line in the default configuration entry makes it possible for the pppctl(8) program to connect to the ppp daemon and control its operation. Please consult the pppctl(8) manual page for further information on this. We need this for the script called from isdnd (configured by its regprog-keyword), see further down for a complete explanation.
We use CHAP to exchange passwords and we want to use deflate-compression for data transfer.
default:
# let pppctl come in
set server 452 secret-password-3
siteb:
# THIS IS NEW FOR 4.0 !!!!!!!!!!
set phone 0987654321
# use CHAP
enable chap
# want to use deflate compression
enable deflate
accept deflate
disable pred1
deny pred1
# CHAP key and password
set authkey secret-password-5
set authname sitea
# wait time for carrier
link * set cd 30
# device to use
set device /dev/i4brbch0
# set no dial chat-script used
set dial
# set no hangup chat-script used
set hangup
# myaddr hisaddr netmask
set ifaddr 192.168.192.1 192.168.168.1 255.255.255.255
# add route to remote network
add 192.168.168.0/24 192.168.168.1
# set no login chat-script used
set login
# set dial on demand mode
set mode auto
# the the process title
set proctitle ppp2siteb
# we are a synchronous device
set speed sync
# idletimeout mintimeout
set timeout 60 300
set reconnect 5 0
- /etc/isdn/ppp_in_trigger_siteb:
This shell script does the trick: when isdnd detects the string configured by the isdnd.rc keyword regexpr in its log output, it executes the program configured with the regexpr keyword. In our case this program is the following shell script.
To understand why this script is needed at all, one must know that ppp(8) in auto mode only looks for packets at its network (tun) interfaces: if a packet is arriving there, ppp tries to establish a connection with the remote site. But the opposite is not true, it does not look on its associated /dev/i4brbch interface for arriving packets.
Because of this, in case a remote site establishes a connection, the local ppp(8) daemon would never notice its existence. To make him aware of the fact that a connection is established, isdnd calls this script when the connection is ready for data transfer: the script simply say ppp that this should open the associated /dev/i4brbch interface and the the PPP protocol start its negotiation operations:
#!/bin/sh
/usr/sbin/pppctl -p secret-password-3 sitea:452 open
exit 0
- /etc/ppp/ppp.secret:
Just for the completeness, this is the content of the ppp.secret file for Site-A:
# Authname Authkey
siteb secret-password-4
- /usr/local/etc/rc.d/ppp2siteb.sh:
This shell script is used to start the ppp(8) daemon at boot time in auto mode.
#!/bin/sh
if [ -f /etc/ppp/ppp.conf ]
then
echo -n ' ppp2siteb'
/usr/sbin/ppp -auto -unit0 -quiet siteb
fi