-->
Page 291
At this point, your hardware is configured. Now to tackle the network aspects of the configuration. Click the Networking button in the Edit PPP Interface window. The window will change to look something like Figure 13.9.
You now have to make some important decisions:
If you answer yes to the first question, you will be unable to drop the PPP connection until the system shuts down or you kill the pppd daemon with the kill command. For a flaky
Page 292
connection, this is a very useful option because it will keep you from having to constantly restart your connection.
Answering yes to the second question is useful only if your account with your ISP is a 24-hours-a-day connection.
To set your desired parameters, do the following:
To complete the PPP setup, click Done. Another window will come up asking if you want to save the current configuration. Click the Save button. The Edit PPP Interface window will disappear and your original Network Configurator window will show the PPP interface, as shown in Figure 13.10.
You are now ready to test your PPP connection. Click the Activate button at the bottom of the Network Configurator window to start your PPP connection. You should hear your modem dialing and connecting within a few moments. After it is connected, test the connection by pinging your ISP's nameserver. A valid connection should look something like this:
[root@technics /root]# ping -c 5 207.155.59.1 PING 207.155.59.1 (207.155.59.1): 56 data bytes 64 bytes from 207.155.59.1: icmp_seq=0 ttl=254 time=141.8 ms 64 bytes from 207.155.59.1: icmp_seq=1 ttl=254 time=140.4 ms 64 bytes from 207.155.59.1: icmp_seq=2 ttl=254 time=150.4 ms 64 bytes from 207.155.59.1: icmp_seq=3 ttl=254 time=140.3 ms 64 bytes from 207.155.59.1: icmp_seq=4 ttl=254 time=140.4 ms --- 207.155.59.1 ping statistics --- 5 packets transmitted, 5 packets received, 0% packet loss round-trip min/avg/max = 140.3/142.6/150.4 ms
When you are done with your connection, click the Deactivate button in the Network Configurator window. Be sure to click Save one last time before you click Quit.
Page 293
To bring your connection back up, simply run netcfg, select Interfaces from the top menu, highlight the ppp interface, and click Activate.
TIP |
Instead of having to start the netcfg program every time you want to activate your PPP connection, you can use command-line scripts in the /etc/sysconfig/network-scripts directory. The command for starting PPP is |
As you become more Net savvy, you might find it useful to have your machine automatically dial out to your ISP and log in whenever it detects a packet destined to a particular IP address, for example, your ISP's nameserver.
When the kernel tries to connect to an IP that it doesn't have a route for, it invokes the script /sbin/request-route with the destination IP address. request-route checks to see if it has a script corresponding to that address. If it does, the script is invoked, which presumably starts the necessary connection to establish the desired route. In most instances, this would be the PPP connection.
Page 294
There is, however, a slight limitation in the current setup. If you attempt to connect to an IP that requires the PPP connection be up, but was not specifically set with request-route so that the connection is started, the kernel will return an error to the calling program. To circumvent this, you can use a slightly modified script that establishes a default script to invoke for all IPs that cannot be reached. This feature is especially useful if you run your own nameserver.
Before using a new request-route script, make a backup copy of the original with the following command:
cp /sbin/request-route /sbin/request-route-orig
Should you decide to return back to the original script, you can simply copy the /sbin/request-route-orig script back to/sbin/request-route.
Next, add the following line
if [ ! -f $chatfile ] ; then chatfile=/etc/ppp/chat-default; fi
to request-route after the line that reads
chatfile=/etc/ppp/chat.$1
With request-route ready, you need to provide it the script files necessary to invoke the PPP connection. You've already configured PPP with the netcfg tool, so the script is already done and just needs to be copied to /etc/ppp like so:
cp /etc/sysconfig/network-scripts/chat-ppp0 /etc/ppp/chat-default
Doing this will set up your default PPP service. If for some reason you need to set up a different network connection for a particular IP address, you can create a specific chat script for that address and name it /etc/ppp/chat.xxx.xxx.xxx.xxx, where xxx.xxx.xxx.xxx is the IP address. The request-route script will automatically pick the IP-specific script over the default script.
By default, the PPP connection will automatically shut itself down after five minutes of inactivity. You can change this by editing the request-route script and changing the number after the string idle-disconnect to however many seconds you want it to wait for before automatically disconnecting.
If you want to force a disconnection before the idle out period, you can simply kill the pppd daemon. Do not use the -9 option on kill when doing so, however, because pppd intercepts the standard termination signal and does cleanup work before exiting.
As you've seen in this chapter, adding network access and networking tools to your system is a fantastic asset. And with Red Hat Linux, sharing data through these networking tools is relatively straightforward, which is impressive considering the power they add to your system.