Two protocols support connection to the Internet via modem: SLIP (Serial Line Internet Protocol) and PPP (Point to Point Protocol). As the name suggests, SLIP supports only IP. It is an older, less
PPP can perform a number of functions:
FreeBSD provides two versions of PPP:
If you have a DSL link, you don’t have a choice of version: currently, only User PPP supports
The following sections go into some detail about how PPP works. It’s not completely necessary to know it all to set up PPP. If you’re in a hurry, you can move onto the configuration summaries on page 348 for user PPP, or page 359 for kernel PPP.
The following steps are necessary to set up a PPP connection:
Most network interfaces are dedicated to networking. For example, an
The solution may seem a little surprising: PPP uses two different devices for each connection. You decide which serial line you want to use, and the software chooses a network interface for you, though you can override this choice if you're using user PPP. For example, your serial line might be called /dev/cuaa0, /dev/cuaal or /dev/cuaa2, while your interface will be called tun0 or tun1 (for user PPP), or ppp0 or ppp1 (for kernel PPP). It’s possible to connect to a DSL line without PPP, but when you use
The tunnel device uses a device interface called /dev/ton, where n is a digit, to read and write to the other side of the corresponding network interface.
User PPP runs in user space, so it does require a device name for the network interface, for example tun0. It uses this device to read and write to the back end of the tunnel interface.
If you're running a PPP connection over a dial-up link, you'll need to establish a
User PPP includes both built-in dialing support and external dialing support, while kernel PPP supplies only the latter. In practice, the only difference is the way your configuration files look. We’ll look at these when we discuss the individual implementations.
You don't need to dial for a DSL connection.
Once the connection is established and the PPP processes can talk to each other, they
For each feature of the link, PPP
The first step in
In general, systems with login authentication also initiate the
It makes more sense for the called system to start the
Typical features that require
A common configuration problem is when a user enables some form of authentication without first agreeing this with the ISP. For example, very few ISPs perform authentication from their end (to
Which do you choose? Van Jacobson compression works at the TCP level. It compresses only the headers (see page 280 for more details), and the other compression schemes work at the frame level. You can always enable
Compression
Nearly every PPP link requires some kind of identification to confirm that you are authorized to use the link. On UNIX systems, the authentication traditionally consisted of the UNIX login procedure, which also allows you to
Microsoft has changed many things in this area. Their platforms don’t normally support daemons, and in some cases not even multiple users, so the UNIX login method is difficult to implement. Instead, you connect directly to a PPP server and perform authentication directly with it. There are two different (Password Authentication Protocol)and (Challenge Handshake Authentication Protocol). Both perform similar functions. From the PPP point of view, you just need to know which one you are using. Your ISP should tell you this information, but a surprising number don’t seem to know. In case of doubt, accept either of them.
Just to confuse matters, Microsoft has implemented
If you're using PAP or CHAP, you need to specify a system name and an authentication key. These terms may sound complicated, but they're really just a fancy name for a user name and a password. We'll look at how to specify these values when we look at the individual software.
How do you decide whether you use PAP or CHAP? You don’t need to—accept both and let the other end decide which kind to use.
After passing authentication, you may need to
An IP address is an address placed in the source or the destination field in an
The first node is the router at the other end of the PPP link. This is a point-to-point link, so it receives all packets that are sent down the line, so you don’t need to do anything special to ensure it gets them. This is in marked contrast to a router on a broadcast medium like an Ethernet: on an Ethernet you must specify the IP address of the router for it to receive the packets.
In either case, except for testing, it’s very unlikely that you will ever want to address a packet directly to the router, and it’s equally unlikely that the router would know what to do with most kinds of packets if they are addressed to itself. So we don’t really need to care about the address.
What if we set up the wrong address for the other end of the link? Look at the router gw.example.com in the reference network on page 294. Its PPP link has the 139.130.136.133, and the other end has the address 139.130.136.129. What happens if we get the address mixed up and specify the other end as 139.130.129.136? Consider the commands we might enter if we were configuring the interface manually (compare with page 300):
if config tunO 139.130.136.133 139.130.129.136 net mask 255.255.255.255 route add default 139.130.129.133
You need to specify the net mask, because otherwise ifconfig chooses one based on the network address. In this case, it’s class B address, so it would choose 255.255.0.0. This tells the system that the other end of the link is 139.130.129.136, which is incorrect. It then tells the system to route all packets that can't be routed elsewhere to this address (the 139.130.129.136 can be reached by sending the packet out from interface ton0. Its ends the packet down the line.
At this point any memory of the address 139.130.129.136 (or, for that matter, 139.130.136.129) is gone. The packet arrives at the other end, and the router examines it. It still contains only the original
What happens in the other direction? That depends on your configuration. For any packet to get to your system from the Internet, the routing throughout the Internet must point to your system. Now how many lP addresses do you have? If it's only a single IP address (the address of your end of the PPP link), it must be correct. Consider what would happen if you accidentally swapped the last two octets of your local IP address:
# if config tun0 139.130.133.136 139.130.129.136
If gw sends out a packet with this
So how can this still work? Remember that routers don’t change the addresses in the packets they pass. If system bumble sends out a packet, it has the address 223.147.37.3. It passes through the incorrectly configured system gw
In practice, of course, it doesn't make sense to use incorrect IP addresses. If you don't specify an address at either end of the link, PPP can
As we saw on page 290, with a broadcast medium you use a net mask to specify which range of addresses can be addressed directly via the interface. This is a different concept from routing, which specifies ranges of addresses that can be addressed indirectly via the interface. By definition, a point-to-point link only has one address at the other end, so the net mask must be 255.255.255.255.
Traditionally, each interface has had a specific address. With the increase in the size of the Internet, this has caused significant problems: a few years ago, people claimed that the Internet was running out of addresses. As a solution, Version 6 of the Internet Protocol (usually called IPv6) has increased the length of an address from 32 bits to 128 bits, increasing the total number of addresses from $$4,294,967,296$$ to $$3.4x10^38$$—enough to assign multiple IP addresses to every atom on Earth (though there may still be a limitation when the Internet grows across the entire universe). FreeBSD contains full support for IPv6, but unfortunately that’s not true of most ISPs, so at present, IPv6 is not very useful. This book doesn’t discuss it further.
ISPs don’t use IPv6 because they have found another "solution" to the
This may seem unimportant—maybe you consider the possibility of the ISP calling you even dangerous—but consider the advantages. If you're travelling somewhere and need to check on something on your machine at home, you can just connect to it with ssh. If you want to let somebody collect some files from your system, there’s no problem. In practice, however, very few ISPs are prepared to call you, though that doesn't make it a bad idea.
Very frequently, the PPP link is your only connection to the Internet. In this case, you should set the default route to go via the link. You can do this explicitly with the route add command, but both versions of PPP can do it for you.
When you set your
A PPP link over modem typically costs money. You will normally pay some or even all of the following charges:
Typically, the main cost depends on the connection duration. To limit this cost, both PPP implementations supply methods to dial automatically and to disconnect when the line has been idle for a
Whichever PPP implementation you decide upon, you need the following information:
In addition, some ISPs may give you information about the IP addresses and
This chapter contains a lot of information about PPP setup. If you're in a hurry, and you have a "normal" PPP connection, the following steps may be enough to help you set it up. If it doesn’t work, just read on for the in-depth
papchap: (comments omitted) set phone PHONE_NUM only for modem connections set auth name USER_NAME set auth key PASSWORD
Replace the texts PHONE_NUM, USERNAME and PASSWORD with the information supplied by the ISP. If you’re using set phone line.
set device PPPoE:xl0
#User ppp configuration.
ppp_enable="NO" # Start user-ppp (or NO).
ppp_mode="auto" # Choice of "auto", "ddial", "direct" or "dedicated".
#For details see man page for ppp(8). Default is auto.
ppp_nat="YES" # Use PPP's internal network address translation or NO.
ppp_profile="papchap" # Which profile to use from /etc/ppp/ppp.conf.
ppp_user="root" # Which user to run ppp as
Don’t change this file: just add the following line to /etc/rc.conf:
ppp_enable=YES # Start user-ppp (or NO).
ppp_mode=ddial # Choice of "auto", "ddial", "direct" or "dedicated".
This tells PPP not to disconnect at all.
# /usr/sbin/ppp -quiet -auto papchap
If that works for you, you're done. Otherwise, read on.
The user PPP configuration files are in the directory /etc/ppp. In addition to them, you probably want to modify /etc/rc.conf to start PPP and possibly to include global Internet information. The main configuration file is /etc/ppp/ppp.conf. It contains a number of multi-line entries headed by a label. For example, the default entry looks like:
default:
set log Phase Chat LCP IPCP CCP tun command
ident user-ppp VERSION (built COMPILATIONDATE)
# Ensure that "device" references the correct serial port
# for your modem. (cuaa0 = COM1, cuaa1 = COM2)
#
set device /dev/cuaa1 device to use
set speed 115200 connect at 115, 200 bps
set dial "ABORT BUSY ABORT NO\\sCARRIER TIMEOUT 5 \
\"\" AT OK-AT-OK ATE1Q0 OK \\dATDT\\T TIMEOUT 40 CONNECT"
set timeout 180 # 3minute idle timer (the default)
enable dns # request DNS info (for resolv. conf)
Let’s look at this entry in detail.
default: identifies the default entry. This entry is always run when PPP starts. set log line specifies which events to log. This can be helpful if you run into problems. ident line specifies what identification the system will present to the other end of the connection. You don’t need to change it. set device line specifies the device that PPP should use to establish the connection, in this case the second set device PPPoE:xl0
set speed line sets the speed of the link between the modem and the computer. Some older set dial describes a chat script , a series of responses and commands to be exchanged with the modem. enable dns tells PPP to get information about name servers when setting up the link. If the remote site supplies this information, you don't need to set it manually. You should remove this line if you're running a local name server, which I strongly recommend. See Chapter 21, The Domain Name Service, for more details. The default entry alone does not supply enough information to create a link. In particular, it does not specify who to call or what user name or password to use. In addition to the default entry, you need an entry describing how to connect to a specific site. The bare minimum would be the first three set lines of the papchap entry in ppp.conf:
papchap: # #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 set ifaddr 10.0.0.1/0 10.0.0.2/0 255.255.255.0 0.0.0.0 add default HISADDR #Add a (sticky) default route
PPP calls this entry a profile. papchap is the profile supplied in the default installation. You can change the name, for example to the name of your ISP. This is particularly useful if you connect to more than one ISP (for example, with a papchap.
As the comment states, replace the texts PHONE_NUM, USERNAME and PASSWORD with your specific information. If you are using set phone line with a set device line as discussed above.
The last two lines may or may not be needed. The line set ifaddr specifies addresses to assign to each end of the link, and that they can be overridden. This line is seldom needed, even for static addressing: the ISP will almost always allocate the correct address. We'll look at this issue again below when we discuss
Finally, the last line tells ppp to set a HISADDR is a keyword specifying the other end of the link. This is the only way to specify the route for
As we saw on page 342, you need to decide who starts
set openmode passive
User PPP uses four keywords to specify how to
We'll see examples of this in the following sections.
By
enable lqr
The configuration file syntax is the same for FREEBIE, and your key is X4dWg9327, you would include the following lines in your configuration entry:
set authname FREEBIE set authkey X4dWg9327
User PPP accepts requests for
The PPP system name and authentication key for –r-------- and the owner to root, but it's easy and costly to make am is take when changing the configuration. There is an alternative: store the keys in the file /etc/ppp/ppp.secret. Here's a sample:
#Sysname Secret Key Peer's IP address oscar OurSecretKey 192.244.184.34/24 FREEBIE X4dWg9327 192.244.184.33/32 gw localPasswForControl
There are a few things to note here:
# telnet local host 3000
The local password entry matches the host name. See the man page ppp(8) for further details.
If you have to accept dynamic IP addresses, user PPP can help. In fact, it provides fine control over which addresses you accept and which you do not. To allow
set ifaddr 139.130.136.133 139.130.136.129
You can normally maintain some control over the addressing, for example to ensure that the addresses assigned don't confict with other network connections. The addresses assigned to you when the link comes up are almost invariably part of a single subnet. You can specify that subnet and allow 139.130.136, and the address at the other end starts with 139. " You can do this by specifying the number of bits that interest you after the address:
set ifaddr 139.130.136.133/24 139.130.136.129/8
This says that you would prefer the addresses you state, but that you require the first 24 bits of the local interface address and the first eight bits of the remote interface address to be as stated.
If you really don't care which address you get, specify the local IP address as 0:
set ifaddr 0 0
If you do this, you can't use the -auto modes, because you need to send a packet to the interface to trigger dialing. Use one of the previous methods in this situation.
After setting up your PPP configuration, run it like this:
$ ppp Working in interactive mode Using interface: tun0 ppp ON freebie> dial papchap this is the name of the entry in ppp.conf Dial attempt 1 of 1 Phone: 1234567 the phone number dial OK! modem connection established login OK! authentication complete ppp ON freebie> Packet mode. PPP is running ppp ON freebie> PPP ON freebie> and the network connection is complete
You'll notice that the prompt (ppp) changes to PPP) when the connection is up and running. At the same time, ppp writes some messages to the log file /var/log/ppp.log:
Sep 2 15:12:38 freebie ppp[23679]: Phase: Using interface: tun0 Sep 2 15:12:38 freebie ppp[23679]: Phase: PPP Started. Sep 2 15:12:47 freebie ppp[23679]: Phase: Phone: 1234567 Sep 2 15:13:08 freebie ppp[23679]: Phase: *Connected! Sep 2 15:13:11 freebie ppp[23679]: Phase: NewPhase: Authenticate Sep 2 15:13:11 freebie ppp[23679]: Phase: his = c223, mine = 0 Sep 2 15:13:11 freebie ppp[23679]: Phase: Valsize = 16, Name = way3.Adelaide Sep 2 15:13:11 freebie ppp[23679]: Phase: NewPhase: Network Sep 2 15:13:11 freebie ppp[23679]: Phase: Unknown protocol 0x8207 Sep 2 15:13:11 freebie ppp[23679]: Link: myaddr = 139.130.136.133 hisaddr = 139.1 30.136.129 Sep 2 15:13:11 freebie ppp[23679]: Link: OsLinkup: 139.130.136.129 Sep 2 15:14:11 freebie ppp[23679]: Phase: HDLC errors -> FCS: 0 ADDR: 0 COMD: 0 PRO TO: 1
You'll notice a couple of messages that look like errors. In fact, they're not: Unknown protocol 0x8207 means that
the other end requested a protocol that ppp doesn’t know (and, in fact, is not in the RFCs. This is a real example, and the protocol is in fact Novell's lPX). The other message is . In fact, this relates to the same " problem. "
The following entries in /etc/defaults/rc.conf relate to user ppp:
#User ppp configuration.
ppp_enable="NO" # Start user-ppp (or NO).
ppp_mode="auto" # Choice of "auto", "ddial", "direct" or "dedicated".
#For details see man page for ppp(8). Default is auto.
ppp_nat="YES" # Use PPP's internal network address translation or NO.
ppp_profile="papchap" # Which profile to use from /etc/ppp/ppp. conf.
ppp_user="root" # Which user to run ppp as
Now our PPP connection is up and running. How do we stop it again? There are two possibilities:
close:
PPP ON freebie> close ppp ON freebie>
q or quit:
PPP ON freebie> q #
There are a couple of problems with this method: first, a connection to an ISP usually costs money in
set timeout 300
This sets the idle timeout to 300 seconds (5 minutes).
Finally, setting up the connection this way takes a lot of time. You can automate it in a number of ways:
-ddial modifier:
$ ppp -ddial papchap
Again, papchap is the name of the PPP profile. This version dials immediately and keeps the connection up regardless of whether traffic is passing or not.
-auto modifer:
$ ppp -auto papchap
In this case, user PPP does not dial immediately. As soon as you attempt to send data to the Net, however, it dials automatically. When the line has been idle for the idle timeout period, it disconnects again and waits for more data before dialing. This only makes sense for static addresses or when you know that no IP connections remain alive after the line disconnects.
$ ppp -background papchap
The -background option tells user PPP to dial immediately and stay in the background. After the idle timeout period, the user PPP process disconnects and exits. If you want to connect again, you must restart the process.
If you don’t have a papchap in our examples) and executes the commands in that section. Use the !) to specify that the commands should be performed by a shell. For example, to flush your mail queue, you might write:
papchap: !send mail -q
Similarly, you can create a file /etc/ppp/ppp.linkdown with commands to be executed when the link goes down. You can find sample files in the directory /usr/share/examples/ppp.
Things don’t always work " out of the box. " You could run into a number of problems. We’ll look at the more common ones on page 361.
It makes more sense to run PPP in the kernel than in user space: in the kernel it's more efficient and
The configuration files for kernel PPP are in the same directory as the user PPP configuration files. You can also set up your own ?/.ppprc file, though I don't recommend this: PPP is a
Kernel PPP uses a daemon called pppd to monitor the line when it is active. Kernel PPP interface names start with ppp followed by a number. You need one for each concurrent link. You don’t need to specifically build a kernel for the ppp interface: FreeBSD Release 5 loads the PPP module /boot/kernel/if_ppp.ko dynamically and adds interfaces as required. This also means that you can no longer check for ppp support with the ifconfig command. The interface won't bet here until you need it.
Kernel PPP used to provide a number of build options to enable some features, including the compression options described below. The options are still there, but they're set by default, so you don’t need to do anything there either.
When kernel PPP starts, it reads its configuration from the file /etc/ppp/options. Here is a typical example:
#Options file for PPPD defaultroute set the default route here when the line comes up crtscts use hard ware flow control modem use modem control lines deflate 12, 12 use deflate compression predictorl use predictor 1 compression vj-max-slots 16 Van Jacobson compression slots user FREEBIE our name (index in password file) lock create a UUCP lock file
This is quite a short file, but it’s full of interesting stuff:
defaultroute line tells the kernel PPP to set the xonxoff, which uses software modem line says to monitor the modem DCD (deflate tells kernel PPP to request deflate compression, which can increase the effective bandwidth. predictor1 tells PPP to use Predictor1 compression where possible. vj-max-slots specifies how many slots to use for Van Jacobson header compression. Having more slots can speed things up. user line tells kernel PPP the user ID to use. If you don’t specify this, it takes the system’s name. lock tells kernel PPP to create a UUCP-style lock on the serial line. This prevents other programs, such as getty, from trying to open the line while it is running PPP. None of these options are required to run pppd, though you'll probably need a user entry to establish connection. It’s good idea to set the indicated options, however.
We've seen that /etc/ppp/options contains a user name, but no password. The passwords are stored in separate files, /etc/ppp/chap-secrets for
username systemname password
To match any system name, set systemname to *. For example, to authenticate the FREEBIE we saw on page 351, we would enter the following in the file:
FREEBIE * X4dWg9327
In addition, you should add a domain line to specify your domain for authentication purposes:
domain example.org
Kernel PPP does not perform dialing, so you need to start a program that does the dialing. In the following example, we use chat, a program derived from UUCP intended exactly for this purpose. Some people use kermit, which is in fact a complete chat does the whole job for you.
chat uses a to define the functions to perform when establishing a connection. See the man page chat(8) for further details. The expect strings, which chat waits to receive, followed by send strings, which chat sends when it receives the expect string.
In addition to these strings, the chat does not pay any attention to line breaks. Our
#Abort the chat script if the modem replies BUSY or NO CARRIER ABORT BUSY ABORT 'NO CARRIER' #Wait up to 5 seconds for the reply to each of these TIMEOUT 5 " ATZ OK ATDT1234567 #Wait 40 seconds for connection TIMEOUT 40 CONNECT
This script first tells chat to abort dial-up on a BUSY or NO CARRIER response from the modem. The next line waits for nothing (") and resets the modem with the command ATZ. The following line waits for the modem to reply with OK, and dials the ISP.
CONNECT from the modem.
On page 342 we saw how to specify whether we should start negotiating or whether we should wait for the other end to start. By default, kernel PPP starts passive in your /etc/ppp/options file.
By default, kernel PPP performs
139.130.136.133:139.130.136.129
These are the addresses that you would use on machine gw.example.org to set up the PPP link in the middle of Figure 16-7 on page 294. The first address is the local end of the link (the address of the pppn device), and the second is the address of the remote machine (free-gw.example.net).
To run pppd, enter:
# pppd /dev/cuaal 115200 connect 'chat -f /etc/ppp/dial. chat'
This starts kernel PPP on the serial line /dev/cuaal at 115, 200 connect tells kernel PPP that the following argument is the name of a program to execute: it runs chat with the options -f /etc/ppp/dial.chat, which tells chat the name of the chat file.
After you run pppd with these arguments, the modem starts dialing and then ifconfig command:
$ if config ppp0
ppp0: flags=8010<POINTOPOINT, MULTICAST> mtu 1500
at this point, the interface has not yet started
$ if config ppp0
ppp0: flags=8810<POINTOPOINT, RUNNING, MULTICAST> mtu 1500
now the interface has been started
$ if config ppp0
ppp0: flags=8811<UP, POINTOPOINT, RUNNING, MULTICAST> mtu 1500
inet 139.130.136.133 --> 139.130.136.129 netmask 0xffffffff
now the connection has been established
You can automate connection setup and disconnection in a number of ways:
persist
If this option is set, kernel PPP dials immediately and keeps the connection up regardless of whether traffic is passing or not.
demand option:
demand
In this case, kernel PPP does not dial immediately. As soon as you attempt to send data to the net, however, it dials automatically. When the line has been idle for the idle timeout period, it disconnects again and waits for more data before dialing.
A number of options specify when kernel PPP should dial and disconnect:
idle parameter tells kernel PPP to disconnect if the line has been idle for the specified number of seconds, and if persist (see above)has not been specified. For example, to disconnect after five minutes, you could add the following line to the /etc/ppp/options file:
idle 300
active-filter parameter allows you to specify which packets to count when determining whether the line is idle. See the man page for more details. hold off parameter tells kernel PPP how long to wait before demand, it dials as soon as the next valid packet is received. To
#Options file for PPPD defaultroute set the default route here when the line comes up crtscts use hardware flow control modem use modem control lines domain example.org specify your domain name persist stay up all the time deflate 12,12 use deflate compression predictorl use predictor 1 compression vj-max-slots 16 Van Jacobson compression slots user FREEBIE name to present to ISP 139.130.136.133:139.130.136.129 specify IP addresses of link
/etc/ppp/dial.chat is
#Abort the chat script if the modem replies BUSY or NO CARRIER ABCRT BUSY ABORT 'NO CARRIER' #Wait up to 5 seconds for the reply to each of these TIMEOUT 5 '' ATZ OK ATDT1234567 #Wait 40 seconds for connection TIMEOUT 40 CONNECT
/etc/ppp/chap-secrets contains:
FREEBIE * X4dWg9327
With kernel PPP, there's no need to disable PAP: that happens automatically if it can't find an authentication for FREEBIE in /etc/pap-secrets.
The change for
#Options file for PPPD defaultroute set the default route here when the line comes up crtscts use hardware flow control modem use modem control lines domain example.org specify your domain name persist stay up all the time deflate 12,12 use deflate compression predictorl use predictor 1 compression vj-max-slots 16 Van Jacobson compression slots user FREEBIE name to present to ISP
If you don’t have a
send mail -q
Setting up PPP used to be a pain. Two things have made it easier than it used to be. Firstly, the widespread adoption of
The first thing you need to do is to dial the connection. If you have an
OH LED ("offhook") goes on, indicating that the modem is dialing. If this doesn’t happen, check the cables and that you're talking to the right device. RD and TD LEDs. If that doesn’t happen, you may also have cable problems, or it could be a problem with the CD (or DCD ) LED goes on, you have a connection to the Two protocols support connection to the Internet via modem: SLIP (Serial Line Internet Protocol) and PPP (Point to Point Protocol). As the name suggests, SLIP supports only IP. It is an older, less
PPP can perform a number of functions:
FreeBSD provides two versions of PPP:
If you have a DSL link, you don’t have a choice of version: currently, only User PPP supports
The following sections go into some detail about how PPP works. It’s not completely necessary to know it all to set up PPP. If you’re in a hurry, you can move onto the configuration summaries on page 348 for user PPP, or page 359 for kernel PPP.
The following steps are necessary to set up a PPP connection:
Most network interfaces are dedicated to networking. For example, an
The solution may seem a little surprising: PPP uses two different devices for each connection. You decide which serial line you want to use, and the software chooses a network interface for you, though you can override this choice if you're using user PPP. For example, your serial line might be called /dev/cuaa0, /dev/cuaal or /dev/cuaa2, while your interface will be called tun0 or tun1 (for user PPP), or ppp0 or ppp1 (for kernel PPP). It’s possible to connect to a DSL line without PPP, but when you use
The tunnel device uses a device interface called /dev/ton, where n is a digit, to read and write to the other side of the corresponding network interface.
User PPP runs in user space, so it does require a device name for the network interface, for example tun0. It uses this device to read and write to the back end of the tunnel interface.
If you're running a PPP connection over a dial-up link, you'll need to establish a
User PPP includes both built-in dialing support and external dialing support, while kernel PPP supplies only the latter. In practice, the only difference is the way your configuration files look. We’ll look at these when we discuss the individual implementations.
You don't need to dial for a DSL connection.
Once the connection is established and the PPP processes can talk to each other, they
For each feature of the link, PPP
The first step in
In general, systems with login authentication also initiate the
It makes more sense for the called system to start the
Typical features that require
A common configuration problem is when a user enables some form of authentication without first agreeing this with the ISP. For example, very few ISPs perform authentication from their end (to
Which do you choose? Van Jacobson compression works at the TCP level. It compresses only the headers (see page 280 for more details), and the other compression schemes work at the frame level. You can always enable
Compression
Nearly every PPP link requires some kind of identification to confirm that you are authorized to use the link. On UNIX systems, the authentication traditionally consisted of the UNIX login procedure, which also allows you to
Microsoft has changed many things in this area. Their platforms don’t normally support daemons, and in some cases not even multiple users, so the UNIX login method is difficult to implement. Instead, you connect directly to a PPP server and perform authentication directly with it. There are two different (Password Authentication Protocol)and (Challenge Handshake Authentication Protocol). Both perform similar functions. From the PPP point of view, you just need to know which one you are using. Your ISP should tell you this information, but a surprising number don’t seem to know. In case of doubt, accept either of them.
Just to confuse matters, Microsoft has implemented
If you're using PAP or CHAP, you need to specify a system name and an authentication key. These terms may sound complicated, but they're really just a fancy name for a user name and a password. We'll look at how to specify these values when we look at the individual software.
How do you decide whether you use PAP or CHAP? You don’t need to—accept both and let the other end decide which kind to use.
After passing authentication, you may need to
An IP address is an address placed in the source or the destination field in an
The first node is the router at the other end of the PPP link. This is a point-to-point link, so it receives all packets that are sent down the line, so you don’t need to do anything special to ensure it gets them. This is in marked contrast to a router on a broadcast medium like an Ethernet: on an Ethernet you must specify the IP address of the router for it to receive the packets.
In either case, except for testing, it’s very unlikely that you will ever want to address a packet directly to the router, and it’s equally unlikely that the router would know what to do with most kinds of packets if they are addressed to itself. So we don’t really need to care about the address.
What if we set up the wrong address for the other end of the link? Look at the router gw.example.com in the reference network on page 294. Its PPP link has the 139.130.136.133, and the other end has the address 139.130.136.129. What happens if we get the address mixed up and specify the other end as 139.130.129.136? Consider the commands we might enter if we were configuring the interface manually (compare with page 300):
if config tunO 139.130.136.133 139.130.129.136 net mask 255.255.255.255 route add default 139.130.129.133
You need to specify the net mask, because otherwise ifconfig chooses one based on the network address. In this case, it’s class B address, so it would choose 255.255.0.0. This tells the system that the other end of the link is 139.130.129.136, which is incorrect. It then tells the system to route all packets that can't be routed elsewhere to this address (the 139.130.129.136 can be reached by sending the packet out from interface ton0. Its ends the packet down the line.
At this point any memory of the address 139.130.129.136 (or, for that matter, 139.130.136.129) is gone. The packet arrives at the other end, and the router examines it. It still contains only the original
What happens in the other direction? That depends on your configuration. For any packet to get to your system from the Internet, the routing throughout the Internet must point to your system. Now how many lP addresses do you have? If it's only a single IP address (the address of your end of the PPP link), it must be correct. Consider what would happen if you accidentally swapped the last two octets of your local IP address:
# if config tun0 139.130.133.136 139.130.129.136
If gw sends out a packet with this
So how can this still work? Remember that routers don’t change the addresses in the packets they pass. If system bumble sends out a packet, it has the address 223.147.37.3. It passes through the incorrectly configured system gw
In practice, of course, it doesn't make sense to use incorrect IP addresses. If you don't specify an address at either end of the link, PPP can
As we saw on page 290, with a broadcast medium you use a net mask to specify which range of addresses can be addressed directly via the interface. This is a different concept from routing, which specifies ranges of addresses that can be addressed indirectly via the interface. By definition, a point-to-point link only has one address at the other end, so the net mask must be 255.255.255.255.
Traditionally, each interface has had a specific address. With the increase in the size of the Internet, this has caused significant problems: a few years ago, people claimed that the Internet was running out of addresses. As a solution, Version 6 of the Internet Protocol (usually called IPv6) has increased the length of an address from 32 bits to 128 bits, increasing the total number of addresses from $$4,294,967,296$$ to $$3.4x10^38$$—enough to assign multiple IP addresses to every atom on Earth (though there may still be a limitation when the Internet grows across the entire universe). FreeBSD contains full support for IPv6, but unfortunately that’s not true of most ISPs, so at present, IPv6 is not very useful. This book doesn’t discuss it further.
ISPs don’t use IPv6 because they have found another "solution" to the
This may seem unimportant—maybe you consider the possibility of the ISP calling you even dangerous—but consider the advantages. If you're travelling somewhere and need to check on something on your machine at home, you can just connect to it with ssh. If you want to let somebody collect some files from your system, there’s no problem. In practice, however, very few ISPs are prepared to call you, though that doesn't make it a bad idea.
Very frequently, the PPP link is your only connection to the Internet. In this case, you should set the default route to go via the link. You can do this explicitly with the route add command, but both versions of PPP can do it for you.
When you set your
A PPP link over modem typically costs money. You will normally pay some or even all of the following charges:
Typically, the main cost depends on the connection duration. To limit this cost, both PPP implementations supply methods to dial automatically and to disconnect when the line has been idle for a
Whichever PPP implementation you decide upon, you need the following information:
In addition, some ISPs may give you information about the IP addresses and
This chapter contains a lot of information about PPP setup. If you're in a hurry, and you have a "normal" PPP connection, the following steps may be enough to help you set it up. If it doesn’t work, just read on for the in-depth
papchap: (comments omitted) set phone PHONE_NUM only for modem connections set auth name USER_NAME set auth key PASSWORD
Replace the texts PHONE_NUM, USERNAME and PASSWORD with the information supplied by the ISP. If you’re using set phone line.
set device PPPoE:xl0
#User ppp configuration.
ppp_enable="NO" # Start user-ppp (or NO).
ppp_mode="auto" # Choice of "auto", "ddial", "direct" or "dedicated".
#For details see man page for ppp(8). Default is auto.
ppp_nat="YES" # Use PPP's internal network address translation or NO.
ppp_profile="papchap" # Which profile to use from /etc/ppp/ppp.conf.
ppp_user="root" # Which user to run ppp as
Don’t change this file: just add the following line to /etc/rc.conf:
ppp_enable=YES # Start user-ppp (or NO).
ppp_mode=ddial # Choice of "auto", "ddial", "direct" or "dedicated".
This tells PPP not to disconnect at all.
# /usr/sbin/ppp -quiet -auto papchap
If that works for you, you're done. Otherwise, read on.
The user PPP configuration files are in the directory /etc/ppp. In addition to them, you probably want to modify /etc/rc.conf to start PPP and possibly to include global Internet information. The main configuration file is /etc/ppp/ppp.conf. It contains a number of multi-line entries headed by a label. For example, the default entry looks like:
default:
set log Phase Chat LCP IPCP CCP tun command
ident user-ppp VERSION (built COMPILATIONDATE)
# Ensure that "device" references the correct serial port
# for your modem. (cuaa0 = COM1, cuaa1 = COM2)
#
set device /dev/cuaa1 device to use
set speed 115200 connect at 115, 200 bps
set dial "ABORT BUSY ABORT NO\\sCARRIER TIMEOUT 5 \
\"\" AT OK-AT-OK ATE1Q0 OK \\dATDT\\T TIMEOUT 40 CONNECT"
set timeout 180 # 3minute idle timer (the default)
enable dns # request DNS info (for resolv. conf)
Let’s look at this entry in detail.
default: identifies the default entry. This entry is always run when PPP starts. set log line specifies which events to log. This can be helpful if you run into problems. ident line specifies what identification the system will present to the other end of the connection. You don’t need to change it. set device line specifies the device that PPP should use to establish the connection, in this case the second set device PPPoE:xl0
set speed line sets the speed of the link between the modem and the computer. Some older set dial describes a chat script , a series of responses and commands to be exchanged with the modem. enable dns tells PPP to get information about name servers when setting up the link. If the remote site supplies this information, you don't need to set it manually. You should remove this line if you're running a local name server, which I strongly recommend. See Chapter 21, The Domain Name Service, for more details. The default entry alone does not supply enough information to create a link. In particular, it does not specify who to call or what user name or password to use. In addition to the default entry, you need an entry describing how to connect to a specific site. The bare minimum would be the first three set lines of the papchap entry in ppp.conf:
papchap: # #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 set ifaddr 10.0.0.1/0 10.0.0.2/0 255.255.255.0 0.0.0.0 add default HISADDR #Add a (sticky) default route
PPP calls this entry a profile. papchap is the profile supplied in the default installation. You can change the name, for example to the name of your ISP. This is particularly useful if you connect to more than one ISP (for example, with a papchap.
As the comment states, replace the texts PHONE_NUM, USERNAME and PASSWORD with your specific information. If you are using set phone line with a set device line as discussed above.
The last two lines may or may not be needed. The line set ifaddr specifies addresses to assign to each end of the link, and that they can be overridden. This line is seldom needed, even for static addressing: the ISP will almost always allocate the correct address. We'll look at this issue again below when we discuss
Finally, the last line tells ppp to set a HISADDR is a keyword specifying the other end of the link. This is the only way to specify the route for
As we saw on page 342, you need to decide who starts
set openmode passive
User PPP uses four keywords to specify how to
We'll see examples of this in the following sections.
By
enable lqr
The configuration file syntax is the same for FREEBIE, and your key is X4dWg9327, you would include the following lines in your configuration entry:
set authname FREEBIE set authkey X4dWg9327
User PPP accepts requests for
The PPP system name and authentication key for –r-------- and the owner to root, but it's easy and costly to make am is take when changing the configuration. There is an alternative: store the keys in the file /etc/ppp/ppp.secret. Here's a sample:
#Sysname Secret Key Peer's IP address oscar OurSecretKey 192.244.184.34/24 FREEBIE X4dWg9327 192.244.184.33/32 gw localPasswForControl
There are a few things to note here:
# telnet local host 3000
The local password entry matches the host name. See the man page ppp(8) for further details.
If you have to accept dynamic IP addresses, user PPP can help. In fact, it provides fine control over which addresses you accept and which you do not. To allow
set ifaddr 139.130.136.133 139.130.136.129
You can normally maintain some control over the addressing, for example to ensure that the addresses assigned don't confict with other network connections. The addresses assigned to you when the link comes up are almost invariably part of a single subnet. You can specify that subnet and allow 139.130.136, and the address at the other end starts with 139. " You can do this by specifying the number of bits that interest you after the address:
set ifaddr 139.130.136.133/24 139.130.136.129/8
This says that you would prefer the addresses you state, but that you require the first 24 bits of the local interface address and the first eight bits of the remote interface address to be as stated.
If you really don't care which address you get, specify the local IP address as 0:
set ifaddr 0 0
If you do this, you can't use the -auto modes, because you need to send a packet to the interface to trigger dialing. Use one of the previous methods in this situation.
After setting up your PPP configuration, run it like this:
$ ppp Working in interactive mode Using interface: tun0 ppp ON freebie> dial papchap this is the name of the entry in ppp.conf Dial attempt 1 of 1 Phone: 1234567 the phone number dial OK! modem connection established login OK! authentication complete ppp ON freebie> Packet mode. PPP is running ppp ON freebie> PPP ON freebie> and the network connection is complete
You'll notice that the prompt (ppp) changes to PPP) when the connection is up and running. At the same time, ppp writes some messages to the log file /var/log/ppp.log:
Sep 2 15:12:38 freebie ppp[23679]: Phase: Using interface: tun0 Sep 2 15:12:38 freebie ppp[23679]: Phase: PPP Started. Sep 2 15:12:47 freebie ppp[23679]: Phase: Phone: 1234567 Sep 2 15:13:08 freebie ppp[23679]: Phase: *Connected! Sep 2 15:13:11 freebie ppp[23679]: Phase: NewPhase: Authenticate Sep 2 15:13:11 freebie ppp[23679]: Phase: his = c223, mine = 0 Sep 2 15:13:11 freebie ppp[23679]: Phase: Valsize = 16, Name = way3.Adelaide Sep 2 15:13:11 freebie ppp[23679]: Phase: NewPhase: Network Sep 2 15:13:11 freebie ppp[23679]: Phase: Unknown protocol 0x8207 Sep 2 15:13:11 freebie ppp[23679]: Link: myaddr = 139.130.136.133 hisaddr = 139.1 30.136.129 Sep 2 15:13:11 freebie ppp[23679]: Link: OsLinkup: 139.130.136.129 Sep 2 15:14:11 freebie ppp[23679]: Phase: HDLC errors -> FCS: 0 ADDR: 0 COMD: 0 PRO TO: 1
You'll notice a couple of messages that look like errors. In fact, they're not: Unknown protocol 0x8207 means that
the other end requested a protocol that ppp doesn’t know (and, in fact, is not in the RFCs. This is a real example, and the protocol is in fact Novell's lPX). The other message is . In fact, this relates to the same " problem. "
The following entries in /etc/defaults/rc.conf relate to user ppp:
#User ppp configuration.
ppp_enable="NO" # Start user-ppp (or NO).
ppp_mode="auto" # Choice of "auto", "ddial", "direct" or "dedicated".
#For details see man page for ppp(8). Default is auto.
ppp_nat="YES" # Use PPP's internal network address translation or NO.
ppp_profile="papchap" # Which profile to use from /etc/ppp/ppp. conf.
ppp_user="root" # Which user to run ppp as
Now our PPP connection is up and running. How do we stop it again? There are two possibilities:
close:
PPP ON freebie> close ppp ON freebie>
q or quit:
PPP ON freebie> q #
There are a couple of problems with this method: first, a connection to an ISP usually costs money in
set timeout 300
This sets the idle timeout to 300 seconds (5 minutes).
Finally, setting up the connection this way takes a lot of time. You can automate it in a number of ways:
-ddial modifier:
$ ppp -ddial papchap
Again, papchap is the name of the PPP profile. This version dials immediately and keeps the connection up regardless of whether traffic is passing or not.
-auto modifer:
$ ppp -auto papchap
In this case, user PPP does not dial immediately. As soon as you attempt to send data to the Net, however, it dials automatically. When the line has been idle for the idle timeout period, it disconnects again and waits for more data before dialing. This only makes sense for static addresses or when you know that no IP connections remain alive after the line disconnects.
$ ppp -background papchap
The -background option tells user PPP to dial immediately and stay in the background. After the idle timeout period, the user PPP process disconnects and exits. If you want to connect again, you must restart the process.
If you don’t have a papchap in our examples) and executes the commands in that section. Use the !) to specify that the commands should be performed by a shell. For example, to flush your mail queue, you might write:
papchap: !send mail -q
Similarly, you can create a file /etc/ppp/ppp.linkdown with commands to be executed when the link goes down. You can find sample files in the directory /usr/share/examples/ppp.
Things don’t always work " out of the box. " You could run into a number of problems. We’ll look at the more common ones on page 361.
It makes more sense to run PPP in the kernel than in user space: in the kernel it's more efficient and
The configuration files for kernel PPP are in the same directory as the user PPP configuration files. You can also set up your own ?/.ppprc file, though I don't recommend this: PPP is a
Kernel PPP uses a daemon called pppd to monitor the line when it is active. Kernel PPP interface names start with ppp followed by a number. You need one for each concurrent link. You don’t need to specifically build a kernel for the ppp interface: FreeBSD Release 5 loads the PPP module /boot/kernel/if_ppp.ko dynamically and adds interfaces as required. This also means that you can no longer check for ppp support with the ifconfig command. The interface won't bet here until you need it.
Kernel PPP used to provide a number of build options to enable some features, including the compression options described below. The options are still there, but they're set by default, so you don’t need to do anything there either.
When kernel PPP starts, it reads its configuration from the file /etc/ppp/options. Here is a typical example:
#Options file for PPPD defaultroute set the default route here when the line comes up crtscts use hard ware flow control modem use modem control lines deflate 12, 12 use deflate compression predictorl use predictor 1 compression vj-max-slots 16 Van Jacobson compression slots user FREEBIE our name (index in password file) lock create a UUCP lock file
This is quite a short file, but it’s full of interesting stuff:
defaultroute line tells the kernel PPP to set the xonxoff, which uses software modem line says to monitor the modem DCD (deflate tells kernel PPP to request deflate compression, which can increase the effective bandwidth. predictor1 tells PPP to use Predictor1 compression where possible. vj-max-slots specifies how many slots to use for Van Jacobson header compression. Having more slots can speed things up. user line tells kernel PPP the user ID to use. If you don’t specify this, it takes the system’s name. lock tells kernel PPP to create a UUCP-style lock on the serial line. This prevents other programs, such as getty, from trying to open the line while it is running PPP. None of these options are required to run pppd, though you'll probably need a user entry to establish connection. It’s good idea to set the indicated options, however.
We've seen that /etc/ppp/options contains a user name, but no password. The passwords are stored in separate files, /etc/ppp/chap-secrets for
username systemname password
To match any system name, set systemname to *. For example, to authenticate the FREEBIE we saw on page 351, we would enter the following in the file:
FREEBIE * X4dWg9327
In addition, you should add a domain line to specify your domain for authentication purposes:
domain example.org
Kernel PPP does not perform dialing, so you need to start a program that does the dialing. In the following example, we use chat, a program derived from UUCP intended exactly for this purpose. Some people use kermit, which is in fact a complete chat does the whole job for you.
chat uses a to define the functions to perform when establishing a connection. See the man page chat(8) for further details. The expect strings, which chat waits to receive, followed by send strings, which chat sends when it receives the expect string.
In addition to these strings, the chat does not pay any attention to line breaks. Our
#Abort the chat script if the modem replies BUSY or NO CARRIER ABORT BUSY ABORT 'NO CARRIER' #Wait up to 5 seconds for the reply to each of these TIMEOUT 5 " ATZ OK ATDT1234567 #Wait 40 seconds for connection TIMEOUT 40 CONNECT
This script first tells chat to abort dial-up on a BUSY or NO CARRIER response from the modem. The next line waits for nothing (") and resets the modem with the command ATZ. The following line waits for the modem to reply with OK, and dials the ISP.
CONNECT from the modem.
On page 342 we saw how to specify whether we should start negotiating or whether we should wait for the other end to start. By default, kernel PPP starts passive in your /etc/ppp/options file.
By default, kernel PPP performs
139.130.136.133:139.130.136.129
These are the addresses that you would use on machine gw.example.org to set up the PPP link in the middle of Figure 16-7 on page 294. The first address is the local end of the link (the address of the pppn device), and the second is the address of the remote machine (free-gw.example.net).
To run pppd, enter:
# pppd /dev/cuaal 115200 connect 'chat -f /etc/ppp/dial. chat'
This starts kernel PPP on the serial line /dev/cuaal at 115, 200 connect tells kernel PPP that the following argument is the name of a program to execute: it runs chat with the options -f /etc/ppp/dial.chat, which tells chat the name of the chat file.
After you run pppd with these arguments, the modem starts dialing and then ifconfig command:
$ if config ppp0
ppp0: flags=8010<POINTOPOINT, MULTICAST> mtu 1500
at this point, the interface has not yet started
$ if config ppp0
ppp0: flags=8810<POINTOPOINT, RUNNING, MULTICAST> mtu 1500
now the interface has been started
$ if config ppp0
ppp0: flags=8811<UP, POINTOPOINT, RUNNING, MULTICAST> mtu 1500
inet 139.130.136.133 --> 139.130.136.129 netmask 0xffffffff
now the connection has been established
You can automate connection setup and disconnection in a number of ways:
persist
If this option is set, kernel PPP dials immediately and keeps the connection up regardless of whether traffic is passing or not.
demand option:
demand
In this case, kernel PPP does not dial immediately. As soon as you attempt to send data to the net, however, it dials automatically. When the line has been idle for the idle timeout period, it disconnects again and waits for more data before dialing.
A number of options specify when kernel PPP should dial and disconnect:
idle parameter tells kernel PPP to disconnect if the line has been idle for the specified number of seconds, and if persist (see above)has not been specified. For example, to disconnect after five minutes, you could add the following line to the /etc/ppp/options file:
idle 300
active-filter parameter allows you to specify which packets to count when determining whether the line is idle. See the man page for more details. hold off parameter tells kernel PPP how long to wait before demand, it dials as soon as the next valid packet is received. To
#Options file for PPPD defaultroute set the default route here when the line comes up crtscts use hardware flow control modem use modem control lines domain example.org specify your domain name persist stay up all the time deflate 12,12 use deflate compression predictorl use predictor 1 compression vj-max-slots 16 Van Jacobson compression slots user FREEBIE name to present to ISP 139.130.136.133:139.130.136.129 specify IP addresses of link
/etc/ppp/dial.chat is
#Abort the chat script if the modem replies BUSY or NO CARRIER ABCRT BUSY ABORT 'NO CARRIER' #Wait up to 5 seconds for the reply to each of these TIMEOUT 5 '' ATZ OK ATDT1234567 #Wait 40 seconds for connection TIMEOUT 40 CONNECT
/etc/ppp/chap-secrets contains:
FREEBIE * X4dWg9327
With kernel PPP, there's no need to disable PAP: that happens automatically if it can't find an authentication for FREEBIE in /etc/pap-secrets.
The change for
#Options file for PPPD defaultroute set the default route here when the line comes up crtscts use hardware flow control modem use modem control lines domain example.org specify your domain name persist stay up all the time deflate 12,12 use deflate compression predictorl use predictor 1 compression vj-max-slots 16 Van Jacobson compression slots user FREEBIE name to present to ISP
If you don’t have a
send mail -q
Setting up PPP used to be a pain. Two things have made it easier than it used to be. Firstly, the widespread adoption of
The first thing you need to do is to dial the connection. If you have an
OH LED ("offhook") goes on, indicating that the modem is dialing. If this doesn’t happen, check the cables and that you're talking to the right device. RD and TD LEDs. If that doesn’t happen, you may also have cable problems, or it could be a problem with the CD (or DCD ) LED goes on, you have a connection to the Для получения официальных документов о завершении программы дополнительного профессионального образования (удостоверения о повышении квалификации, дипломов о профессиональной переподготовке и MBA) необходимо предоставить:
Внимание! Вы можете не заказывать доставку бумажной версии официального документы, а скачать его в электронном виде и распечатать самостоятельно. Информация о выданном документе в течение 1 месяца загружается в Федеральную информационную систему «Федеральный реестр сведений о документах об образовании и (или) о квалификации, документах об обучении» - ФИС ФРДО.
Доступ на новый сайт осуществляется с использованием адреса электронной почты, который был указан вами при регистрации на "старом". Мы постарались перенести все ваши данные с прежнего ресурса, однако не исключена вероятность потери части информации.
При возникновении проблемы со входом, воспользуйтесь функцией сброса пароля
Если вы обнаружите несоответствия, пожалуйста, сообщите нам.