5.4. Configuring a network interface. Kernels 2.0 and 2.2

When you have all of the programs you need (and your address and network information), you can configure your network interfaces. When we talk about configuring a network interface, we are talking about two items. One is the process of assigning appropriate addresses to a network device. The second is setting the appropriate values for other configurable parameters of a network device. The program most commonly used to do this is the ifconfig (interface configure) command.

Typically you would use a command similar to the following:

       root# ifconfig eth0 netmask up

In this example, I'm configuring an Ethernet interface `eth0' with the IP address `' and a network mask of `'. The `up' that trails the command tells the interface that it should become active (but can usually be omitted) since it is the default. To shutdown an interface, you can just call ``ifconfig eth0 down''.

The kernel assumes certain defaults when you are configuring interfaces. For example, you may specify the network address and broadcast address for an interface. If you don't (as in my example above), then the kernel will make reasonable guesses as to what these addresses should be. If you don't supply a netmask then on the network class of the IP address is auto-configured. In my example, the kernel would assume that it is a class-C network that is being configured on the interface. It would thus configure a network address of `' ,and a broadcast address of `' for the interface.

There are many other options to the ifconfig command. The most important of these are:


This option activates an interface (and it is the default).


This option deactivates an interface.


This option enables or disables use of the address resolution protocol on this interface .


This option enables or disables the reception of all hardware multicast packets. Hardware multicast enables groups of hosts to receive packets addressed to special destinations. This may be of importance if you are using applications like desktop video conferencing. This option is normally not used.

mtu N

This parameter allows you to set the MTU of this device.

netmask <addr>

This parameter allows you to set the network mask of the network. This device belongs to:

irq <addr>

This parameter only works on certain types of hardware. It allows you to set the hardware IRQ of this device.

[-]broadcast [addr]

This parameter allows you to enable and set the accepting of datagrams destined to the broadcast address.It also allows you to disable reception of these datagrams.

[-]pointopoint [addr]

This parameter allows you to set the address of the machine at the remote end of a Point-to-Point link (ie; for slip or ppp).

hw <type <addr>

This parameter allows you to set the hardware address of certain types of network devices. This is not often useful for Ethernet, but is useful for other network types like AX.25.

With the release of Kernel 2.2, there are a number of options available that are not listed above. Some of the most interesting ones are tunneling and IPV6. The ifconfig parameters for kernel 2.2 are listed below.


The name of the interface. This is usually a driver name followed by a unit number. For example, eth0 for the first Ethernet interface.


This flag causes the interface to be activated. It is implicitly specified if an address is assigned to the interface.


This flag causes the driver for this interface to be shut down.


Enables or disables the use of the ARP protocol on this interface.


Enables or disables the promiscuous mode of the interface. If selected, all packets on the network will be received by the interface.


Enables or disables all-multicast mode. If selected, all multicast packets on the network will be received by the interface.

metric N

This parameter sets the interface metric.

mtu N

This parameter sets the Maximum Transfer Unit (MTU) of an interface.

dstaddr addr

Sets the remote IP address for a point-to-point link (such as PPP). This keyword is now obsolete; you should now use the pointopoint keyword.

netmask addr

Sets the IP network mask for this interface. This value defaults to the usual class A, B or C network mask (as derived from the interface IP address). It can, however, be set to any value.

add addr prefixlen

Adds an IPv6 address to an interface.

del addr prefixlen

Removes an IPv6 address from an interface.

tunnel aa.bb.cc.dd

Creates a new SIT (IPv6-in-IPv4) device that tunnels to the given destination.

irq addr

Sets the interrupt line used by this device. Not all devices can dynamically change their IRQ set- ting.

io_addr addr

Sets the start address in I/O space for this device.

mem_start addr

Set the start address for shared memory used by this device. Only a few devices need this parameter.

media type

Sets the physical port (or medium type) to be used by the device. Not all devices can change this set- ting. Those that can change the setting vary in what values they support. Typical values for type are 10base2 (thin Ethernet), 10baseT (twisted-pair 10Mbps Ethernet), AUI (external transceiver) and so on. The special medium type of auto can be used to tell the driver to auto-sense the media. Again, not all drivers can do this.

[-]broadcast [addr]

If the address argument is given, set the protocol broadcast address for this interface. Otherwise, set (or clear) the IFF_BROADCAST flag for the interface.

[-]pointopoint [addr]

This keyword enables the point-to-point mode of an interface. This means that it is a direct link between two machines, and that nobody else is listening on it. If the address argument is also given, set the pro- tocol address of the other side of the link ( just as the obsolete dstaddr keyword does). Otherwise, set or clear the IFF_POINTOPOINT flag for the interface.

hw class address

Set the hardware address of this interface (if the device driver supports this operation). The keyword must be followed by the name of the hardware class and the printable ASCII equivalent of the hardware address. Hardware classes currently supported include ether (Ethernet), ax25 (AMPR AX.25), ARCnet and netrom (AMPR NET/ROM).


Set the multicast flag on the interface. This should not normally be needed because the drivers set the flag correctly themselves.


The IP address to be assigned to this interface.

txqueuelen length

Sets the length of the transmit queue of the device. It is useful to set this to small values for slower devices with a high latency (modem links, ISDN). This prevents fast bulk transfers from disturbing inter- active traffic (like telnet) too much.

You may use the ifconfig command on any network interface. Some user programs such as pppd and dip automatically configure the network devices as they create them, so manual use of ifconfig is unnecessary.

Was this section helpful? Why not Donate $2.50?