Accessing the Internet via PPP on NetBSD


WARNING: The information in this page is grossly out-dated. I will leave the pages up in case they might be of some use.

NOTE: I have not used NetBSD for more than 2 years! I have not used MacOS or Mac hardware in more than three years. If you have questions, you are probably better off e-mailing the NetBSD mailing lists rather than me.


BSD Daemon This brief document discusses how to access the Internet via a dial-up ppp connection just like one would normally use a PC to dial-up a local Internet provider. There are other uses for pppd on UN*X, but they are not discussed here. These instructions are specifically written for the Mac68k port of NetBSD, but they should work for other NetBSD ports, FreeBSD, Linux, or other flavors of UN*X with little modification. The only change needed should be the serial port device name. This document also assumes that your provider uses a similar set up as my provider (I used to work for my provider, so I know how it is set up). This method should work for most providers. If your provider requires you to use PAP authentication, I have a few hints there as well.

The main reason why I decided to write this is because the "ppp kits" that are currently available for NetBSD seemed overly complicated and difficult to understand. My method does make use of the PPP-kit put together by Bill Studenmund. You can use it as is, or use it in conjunction with these instructions.
ftp://ftp.macbsd.com/pub/NetBSD/contrib/ppp-setup/wrstuden..setup.tgz

If you want demand-dial PPP, then you want the kit put together by Paul Goyette.
ftp://ftp.macbsd.com/pub/NetBSD/contrib/ppp-setup/ppp-dod.tgz

A similar set of instructions for NetBSD including PAP is here.

I wanted to be able to do dial-up PPP basically like I do it on my Macintosh:

  1. Establish a PPP connection.
  2. Run some Internet programs.
  3. Disconnect PPP session when finished.


Step One: RTFM

Read the man pages for pppd and chat. If you do run into problems, you will probably be able to find the needed switch in these man pages.

Step Two: Set up DNS

In the /etc/resolv.conf file, enter the following:

nameserver ###.###.###.###
nameserver ###.###.###.###
domain provider-domain-name.net
lookup file bind

where the ###.###.###.### is the IP address of the primary and secondary name servers. Here is an example from my provider:

nameserver 203.182.192.135
nameserver 203.182.192.35
domain giganet.net
lookup file bind

Note: this setup assumes that you have an /etc/hosts file. This is convenient if you have a local LAN not connected to the Internet. If you do not have an /etc/hosts file, then change the last line to:

lookup bind

Step Three: Set Your Options

In the /etc/ppp directory, create a file called options as follows:

passive
crtscts
defaultroute
lock
lcp-echo-interval 30
lcp-echo-failure 10
netmask 255.255.255.0
domain provider-domain-name.net
mtu 1500
name your-login-name
disconnect /etc/ppp/ppp-down

Step Four: Create a Login Script

In the /etc/ppp directory, create a script called ppp-up as follows:

#!/bin/sh

/usr/sbin/pppd /dev/tty00 57600 connect '/usr/sbin/chat -v "" ATZ OK ATDT###-#### CONNECT "" ogin: login-name word: login-password' \
crtscts defaultroute noipdefault modem

Replace ###-#### with the access point phone number for your Internet provider. Replace login-name with your login name provided by your Internet provider, and login-password with your password provided by your Internet provider. Make sure the script file is executable.

Note on the device: On the mac68k port of NetBSD, /dev/tty00 is your modem port and /dev/tty01 is your printer port. If you are using a different port of NetBSD, or another flavor of UN*X, the device names maybe different. For example, on my laptop running FreeBSD, I use the exact same ppp-up script, except that the device is /dev/cuaa0 for COM1.

Note on phone lines: If you have a pulse phone line, use ATDP instead of ATDT to dial the modem. If you dial tone on a pulse line, you will get a busy signal.

Using PAP (Password Authentication Protocol)

If you need to use PAP, change the ppp-up file to the following:

#!/bin/sh

/usr/sbin/pppd /dev/tty00 57600 connect '/usr/sbin/chat -v "" ATZ OK ATDT###-#### CONNECT' \
crtscts defaultroute noipdefault modem remotename *.provider-domain-name.net user your-login-name

My script looks like this:

#!/bin/sh

/usr/sbin/pppd /dev/tty00 57600 connect '/usr/sbin/chat -v "" ATZ OK ATDT0358337531 CONNECT' \
crtscts defaultroute noipdefault modem remotename *.giganet.net user mark

With PAP, you will also need to create a PAP Secrets file. In the /etc/ppp directory, create a file called pap-secrets as follows:

#user server secret address (optional)
your-login-name *.provider-domain-name.net login-password

Step Five: Create a Logout Script

In the /etc/ppp directory, create a script called ppp-down as follows:

#!/bin/sh

if [ -f /var/run/ppp0.pid ]; then
echo -n killing pppd...
kill `cat /var/run/ppp0.pid`
echo done
else
echo ppp already is down 1>&2
fi

Step Six: Test the Connection

Use the su command to become root. At the command line, type in the following:

/etc/ppp/ppp-up

You should hear the modem dial and connect. If you are running X, I usually open an xterm and then run the following command:

tail -f /var/log/messages

Messages are displayed as the chat login script runs. Once you are connected and you see the IP address confirmation on the terminal screen, try to ping your provider's name server. If it is successful, try to ping a known host (such as www.ibm.com). If you can ping successfully, the you should be in good shape. Now, run any Internet programs that you would like to test.

If you were unable to connect, try to determine how far you got in the process. You may need to read the man pages for pppd and chat. It is also helpful to connect with a terminal program such as kermit to see what the provider side is sending and expecting.

When you are ready to disconnect, at the command line, type in the following:

/etc/ppp/ppp-down

Step Seven: Making it Easier

To make it easier to connect and disconnect, you may want to do one or more of the following:


Go Back
Back to my MacBSD page.


Last updated, 98-09-15.

This page and all pages in this site are Copyright 1997-98 by Mark Andres. All right reserved.

URL for this page: http://www2.giganet.net/~mark/NetBSD/ppp.html