ITL Lab Manual

Useful Computers Applications


ethereal (gui protocol analyzer)

Network packets that arrive at one of the network interfaces can be captured and viewed. The application used in the lab for this is ethereal. Under X-windows ethereal has a very easy to use graphical interface

A "packet sniffer" application like ethereal can be abused. Just because it is possible to observe packets on the network doesn't mean that it is right to do so. Anyone using the lab is expected to use this application in an appropriate manner.

For a detailed description of all the features of ethereal examine the ethereal man pages:

     [Linux prompt]# man ethereal

To launch ethereal issue the command (it is usually convenient to run it in the background):

     [Linux prompt]# ethereal &

ethereal displays a window with three panels. The top panel lists packets that have been captured, the middle panel shows the logical structure of a packet, and the bottom panel shows the contents of a packet. In the top panel if you click in a column header the packets will be displayed in sorted order according to that column. The packet shown in the last two panels is the one selected in the top panel. In the middle panel, if a component of the packet has further structure clicking the "+" will expand the component. If one of the components in the second panel is selected the corresponding bytes in the packet content are highlighted in the bottom panel.

To capture packets choose Capture->Start from the Capture menu. A dialog box will be displayed with several options:

Clicking start begins the capture of packets. A small window displays the total number of packets captured so far, and attempts to show how many have been captured for each of several common protocols. To terminate capture of packets click the "stop" button in this window.

Several factors determine which packets are displayed by ethereal.

A filter is essentially a string containing a boolean expression. The terms of the expression are keywords that identify a particular component of the packet (e.g. proto (short for protocol), dst (short for destination) ), values that that component of the packet might have (e.g. 0x0806 for a protocol, ff:ff:ff:ff:ff:ff for an address) and operators (e.g. ==, !=, && ). An example of a filter string for a display filter to show only ARP packets is:
     eth.type==0x0806

An example of a filter string for a capture filter to capture only ARP packets is:

     ether proto 0x0806

Display filters and capture filters have different syntax, but both rely on a string containing an expression. A filter can be entered for use once only, or it can be given a name and saved in a file. The locations within the window where the strings for capture filters and display filters are entered are different and the files in which the strings are saved are different. When a filter string is saved it is given a name so that it can be retrieved later. When saved filters are retrieved you must be careful to use capture filter strings only where capture filters are appropriate, and display filter strings only where display filters are appropriate. It might be helpful to include the word "capture" or "display" as part of the name of any saved filter string.

Display Filters

A display filter is used to restrict which of the already captured packets are shown in the top panel. When a display filter is applied the original list of captured packets is not lost. Clicking the "Reset" button at the bottom of the window displays the full list again. The syntax of display filters is described on the ethereal man page. An example of a display filter string is:

     eth.type==0x0806 && eth.dst==ff:ff:ff:ff:ff:ff

A display filter is entered into the area at the bottom of the window labeled "Filter". You can simply type the filter string and press Enter to apply the filter. You can apply different filters in succession. Each filter is applied to the list of packets displayed, not to the original list.

The simplest way to create a display filter when you are unfamiliar with the syntax is to select a field from one of the packets and to tell ethereal that you want to display only packets with the same value for that field. The steps are as follows:

This technique can only be used to create the simplest display filters. There is a filter dialog box to help you create more complex filters. You can also create display filters by simply entering the filter string directly into the filter dialog, bypassing the filter dialog box.

When ethereal is launched it reads the file containing the named, saved filters. These named filters are shown in the filter dialog box. A named, saved filter can be recalled as follows:

Capture Filters

A capture filter is used to restrict which packets are captured. The syntax of capture filters is described on the tcpdump man page.
     [Linux prompt]# man tcpdump

An example of a capture filter string is:

     ether proto 0x0806 and host 192.168.200.1

Capture filters are applied in the dialog that is displayed when you first choose to start a capture. When that dialog box is opened you can type a capture filter string into the field labelled "Filter", or you can recall a named, saved filter by clicking the "Filter" button.

To use a named, saved filter you must create a capture filter string, name the filter, and save it. The filter can then be selected in the dialog box that is displayed when you choose to start capturing packets. There is no tool to help you build a capture filter string. You have to compose it yourself. If the syntax is incorrect ethereal will not start capturing packets. By default the file that contains the capture filters is .ethereal/cfilters in your home directory.

gated (router)

gated implements several routing protocols and allows any computer running linux to act as a router.

Documentation for gated is available on the computers in the lab in html format in the file /usr/share/doc/gated-3.6/doc/main.html:

An alternate site for gated documentation is http://www.ifm.liu.se/~peter/doc/gated/node1.html

ifconfig

ifconfig allows you to view and modify the following characteristics of a network interface For a description of all the options for ifconfig refer to the man page:
     [Linux prompt]# man ifconfig

minicom (terminal emulator)

minicom is a terminal emulator that runs under Linux. If a serial port of the computer is connected to the console port of a network device minicom can be used to communicate with the device.

For a description of all the options for minicom refer to the man page:

     [Linux prompt]# man minicom

To start minicom with a connection to serial port S0 type

     [Linux prompt]# minicom s0

To start minicom with a connection to serial port S1 type

     [Linux prompt]# minicom s1

netstat

netstat prints information on network connections, routing tables, interface statistics, masquerade connections, and multicast memberships

For a description of all the options for netstat refer to the man page:

     [Linux prompt]# man netstat

ping

ping is used to determine whether there is a connection between two computers. On one computer issue the command "ping a.b.c.d" where a.b.c.d is the IP address of an interface on the other computer. For example:
     [Linux prompt]# ping 192.168.200.1

This causes a packet to be sent to the other computer. The other computer should respond. ping will display whether a reply was returned and information about the round-trip time. For computers on the Internet with hostnames the command can be issued in the form "ping hostname". For example:

     [Linux prompt]# ping linux.cs.sonoma.edu

For a description of all the options for ping refer to the man page:

     [Linux prompt]# man ping

A complete understanding of this utility depends on an understanding of the IP addressing scheme.

route (display forwarding table)

route displays or modifies the IP forwarding table

For a description of all the options for route refer to the man page:

     [Linux prompt]# man route

When used without any options route attempts to resolve names by issuing DNS queries over the network. This can delay the completion of the output and produce unwanted packets. This option can be suppressed with the "-n" option.

     [Linux prompt]# route -n

routed (RIP router)

routed enables the RIP routing protocols.

sereal

sereal is a program that transfers data between the serial ports and displays the data that is transfered. Any data that arrives on serial port S0 is immediately sent to port S1 and shown on the screen. Any data that arrives on serial port S1 is immediately sent to port S0 and shown on the screen. The display identifies the port from which the data arrives, and it shows the hex value of each byte as well as the ascii character if it can be displayed. The program is terminated by typing CTRL/C on the keyboard.

The program does not alter the baud rates of the serial ports, so they must be set to the speed of the arriving data before sereal is started. The serial ports probably default to 9600 baud. To change the speed of the serial ports use the command "stty -F device ispeed rate ospeed rate" where "device" is /dev/ttyS0 or /dev/ttyS1, and rate is the baud rate. For example, to set the speed of both serial ports to 1200 baud:

     [Linux prompt]# stty -F /dev/ttyS0 ispeed 1200 ospeed 1200
     [Linux prompt]# stty -F /dev/ttyS1 ispeed 1200 ospeed 1200

The source file for the program sereal.c and its makefile can be downloaded.

snmpxxxx (snmp management)

There are several applications with names of the form snmpxxxx which can perform snmp management functions. They are:

For a description of all the options for snmpxxxx type:

     [Linux prompt]# man snmpxxxx

sock (test TCP and UDP)

sock is a program written by Richard Stevens for use with his books on IP networking. It allows you to send and receive UDP packets and to create TCP connections with a wide variety of options. The sock binary is available through anonymous ftp from linux.cs.sonoma.edu in the directory pub/networking/programs.

For a description of all the options for sock run the program without any arguments:

     [Linux prompt]# ./sock

tcpdump (command line protocol analyzer)

tcpdump is a line-oriented application for capturing ethernet packets. It is generally easier to use ethereal.

For a description of all the options for tcpdump refer to the man page:

     [Linux prompt]# man tcpdump

Tera Term (Windows terminal emulator)

Tera Term is a terminal emulator that runs under Windows. If a serial port of the computer is connected to the console port of a network device Tera Term can be used to communicate with the device.

traceroute

traceroute is used to determine the sequence of network nodes a packet passes through when it is sent from one computer to another. On one computer the command "traceroute a.b.c.d" is issued, where a.b.c.d is the IP address of an interface on the other computer. For example:
     [Linux prompt]# traceroute 192.168.200.1

traceroute will display the nodes the packet passes through. For computers on the Internet with hostnames the command can be issued in the form "traceroute hostname" where hostname is the Internet name of the computer. For example:

     [Linux prompt]# traceroute valinux.cs.sonoma.edu

For a description of all the options for traceroute refer to the man page:

     [Linux prompt]# man traceroute

A complete understanding of this utility depends on an understanding of the IP addressing scheme.

Exercises

  1. Examine the man page for ifconfig. Determine the parameters of this command that set the IP address, the netmask, the broadcast address, and the network for the interface. Construct a command that sets the following values for eth2: Verify that the interface has these new parameters by using "ifconfig -a" to examine all the interfaces.

  2. If you use the command from the exercise above, then you disable and reenable eth2, will the values associated with that interface be those from ifcfg-eth2 or those from the ifconfig command?

  3. Examine the man page for ifconfig. Determine the parameters of this command that set the ethernet address of the interface. Write down the current ethernet address of eth2, then use the ifconfig command to change it to 11.22.33.44.55.66. Does the original ethernet address return if you disable and reenable the interface? If not, does it return if you reboot the computer?

  4. Use ethereal to capture several dozen packets from interface eth0. Locate a packet whose protocol is ARP. What filter string will display only ARP packets? Using Display->Match Selected create a display filter that restricts the displayed packets to only ARP packets. Observe the filter string that was created.

  5. Use ethereal to capture several dozen packets from interface eth0. Locate a packet whose source IP address is in the Computer Science Department subnet (130.157.166.*). What filter string will display only packets from that source IP address? Try using Display->Match Selected to create a display filter that restricts the displayed packets to only packets from that source IP address. Observe the filter string that was created. Then try to create the desired filter using the filter dialog. Are they different?

  6. Use ethereal to capture several dozen packets from interface eth0. Use the display filter dialog box to create a display filter that only shows packets whose ethernet destination address is the broadcast address ff:ff:ff:ff:ff:ff. Is it evident from the "Destination" column in the first ethereal pane which packets have this ethernet destination address?

  7. Use ethereal to capture several dozen packets from interface eth0. Use the display filter dialog box to create a display filter that only shows packets whose ethernet destination address is not the broadcast address ff:ff:ff:ff:ff:ff. If there are any, why were they delivered to your computer?

  8. Use ethereal to capture several dozen packets from interface eth0. Use the display filter dialog box to create a display filter that only shows packets whose protocol is ARP and whose ethernet destination address is the broadcast address ff:ff:ff:ff:ff:ff.

  9. Use ethereal to capture several dozen packets from interface eth0. Examine the list of packets and identify the ethernet address of one of the Computer Science Department servers. Construct a display filter that only shows packets whose ethernet source address is the address of that computer or whose ethernet destination address is the address of that computer.

  10. Create the display filter from one of the previous exercises, name it and save it. Demonstrate that the filter can be retrieved at a later time.

  11. Start ethereal on interface eth0 on two adjacent computers. On one computer create the capture filter whose filter string is "ip proto udp". Capture packets simultaneously on both computers or until the one with the capture filter has captured several packets. Then on the computer that had no capture filter apply a display filter to show only UDP packets and compare the results on the two computers.

  12. Create a capture filter which shows only ARP packets. Verify that the filter works.

  13. Create a capture filter which shows only packets from IP source linux.cs.sonoma.edu. Verify that the filter works.

  14. Use ping to verify that there is a connection to each of the following servers:

  15. Identify the internet address of a computer that is very distant (you might discover such an address by examining the URLs of web pages). Use traceroute to show the route from your computer to the distant computer. Try several such targets to be sure you get one that has many intervening nodes. Record this route every day (or every day you are in the lab) for several weeks or months to see whether the route ever changes.

    This exercise can be automated. You can write a script that appends the results of the traceroute command to a file every time it is run, and you can use the cron utility to run that script every day.


| Sonoma State University | CS Department | Computer and Engineering Science | Internet Teaching Laboratory | Lab Manual Table of Contents |