[ Current Issue Home | Issue #4 Home | FAQ ]��

The FreeBSD 'zine
Featured Articles: PPP
## Connecting to your ISP with PPP
## Dan Langille <>

Which PPP?

There are two types of PPP but we will deal only with one of them: User-PPP. This is the version of PPP which is commonly used by people. Kernel-PPP requires much more work to set up and configure.

Before you begin

The best thing you can do before you start with PPP is figure out the details of your hardware. You'll need to know the following things:

  1. the port your modem is on
  2. the speed of your modem
  3. your login id for your ISP
  4. your login password for your ISP
  5. whether or not your ISP assigns you a dynamic or a static IP

Things to read now

The following articles should be read before you continue. You don't have to read all of it, just be aware of the terms they use and the topics they cover. They will be useful during the setup. I recommend them in the order they appear. I suggest you set up your machine using the first resource and referring to my examples. They might help.


The FreeBSD Handbook - this is what I followed when writing this article.


The FreeBSD Tutorial on the Point to Point Protocol (PPP).


Written by , the maintainer of user-ppp for FreeBSD and OpenBSD.

Configuration

This section talks about creating your /etc/ppp/ppp.conf file. The contents of my file are listed below. The following items should be changed.

  • speed
  • phone
  • authname
  • authkey
  • ifaddr

Please note that this section assumes that your ISP assigns you a static IP. If you are assigned an IP dynamically, please see the PPP Configuration section of the .

	default:
	 set log Phase Chat Connect LCP tun command
	 set device /dev/cuaa0
	 set speed 38400
	 deny lqr
	 set dial "ABORT BUSY ABORT NO\\sCARRIER TIMEOUT 60 \"\" ATE1Q0 OK-AT-OK
		\\dATDT\\T TIMEOUT 40 CONNECT"
	myisp:
	 set phone 555-1212
	 set redial 10 4
	 set login
	 set authname blumsky
	 set authkey 42over90
	 set timeout 0
	 set ifaddr 203.96.56.57/32 192.168.0.1/0 255.255.255.255 0.0.0.0
	 add default HISADDR
	 enable dns
  

Note that the space at the start of some of the lines is needed. Also, the 'set dial' line above should be all on one line with a space between OK-AT-OK and \\dATDT...". It was split to two lines because of space constraints.

I'll be using COM1 (sio0) for my modem. From Windows, I found that COM1 is using IRQ 4 and I/O Base of 0x3F8. You can find this out from Control Panel/System/Device Manager. This varies from the standard kernel so I had to create a custom kernel.

The ifaddr deserves special attention. Remember that my ISP assigns me a static IP address. The first number (203.96.56.57/32) is that IP. You should refer to the CONTROLLING IP ADDRESS section of for more detail. It contains several examples and you should pick the one that suits you best.

Manually using the modem

I was having trouble getting the above script to work. So I decided to try dialing manually. At this confirms that my modem can and will work! I have been able to dial up my ISP by trying the following:

	kennett# ppp
	Working in interactive mode
	Using interface: tun0
	ppp ON kennett> term
	deflink: Entering terminal mode on /dev/cuaa0
	atdt555-1212
	CONNECT 28800/ARQ/V34/LAPM/V42BIS

	Myisp Networks Ltd

	NOTE: Please configure your system to dial 555-1212 ONLY for
	      PPP.

	For assistance, or to report a problem, check out our web page
	http://www.myisp.com, or email [email protected], or phone 
	555 1212 (office hours).

	cs2 line 6 

	User Access Verification

	login: mylogin
	Password: 
	Entering PPP mode.
	Async interface address is unnumbered (Ethernet0)
	Your IP address is xxx.xx.xx.xx. MTU is 1500 bytes
	Header compression will match your system.

	~
  

But when I tried the following, it didn't dial at all:

	kennett# ppp
	Working in interactive mode
	Using interface: tun0
	ppp ON kennett> dial myisp
	Warning: Add route failed: default already exists
	ppp ON kennett> Warning: Chat script failed
	ppp ON kennett> 
  

So what I did was increase my timeout to 45 from 40. And I connected!

Routing tables and interfaces

Here's what tun0 looked like after connecting:

	$ ifconfig tun0
	tun0: flags=8051 mtu 1500
		inet 203.96.56.57 --> 192.100.53.23 netmask 0xffffffff 
  

Here's what my routing table looked like before I connected. Note that unless you have a network card, you probably won't have a line like the ones with Netif = ed0.

	kennett# netstat -rn
	Routing tables

	Internet:
	Destination        Gateway            Flags     Refs     Use     Netif Expire
	127.0.0.1          127.0.0.1          UH          0        0      lo0
	192.168            link#1             UC          0        0      ed0
  

And after connecting:

	kennett# netstat -rn
	Routing tables

	Internet:
	Destination        Gateway            Flags     Refs     Use     Netif Expire
	default            192.100.53.23      UGSc        0        0     tun0
	127.0.0.1          127.0.0.1          UH          0        0      lo0
	192.100.53.23      203.96.56.57       UH          1        0     tun0
	192.168            link#1             UC          0        0      ed0
  

You can see that the IP specified in my ifaddr line of my configuration file appears under Gateway for the destination 192.100.52.23, which is the local address of tun0. The default address is also the same destination. This means that unless another destination is found, the traffic will go out on that address, to your ISP.

If you have problems

  • If the modem is external, make sure the modem is plugged into the correct serial port and is powered on.
  • Check that you are specifying the correct port in the ppp configuration file.
  • Verify that your ifaddr line is correct. Look at the CONTROLLING IP ADDRESS section of man ppp.

Advanced configurations

This example involves only one configuration, namely, the myisp setup. You can have more than one configuration within the file. See of the Pedantic PPP Primer for examples on how this can be done.

Auto dialing

You can configure PPP so that it dials your ISP whenever traffic is ready to go out. For example, whenever someone browses to a web page, etc. This can be done by issuing the following command:

	ppp -auto myisp
  

You could do this at boot time by adding the following to /etc/rc.local:

	echo " nmbd" && ppp -auto myisp
  

Auto hangup

You can set this connection to automatically hang up after an idle period by adding the following line to your configuration file:

	set timeout 600
  

This will hang up after you're idle for 600 seconds. If you set it to zero, it will never time out.

Manual hangup

If you issue the following command, ppp will terminate the current connection:

	killall -INT ppp
  

This will cause ppp to terminate:

	killall ppp
  

See man ppp for more information.

Did this help?

This was the first time I've installed ppp. If this doesn't work for you, I'd like to know about it. All feedback to the email address at the top of this article will be appreciated.

- Dan

Return to Issue #4

Contact: <>
Last modified: $Date: 1999/06/26 05:33:24 $
Copyright � 2023, The FreeBSD 'zine
All rights reserved.