-->

Previous | Table of Contents | Next

Page 170

The netstat command is the definitive command for checking your network activity, connections, routing tables, and other network messages and statistics. You'll want to try this command if you're interested in a flexible listing of what's going on. For example, you can try (the following example output is abbreviated):


# netstat

Active Internet connections (w/o servers)

Proto Recv-Q Send-Q Local Address           Foreign Address         State

tcp        1      0 localhost:1644          localhost:1322          CLOSE_WAIT

tcp        0      0 localhost:2579          localhost:6000          ESTABLISHED

...

tcp        0      0 serial52.staffnet.:4216 megan.staffnet.com:pop  ESTABLISHED

Active UNIX domain sockets (w/o servers)

Proto RefCnt Flags       Type       State         I-Node Path

unix  2      [ ]         STREAM     CONNECTED     417

...

unix  2      [ ]         STREAM                   419    /dev/log

unix  2      [ ]         STREAM     CONNECTED     1982

unix  2      [ ]         STREAM                   1983   /dev/log



The netstat command has more than a dozen different command-line options. See the netstat manual page for more information.

Using the ping Command

The ping command is useful for verifying that your ISP's IP addresses are valid and for testing the response times of your ISP's host servers. Ping sends test packets of data and measures the time it takes for the host to send back the information—for example:


# ping staffnet.com

PING staffnet.com (207.226.80.1): 56 data bytes

64 bytes from 207.226.80.1: icmp_seq=0 ttl=254 time=176.9 ms

64 bytes from 207.226.80.1: icmp_seq=1 ttl=254 time=180.0 ms

64 bytes from 207.226.80.1: icmp_seq=2 ttl=254 time=170.0 ms

64 bytes from 207.226.80.1: icmp_seq=3 ttl=254 time=170.0 ms

64 bytes from 207.226.80.1: icmp_seq=4 ttl=254 time=170.0 ms

64 bytes from 207.226.80.1: icmp_seq=5 ttl=254 time=170.0 ms

64 bytes from 207.226.80.1: icmp_seq=6 ttl=254 time=169.7 ms

...



-- staffnet.com ping statistics --

7 packets transmitted, 7 packets received, 0% packet loss

round-trip min/avg/max = 169.7/172.3/180.0 ms



By default, ping will continue to send and receive information until you tell it to quit with a Ctrl+C. You should also know that using the -f, or flood, option isn't a nice thing to do to your ISP (or any other host computer for that matter), as it creates network overhead and unnecessary network traffic.

Using the route Command

The route command, generally used to set up or delete networking routes for interfaces, may also be useful in showing you what's going on with your ppp0 interface. You can try the following:

Page 171


# /sbin/route

Kernel IP routing table

Destination     Gateway         Genmask         Flags Metric Ref    Use Iface

pm2.staffnet.co *               255.255.255.255 UH    0      0        0 ppp0

127.0.0.0       *               255.0.0.0       U     0      0        2 lo

default         pm2.staffnet.co 0.0.0.0         UG    0      0        3 ppp0

For more details about the route command, see its manual page.

Reading Your System Log

If you'd like to read in detail about what's going on while your scripts are executing, take a look through your system log, a file called messages, under the /var/log directory. Try


# less /var/log/messages

Look for the start of the pppd daemon in the ppp-on script. Notice that your dialer script uses the chat program, which does most of the work and then quits, followed by pppd getting and setting the network IP addresses.

...

Nov  5 16:29:49 localhost pppd[370]: pppd 2.2.0 started by root, uid 0

Nov  5 16:29:51 localhost chat[371]: timeout set to 3 seconds

Nov  5 16:29:51 localhost chat[371]: abort on (\nBUSY\r)

Nov  5 16:29:51 localhost chat[371]: abort on (\nNO ANSWER\r)

Nov  5 16:29:51 localhost chat[371]: abort on (\nRINGING\r\n\r\nRINGING\r)

Nov  5 16:29:51 localhost chat[371]: send (rAT^M)

Nov  5 16:29:51 localhost chat[371]: expect (OK)

Nov  5 16:29:51 localhost chat[371]: rAT^M^M

Nov  5 16:29:51 localhost chat[371]: OK -- got it

Nov  5 16:29:51 localhost chat[371]: send (ATH0^M)

Nov  5 16:29:51 localhost chat[371]: timeout set to 30 seconds

Nov  5 16:29:51 localhost chat[371]: expect (OK)

Nov  5 16:29:51 localhost chat[371]: ^M

Nov  5 16:29:51 localhost chat[371]: ATH0^M^M

Nov  5 16:29:51 localhost chat[371]: OK -- got it

Nov  5 16:29:51 localhost chat[371]: send (ATDT659-9041^M)

Nov  5 16:29:51 localhost chat[371]: expect (CONNECT)

Nov  5 16:29:51 localhost chat[371]: ^M

Nov  5 16:30:10 localhost chat[371]: ATDT659-9041^M^M

Nov  5 16:30:10 localhost chat[371]: CONNECT -- got it

Nov  5 16:30:10 localhost chat[371]: send (^M)

Nov  5 16:30:10 localhost chat[371]: expect (ogin:)

Nov  5 16:30:10 localhost chat[371]:  57600^M

Nov  5 16:30:12 localhost chat[371]: ^M

Nov  5 16:30:12 localhost chat[371]: ^M

Nov  5 16:30:12 localhost chat[371]: Staffnet PM0 login: -- got it

Nov  5 16:30:12 localhost chat[371]: send (username^M)

Nov  5 16:30:12 localhost chat[371]: expect (assword:)



Page 172


Nov  5 16:30:12 localhost chat[371]: username ^M 

Nov  5 16:30:12 localhost chat[371]: Password: -- go it

Nov  5 16:30:12 localhost chat[371]: send (Password: -- ^M) 

Nov  5 16:30:12 localhost pppd[370]: Serial connection stablished.

Nov  5 16:30:13 localhost pppd[370]: Using interface ppp0  

Nov  5 16:30:13 localhost pppd[370]: Connect: ppp0 <--> /dev/modem

Nov  5 16:30:16 localhost pppd[370]: local IP addrees 207.226.80.171 

Nov  5 16:30:16 localhost pppd[370]: remore IP addrees 207.226.80.214



You can look at portions of your log to troubleshoot whether your modem is working, or your ISP's modems are working. Hopefully everything will go well, but if you have a hard time connecting or setting up your scripts, take the time to read the chat and pppd manual pages, along with the PPP-HOWTO and PPP-FAQ.

JUST A MINUTE
If you're still having trouble, be sure to read Robert Hart's PPP-HOWTO, along with Al Longyear's PPP-FAQ, which go into much more detail about setting up PPP connections. You'll find a lot of handy hints about setting up, testing, and troubleshooting your connection. If security is a big issue for you, be sure to read these documents. You should also check with the comp.os.linux.networking, comp.os.linux.setup, or comp.protocols. ppp Usenet newsgroups for specific information or tips on using PPP.

The next two hours show you how to set up your email and newsreader programs so you can send and receive email, and read some favorite Usenet newsgroups.

Previous | Table of Contents | Next