[Next] [Previous] [Up] [Top] [Contents]

19.4 Network Programs

19.4.1 ifconfig - Configure the Network Interface

Configure the network interfaces with the ifconfig command. For each interface you can report or assign the IP, ethernet and broadcast addresses, enable or disable the interface, set the netmask, and protocols for the interface.

Syntax

ifconfig [interface] [address] [options]

Common Options

-a apply the action to all interfaces (SunOS 4.X and 5.X only)

-au apply the action to all "up" interfaces (SunOS 4.X and 5.X only)

-ad apply the action to all "down" interfaces (SunOS 4.X and 5.X only)

up bring the interface up. This happens automatically when you set the first address on the interface.

down bring the interface down. The system will no longer send messages through this interface.

trailers|-trailers set the flag to use, or disable, "trailer" link level encapsulation. "trailers" is no longer used, and it set, is ignored.

arp|-arp enable, or disable, the use of Address Resolution Protocol (arp) to map between network level and link level address (defaults to arp)

plumb|unplumb setup and open, or destroy and close, the streams necessary to for TCP/IP to use the interface. After using unplumb the device will not be reported by "ifconfig -a". (SunOS 5.X only).

broadcast address set the address for broadcasting to the local subnet. The default broadcast address is the machine address with the host part of the address set to all 1's, except for SunOS 4.X which defaults to all 0's in the host part of the address.

netmask mask set the mask for how much of the address to use for the network part of the address and how much to use for the subnet (host part) of the address.

ether address set the ethernet address

Examples

ifconfig is usually executed at several points in RC scripts, first to bring up each interface, and then again later to reset the netmask and broadcast for each. To report on the network interface do the following, where le0 is the primary interface name on most Sun workstations:

# ifconfig le0

le0: flags=63<UP,BROADCAST,NOTRAILERS,RUNNING>

inet 128.146.116.4 netmask ffffff00 broadcast 128.146.116.255

ether 8:0:20:fa:1b:2c

where the netmask value of ffffff00 is equivalent to 255.255.255.0 and the ethernet address is reported only if you are the superuser.

The file /etc/netmasks contains information for non-default netmasks. For SunOS 5.X entries should have the network address use zeroes to fill out the octets, while in SunOS 4.1.X it should not, e.g:

# Network netmask

128.146.0.0 255.255.255.0 <-- used by SunOS 5.X

128.146 255.255.255.0 <-- used by SunOS 4.1.X

ifconfig uses this file for its default settings, i.e. when doing the following:

# ifconfig le0 netmask +


Unix System Administration - 8 AUG 1996
[Next] [Previous] [Up] [Top] [Contents]