Enhance your Career in Networking With IPinBits!!!​

Linux for network engineers – ifconfig command

In the quest of learning the Networking stack of Linux, today we will study the ifconfig command. This command is as helpful as “sh ip interface brief or show interface terse” commands for network engineers. Lets have a look on what’s included in the ifconfig.

Let’s see out Juniper MX router interfaces :-

Now same info can be seen in the Linux shell (type “start shell” in juniper cli and you will be in FreeBSD linux shell)

Now where do a network engineer will use this command output apart from looking cool. Below are the scenarios :-
1. To check the interface is up or down in the linux. It contains all the interfaces(including the kernel)
2. To check interface parameters in linux kernal such as mtu, type, ip address (ipv4/ipv6), encapsulation and mac address.
3. To use the tcpdump tool which helps us to capture the packets in/out of the interface. TCPDUMP requires the linux interface (which can differ from normal CLI interface name).

A superuser(root) can use ifconfig to change interface settings from the command line; here is the syntax:

ifconfig interface [aftype] options | address …

… and some of the more useful calls:

ifconfig eth0 down – shut down eth0
ifconfig eth1 up – activate eth1
ifconfig eth0 arp – enable ARP on eth0
ifconfig eth0 -arp – disable ARP on eth0
ifconfig eth0 netmask – set the eth0 netmask
ifconfig lo mtu 2000 – set the loopback maximum transfer unit
ifconfig eth1 – set the eth1 IP address

Related blog posts