HostedDB - Dedicated UNIX Servers

-->
Internet Security Professional Reference:Understanding TCP/IP
Previous Table of Contents Next


Working with Network Interfaces

Each device that is to be connected to a network must have a network interface. This network interface must be consistent with the media on which the network is running. A network interface card for token ring, for example, cannot be connected to a thin coaxial cable network.

The following are the commonly used network media types:

Media Type
Token Ring
Thinnet (RG-58U Coax Cable)
Ethernet (RG-8U Coaxial cable)
Twisted Pair Cable
Fiber Optics

Each network interface has a name for the device and an IP address. If there is more than one network interface in a device, each network interface must be part of a different network. That is, the IP addresses must be different, as shown in figure 1.4.


Figure 1.4  Network interfaces.

The exact name used for each device is vendor implemented, and often is different depending upon the type of interface that is in use. Table 1.3 lists some of the network interface names that are used, and on what systems those names are found.

Table 1.3
Network Interface Names

Interface Name Operating System

le0 SunOS 4.1.3
wdn0,e3a,sl0,ppp1 SCO Unix
du0 DEC Ultrix

Consequently, as the system is configured, the network administrator must decide what the name of the device is, or must understand how to query the system to determine the name of the device. Having this information is essential to successfully configuring the network interface.

Configuration Using ifconfig

Except for Serial Line Internet Protocol (SLIP) and Point-to-Point Protocol (PPP) interfaces, the ifconfig command is used to configure the interface, including its IP address, broadcast address, netmask, and whether or not the interface is operational. There are some variations to this command, so it is wise to check out your system’s documentation when setting up your interface.

Normally ifconfig is used at boot time to configure the interface. ifconfig also can be used after the system is running to change the IP address, or other interface configuration information.

The command syntax for ifconfig is as follows:

ifconfig interface address-family address destination-address parameters

The interface value identifies the name of the interface that is being configured—wdn0, for example. The address family identifies the type of addressing used for this interface. Currently, the only value supported for this argument is inet.

The address value can consist of a hostname that is found in /etc/hosts, or an Internet address expressed in dot notation. If the name form is used and the hostname is not found in the /etc/hosts file, an error is returned.

Table 1.4 lists the commonly available parameters that can be configured with ifconfig.

Table 1.4
ifconfig Commands

Command Function

up This marks the interface as being up, or operational. When the first address of the interface is configured, the interface is marked as up. It also can be used to reset an interface after it was previously marked down.
down This marks an interface down. When the interface is marked down, the system does not attempt to transmit messages through that interface. If possible, the interface will be reset to prevent the reception of incoming packets as well. Use of this command does not automatically disable the routes that use this interface.
trailers This requests the use of a trailer-link-level encapsulation when transmitting. If the interface is capable of supporting trailers, the system encapsulates the outgoing messages in a manner that minimizes the number of memory-to-memory copy operations performed by the receiver.
-trailers Disables the use of trailer encapsulation.
arp This enables the use of the Address Resolution Protocol in mapping between network-level addresses and link-level addresses.
-arp This disables the use of the Address Resolution Protocol.
metric N This sets the routing metric for this interface, which is by default 0. The routing metric is used by the route daemon, routed. The higher the metric, the less favorable the route is.
debug This enables network-driver-level debugging.
-debug This disables driver-dependent debugging code.
netmask MASK This specifies how much of the address is used for the division of a network into subnets. The netmask contains 1s for the bit positions that are used for the network and subnet parts, and 0s for the host portion.
dest-address This specifies the destination address of the correspondent on the other end of a point-to-point link.
broadcast Specifies the address to use when sending a packet to all of the hosts on a network. The default value is the network portion and all 1s for the host portion. If the network portion is 192.139.234, for example, then the broadcast address is 192.139.234.255.

The following illustrates using ifconfig on an SCO system that has only one interface:

ifconfig lo0 localhost
ifconfig wdn0 198.73.138.2 -trailers netmask 255.255.255.0 broadcast
$ 198.73.138.255

The preceding code has two lines. The first illustrates defining the localhost loopback interface, and the second defines an interface named wdn0 using an IP address of 198.73.138.2. The trailer encapsulation option is turned off (-trailers), the netmask is 255.255.255.0, and the broadcast address is the default, using all 1s for the host portion.

The following code illustrates using ifconfig on a SunOS 4.1.3 system:

ifconfig le0 198.73.138.6 -trailers netmask 0xffffff00 broadcast
198.73.138.6

The options used on the SunOS system are the same as with SCO systems, except that the netmask defined on the Sun system uses a hexadecimal notation rather than the dot notation.


Note:  The use of the ifconfig is restricted to the super-user when used to configure the interface. A normal user can use the ifconfig command to query the status of the interface.


Previous Table of Contents Next