BSD DevCenter
oreilly.comSafari Books Online.Conferences.

advertisement


Connecting to the Internet Using PPP or a Cable Modem
Pages: 1, 2, 3, 4

Dialing the ISP

Now let's see if we can get the modem to dial out. As root, type:



ppp

which will invoke the ppp utility; note that you will lose your prompt when using ppp and it will only accept ppp commands. If you wish to use a regular command prompt, switch to another terminal using the Alt-Fx keys.

To talk to the modem directly, we can use terminal mode, replacing # in the command line below with the number of your COM port minus one:

term /dev/cuaa#

You should see something like this:

deflink: Entering terminal mode on /dev/cuaa#
Type ~? for help.

Modems use something called AT commands to talk with each other; AT commands always start with the letters AT followed by at least two other letters that represent the command. Since we wish to tell the modem to dial a phone number, we use this AT command (replace 1234567 with the phone number to dial):

atdt1234567

You should hear your modem dial and try to connect, followed by a connect message and then by a Login prompt. Enter your username for the ISP, then your password when prompted. You should see something like this:

	Entering PPP Mode.
	IP address is xxx.xxx.xxx.xxx
	MTU is 1524.
ppp
PPp
PPP

If you get the line "PPP" in all caps, you've been successfully authenticated and are now connected to your ISP. To disconnect from your ISP, type:

bye

This will disconnect your modem from the ISP, end the PPP program, and you will receive your regular prompt back.

Automating the PPP connection

You don't need to enter terminal mode every time you wish to dial your ISP. PPP has a configuration file, ppp.conf, that it reads whenever you start it; let's check that this file contains the information needed to connect to the ISP:

pico /etc/ppp/ppp.conf

At the top of the file, you'll see something like this:

default:

#
# Make sure that "device" references the correct serial port
# for your modem. (cuaa0 = COM1, cuaa1 = COM2)
#

set device /dev/cuaa0

That's pretty straightforward; doublecheck that the "set device" line has the correct COM port for your modem and change it if it doesn't.

Let's move further down the file to the section entitled papchap:.

This is the configuration label for PPP to dial; I hate to type more than I need to, so I usually change it to something shorter, such as isp:. Continue down to:

#
# edit the next three lines and replace the items in caps with
# the values which have been assigned by your ISP
#

set phone PHONE_NUM
set authname USERNAME
set authkey PASSWORD

Again, follow the instructions included in the ppp.conf, and replace the words in caps with the actual phone number, username, and password to your ISP. Save your changes and check whether the configuration file is successful by typing:

ppp
dial isp	(or whatever you called your configuration label)

You should hear your modem dial out and connect, and your prompt should automatically change from ppp to Ppp to PPp to PPP. Let's see if we received the necessary information we need to access the Internet from our ISP:

netstat -rnf inet

Resulting in something like:

Destination       Gateway	       Flags    Netif    Expire
default           xxx.xxx.xxx.xxx  UGSc     tun0
xxx.xxx.xxx.xxx   xxx.xxx.xxx.xxx  UH       tun0

The netstat -rnf inet command allows you to view your IPV4 routing table; tun0 is the tunnel device driver your modem uses with PPP. Flags of UG indicate that you have a gateway that is up. The IP address associated with this entry is the address of your default gateway.

You also need at least one DNS server entry to access the Internet, so let's verify you also received one of these from your ISP by typing:

more /etc/resolv.conf

and you should see entries like this:

nameserver 	xxx.xxx.xxx.xxx

If you have at least one entry, you're in business. For one more test, type:

traceroute www.freebsd.org

You should receive back a numbered list of all the routers between you and www.freebsd.org.

Pages: 1, 2, 3, 4

Next Pagearrow





Sponsored by: