As an introductory example of how to establish a PPP connection with pppd, assume you are at vlager again. You have already dialed up the PPP server, c3po, and logged into the ppp account. c3po has already fired up its PPP driver. After exiting the communications program you used for dialing, you execute the following command:
# pppd /dev/cua3 38400 crtscts defaultrouteThis will flip the serial line cua3 to PPP mode and establish an IP-link to c3po. The transfer speed used on the serial port will be 38400bps. The crtscts option turns on hardware handshake on the port, which is an absolute must at speeds above 9600-bps.
The first thing pppd does after starting up is to negotiate several link characteristics with the remote end, using LCP. Usually, the default set of options pppd tries to negotiate will work, so we won't go into this here. We will return to LCP in more detail in some later section.
For the time being, we also assume that c3po doesn't require any authentication from us, so that the configuration phase is completed successfully.
pppd will then negotiate the IP parameters with its peer using IPCP, the IP control protocol. Since we didn't specify any particular IP-address to pppd above, it will try to use the address obtained by having the resolver look up the local hostname. Both will then announce their address to each other.
Usually, there's nothing wrong with these defaults. Even if your machine is on an Ethernet, you can use the same IP-address for both the Ethernet and the PPP interface. Nevertheless, pppd allows you to use a different address, or even to ask your peer to use some specific address. These options are discussed in a later section.
After going through the IPCP setup phase, pppd will prepare your host's networking layer to use the PPP link. It first configures the PPP network interface as a point-to-point link, using ppp0 for the first PPP link that is active, ppp1 for the second, and so on. Next, it will set up a routing table entry that points to the host at the other end of the link. In the example shown above, pppd will make the default network route point to c3po, because we gave it the defaultroute option. This causes all datagrams to hosts not on your local network to be sent to c3po. There are a number of different routing schemes pppd supports, which we will cover in detail later in this chapter.