The ifconfig command in Linux

Home / 192.168.1.1 / The ifconfig command in Linux

ifconfig ( “interface configuration”) is a program available on several versions of  UNIX operating system, which allows you to configure or deploy numerous parameters of resident network interfaces in the core, such as IP address (dynamic or static), or mask network. If called without arguments usually it shows the current configuration of active network interfaces, with details such as the MAC address or traffic circulated by them so far. Network interfaces in Linux are often referred to as eth (eth0, eth1, etc.).

Follow the steps below to learn how to use the ifconfig command.

Step 1:

On a Terminal emulator window type the command:

>> ifconfig

ifconfig

Step 2. Parameters

If ifconfig is executed by adding only the interface name, it will display the configuration information for that interface. If executed without parameters, it presents all the interfaces configured so far as showed above.

Ifconfig not only displays network interface information, but is also able to control some aspects of that interface, following  the parameters that the command accepts:

up

Makes an interface available to be used by the IP layer. This option is implied when a direction is given in the command line. Also to reenable an interface that has been temporarily using the down option. This option corresponds to the flags UP and RUNNING.

down

Marks an interface inaccessible to the IP layer. This disables any IP traffic through the interface. It is important to realize that this clears the records of the routing table corresponding to that interface automatically.

netmask (mask)

This assigns a subnet mask to an interface. Network masks are essentially binary, and it is easier to make a binary hex conversion to a binary to decimal.

pointopoint (address)

This option is used for IP point-to-point which links involve only two hosts. This option is required, for example, to configure SLIP or PLIP interfaces. If you defined a point to point address, ifconfig displays the POINTOPOINT indicator.

broadcast (address)

The broadcast address is usually obtained using the network portion of the address and activating all the bits corresponding to the machine part.

irq

This option allows you to set the IRQ line used by certain devices.

metric (number)

This option can be used to assign a metric value to the routing table entry created for the interface. This metric is used by the Routing Information Protocol (RIP) to build routing tables for the network. The default value used by ifconfig is zero. If you are not running a RIP daemon, you do not need to use this option at all; if instead you use it, you only need to modify this value rarely.

mtu (bytes)

This sets the maximum transmission unit, or the maximum number of octets the interface is able to handle in one transaction.

arp

This option is specific to broadcast networks such as Ethernet or packet radio. It allows the use of ARP, the Address Resolution Protocol to detect the physical address of the machines connected to the network. For broadcast networks, this option is enabled by default. If ARP is disabled, ifconfig displays the NOARP indicator.

promisc

It puts the interface in promiscuous mode. In a broadcast network, this makes the interface receive all packets, regardless of whether they were for it or not. This allows network traffic analysis using packet filters and such, also called Ethernet snooping. This is a good technique for locating network problems that are otherwise difficult to detect. Tools such as tcpdump rely on this.

Leave a Reply

Your email address will not be published. Required fields are marked *