UNIX System Administration Handbook - Evi Nemeth [204]
/etc/ppp/options
# Global PPP options
lock # Always lock the device you're using
asyncmap 0x00000000 # By default, don't escape anything
crtscts # Use hardware flow control
modem # Use modem control lines
defaultroute # Add default route thru the ppp int.
mru 552 # MRU/MTU 512 (data) + 40 (header)
mtu 552
/etc/ppp/options.netblazer
# Options file for dedicated ppp connection
128.138.198.47:128.138.243.167 # Local:Remote ip addrs
netmask 255.255.255.0 # The 128.138 net is subnetted
/dev/cuaa2 # Use the third serial port
57600 # Baud rate
#persist # Keep trying even after failure
#holdoff 5 # Wait 5 seconds between dial attempts
connect "/usr/bin/chat -v -f /etc/ppp/chat.netblazer"
disconnect "/etc/ppp/hangup" # Try to hangup nicely
/etc/ppp/chat.netblazer
ABORT BUSY ABORT 'NO CARRIER'
TIMEOUT 5 OK-"-" ATZ OK-+++ATHZ-OK ATDTphone#_goes_here
TIMEOUT 60 CONNECT "
TIMEOUT 10 ogin:--ogin: Pevi
ssword: password_was_here
'Packet mode enabled'
You can usually adapt an existing chat script to your environment without worrying too much about exactly how it works. Here, the first line sets up some general conditions on which the script should abort, the second line initializes the modem and dials the phone, and the remaining lines wait for a connection and enter the appropriate username and password.
PPP logins at our site are just usernames with a P in front of them. This convention makes it easy to remember to whom a particular PPP machine belongs.
To start pppd with these configuration files, we’d run the command
% sudo pppd file /etc/ppp/options.netblazer
You can feed options to pppd on the command line, in the file /etc/ppp/options, in ~/.ppprc, and in /etc/ppp/options.terminal-server. Whew!
To take the PPP connection down, just kill the pppd daemon:
% sudo kill `cat /var/run/ppp0.pid`
If your machine is portable and sometimes uses Ethernet instead of PPP, there will most likely be a default route through the Ethernet interface before pppd starts up. Unfortunately, pppd is too polite to rip out that route and install its own, which is the behavior you’d actually want. To fix the problem, remove the existing default route before you start pppd. We suggest that you write yourself a little ppp.up script that removes the default route automatically.
Here’s what the PPP interface configuration and routing table look like after the PPP connection is brought up:
% ifconfig ppp0
ppp0: flags=8051 inet 128.138.198.47 --> 128.138.243.167 netmask 0xffffff00 % netstat -nr Routing tables Internet: Destination Gateway Flags Refs Use Netif Expire default 128.138.243.167 UGSc 3 0 ppp0 127.0.0.1 127.0.0.1 UH 0 0 lo0 128.138.243.167 128.138.198.47 UH 4 0 ppp0 You can obtain statistics about the PPP connection and the packets it has transferred with the pppstats command: % pppstats IN PACK COMP UNC ERR | OUT PACK COMP UNC NON-VJ 1647029 5101 4596 157 0 | 203582 5051 4566 210 275 The COMP column counts packets that use TCP header compression, and the UNC column counts those that don’t. See RFC1144 for details. Networking quirks for FreeBSD 1. This is actually a little white lie. ARP is not really part of TCP/IP and can be used with other protocol suites. However, it’s an integral part of the way TCP/IP works on most LAN media. 2. In fact, a T-shirt showing this extended nine-layer model is available from the computer science department at the University of Colorado. Email tshirt@cs.colorado.edu for details. 3. The link layer is actually divided into two parts: MAC, the Media Access Control sublayer and LLC, the Logical
FreeBSD’s route command does not accept a hop count parameter, but if you forget and put one on the command line, route will interpret it as a netmask. A netmask of 1—which becomes 0.0.0.1 in netmask land—will make any route totally useless, including the default route.