Linux Ifconfig

Education is not limited to just classrooms. It can be gained anytime, anywhere... - Ravi Ranjan (M.Tech-NIT)

Linux ifconfig

The command ifconfig stands for interface configurator. This command enables us to initialize an interface, assign IP address, enable or disable an interface. It display route and network interface.

You can view IP address, MAC address and MTU (Maximum Transmission Unit) with ifconfig command.

A newer version of ifconfig is ip command. ifconfig command works for all the versions.


  1. ifconfig  

Linux Networking ifconfig1

Look at the above snapshot, it shows the IP address of all three that is eth, lo and wlan.

Get details of specific interface

To find IP address of all three differently, use command

  1. ifconfig eth0  
  2. ifconfig lo  
  3. ifconfig wlan0

Linux Networking ifconfig2

Assigning IP address and Gateway

You can assign IP address and Gateway to an interface but these settings will be disabled after system reboot.


ifconfig eth0 <address> netmask <address>

Enable or Disable specific interface

To enable specific interface,

ifup eth0 

To disable specific interface,

ifdown eth0

Setting MTU size

By default MTU (Maximum Transmission Unit) size is 1500, you can change size as per your wish.

  1. Ifconfig eth0 mtu xxxx  
  3. Replace xxxx with size.