3.8 ifconfig Command

3.8 ifconfig Command

Now that we've described the link layer and the IP layer we can show the command used to configure or query a network interface for use by TCP/IP. The ifconfig (8) command is normally run at bootstrap time to configure each interface on a host.

For dialup interfaces that may go up and down (such as SLIP links), ifconfig must be run (somehow) each time the line is brought up or down. How this is done each time the SLIP link is brought up or down depends on the SLIP software being used.

The following output shows the values for the author's subnet. Compare these values with the values in Figure 3.12.

 sun %  /usr/etc/if config -a   SunOS -a option says report on all interfaces  le0: flags=63<UP,BROADCAST,NOTRAILERS,RUNNING>             inet 140.252.13.33 netmask ffffffe0 broadcast 140.252.13.63     sl0: flags=1051<UP,POINTOPOINT,RUNNING,LINK0>             inet 140.252.1.29 --> 140.252.1.183 netmask ffffff00     lo0: flags=49<UP,LOOPBACK,RUNNING>             inet 127.0.0.1 netmask ff000000 

The loopback interface (Section 2.7) is considered a network interface. Its class A address is not subnetted .

Other things to notice are that trailer encapsulation (Section 2.3) is not used on the Ethernet, and that the Ethernet is capable of broadcasting, while the SLIP link is a point-to-point link.

The flag LINK0 for the SLIP interface is the configuration option that enables compressed slip (CSLIP, Section 2.5). Other possible options are LINK1, which enables CSLIP if a compressed packet is received from the other end, and LINK2, which causes all outgoing ICMP packets to be thrown away. We'll look at the destination address of this SLIP link in Section 4.6.

A comment in the installation instructions gives the reason for this last option: "This shouldn't have to be set, but some cretin pinging you can drive your throughput to zero."

bsdi is the other router. Since the -a option is a SunOS feature, we have to execute ifconfig multiple times, specifying the interface name as an argument:

 bsdi %  /sbin/ifconfig we0  we0: flags=863<UP,BROADCAST,NOTRAILERS,RUNNING,SIMPLEX>             inet 140.252.13.35 netmask ffffffe0 broadcast 140.252.13.63     bsdi %  /sbin/ifconfig sl0  sl0: flags=1011<UP,POINTOPOINT,LINK0>             inet 140.252.13.66 --> 140.252.13.65 netmask ffffffe0 

Here we see a new option for the Ethernet interface (we0): SIMPLEX. This 4.4BSD flag specifies that the interface can't hear its own transmissions. It is set in BSD/386 for all the Ethernet interfaces. When set, if the interface is sending a frame to the broadcast address, a copy is made for the local host and sent to the loopback address. (We show an example of this feature in Section 6.3.)

On the host slip the configuration of the SLIP interface is nearly identical to the output shown above on bsdi, with the exception that the IP addresses of the two ends are swapped:

 slip %  /sbin/ifconfig sl0  sl0: flags=1011<UP,POINTOPOINT,LINK0>             inet 140.252.13.65 --> 140.252.13.66 netmask ffffffe0 

The final interface is the Ethernet interface on the host svr4. It is similar to the Ethernet output shown earlier, except that SVR4's version of ifconfig doesn't print the RUNNING flag:

 svr4 %  /usr/sbin/ifconfig emd0  emd0: flags=23<UP,BROADCAST,NOTRAILERS>             inet 140.252.13.34 netmask ffffffe0 broadcast 140.252.13.63 

The ifconfig command normally supports other protocol families (other than TCP/IP) and has numerous additional options. Check your system's manual for these details.



TCP.IP Illustrated, Volume 1. The Protocols
TCP/IP Illustrated, Vol. 1: The Protocols (Addison-Wesley Professional Computing Series)
ISBN: 0201633469
EAN: 2147483647
Year: 1993
Pages: 378

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net