[an error occurred while processing this directive] FreeBSD Handbook : PPP and SLIP : Setting up kernel PPP : Working as a PPP client
Previous: Setting up kernel PPP
Next: Working as a PPP server

11.2.1. Working as a PPP client

I used the following /etc/ppp/options to connect to CISCO terminal server PPP line.

crtscts		# enable hardware flow control
modem		# modem control line
noipdefault	# remote PPP server must supply your IP address.
		# if the remote host doesn't send your IP during IPCP
		# negotiation , remove this option
passive		# wait for LCP packets
domain ppp.foo.com	# put your domain name here

:<remote_ip>	# put the IP of remote PPP host here
		# it will be used to route packets via PPP link
		# if you didn't specified the noipdefault option
		# change this line to <local_ip>:<remote_ip>

defaultroute	# put this if you want that PPP server will be your
		# default router

To connect:

  1. Dial to the remote host using kermit ( or other modem program ) enter your user name and password ( or whatever is needed to enable PPP on the remote host )

  2. Exit kermit. ( without hanging up the line )

  3. enter:
    /usr/src/usr.sbin/pppd.new/pppd /dev/tty01 19200
    
    ( put the appropriate speed and device name )

Now your computer is connected with PPP. If the connection fails for some reasons you can add the "debug" option to the /etc/ppp/options file and check messages on the console to track the problem

Following /etc/ppp/pppup script will make all 3 stages automatically:

#!/bin/sh 
ps ax |grep pppd |grep -v grep
pid=`ps ax |grep pppd |grep -v grep|awk '{print $1;}'`
if [ "X${pid}" != "X" ] ; then
        echo 'killing pppd, PID=' ${pid}
        kill ${pid}
fi
ps ax |grep kermit |grep -v grep
pid=`ps ax |grep kermit |grep -v grep|awk '{print $1;}'`
if [ "X${pid}" != "X" ] ; then
        echo 'killing kermit, PID=' ${pid}
        kill -9 ${pid}
fi

ifconfig ppp0 down
ifconfig ppp0 delete

kermit -y /etc/ppp/kermit.dial
pppd /dev/tty01 19200

/etc/ppp/kermit.dial is kermit script that dials and makes all necessary authorization on the remote host. ( Example of such script is attached to the end of this document )

Use the following /etc/ppp/pppdown script to disconnect the PPP line:

#!/bin/sh
pid=`ps ax |grep pppd |grep -v grep|awk '{print $1;}'`
if [ X${pid} != "X" ] ; then
        echo 'killing pppd, PID=' ${pid}
        kill -TERM ${pid}
fi

ps ax |grep kermit |grep -v grep
pid=`ps ax |grep kermit |grep -v grep|awk '{print $1;}'`
if [ "X${pid}" != "X" ] ; then
        echo 'killing kermit, PID=' ${pid}
        kill -9 ${pid}
fi

/sbin/ifconfig ppp0 down
/sbin/ifconfig ppp0 delete
kermit -y /etc/ppp/kermit.hup 
/etc/ppp/ppptest

Check if PPP is still running (/usr/etc/ppp/ppptest):

#!/bin/sh
pid=`ps ax| grep pppd |grep -v grep|awk '{print $1;}'`
if [ X${pid} != "X" ] ; then
        echo 'pppd running: PID=' ${pid-NONE}
else
        echo 'No pppd running.'
fi
set -x
netstat -n -I ppp0
ifconfig ppp0

Hangs up modem line (/etc/ppp/kermit.hup):

set line /dev/tty01	; put your modem device here
set speed 19200
set file type binary
set file names literal
set win 8
set rec pack 1024
set send pack 1024
set block 3
set term bytesize 8
set command bytesize 8
set flow none

pau 1
out +++
inp 5 OK
out ATH0\13
echo \13
exit


FreeBSD Handbook : PPP and SLIP : Setting up kernel PPP : Working as a PPP client
Previous: Setting up kernel PPP
Next: Working as a PPP server [an error occurred while processing this directive]