Things look quiet here. But I've been doing a lot of blogging at
dan.langille.org because I prefer WordPress now.
Not all my posts there are FreeBSD related.
I am in the midst of migrating The FreeBSD Diary over to WordPress
(and you can read about that here).
Once the migration is completed, I'll move the FreeBSD posts into the
new FreeBSD Diary website.
Eventually
I will be using the -alias option and maybe adding in some firewall
stuff. But that will be for another article.
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:
the port your modem is on
the speed of your modem
your login id for your ISP
your login password for your ISP
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.
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.
They are in bold italics for emphasis.
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 PPP Configuration section
of the FreeBSD Handbook. See the link
below for a non-HTML formatted copy of this file.
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.. I
have supplied a straight text copy which will probably
copy/paste better than that listed above..
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 man ppp for more detail. It contains
serveral 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 helpdesk@myisp.com, 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>
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.
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 the PPP - 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 webpage, 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
(NOTE: /etc/rc.local is deprecated; use /usr/local/etc/rc.d/
instead; see Starting stuff at boot time and Installing IP Filter 3.3.3 for an
example):
echo " ppp" && ppp -auto myisp
If you were adding this to /usr/local/etc/rc.d/, you would have this
instead:
#!/bin/sh
echo " ppp" && 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 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: