ifconfig command linux

ifconfig command in Linux or ubuntu 20.04

Ifconfig stands for (interface configuration), it is used to check systems network interface configuration. Like you can view interface Ip address and change Ip address. So in this article, we see to use of ifconfig command in Linux.

Therefore with ifconfig, you can only give IP to interface temporarily. once you boot system the given Ip address is flush.

Use of ifconfig in Linux

Open your terminal and run ifconfig command with no option, then you will see all your up interface wheater interface has Ip address or not.


enp0s25: flags=4099 <UP,BROADCAST,MULTICAST> mtu 1500
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
device interrupt 17 memory 0xd0700000-d0720000
lo: flags=73 mtu 65536
inet netmask
inet6 ::1 prefixlen 128 scopeid 0x10
loop txqueuelen 1000 (Local Loopback)
RX packets 2587 bytes 242135 (242.1 KB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 2587 bytes 242135 (242.1 KB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
wlo1: flags=4163 <UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet netmask broadcast
inet6 fe80::f702:736c:b0f3:6ba3 prefixlen 64 scopeid 0x20
RX packets 188688 bytes 243362256 (243.3 MB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 110303 bytes 14517209 (14.5 MB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

So in the above output,

you will see ifconfig output without any option it will give you all your network interface which is up. In output, enp0s25 is my LAN interface. LAN interface is your machine physical interface which you connect through LAN cable which would be cat 5, cat 5e or cat 6.

so in my ifconfig output, second is lo or loopback interface which you can use to test your own LAN interface is work properly.

wlo1 is my wireless card. usually, all wireless card names start with w letter.

every Linux distribution has a different naming system I am here using ubuntu but in some Linux, they represent Lan interface with eth1and second is eth2 and so on. Check your configuration, or consult your documentation, to determine the exact names of your interfaces.

ifconfig -a example

so now you have more than one network card and from that only one is up so with ifconfig only that up card is shown to you. if you want to see all interface either they are up or not you run ifconfig with (a) option.

ifconfig up and down example

The up and down option is used to enable or disable the interface. when you change the existing IP address of interface this up and down option is used to up that new IP to interface.

so to up the down interface. the command is ifconfig <interface name> up

likewise you can down the up interface with ifconfig<space><interface name><space>down.

Most importantly only root users can do interface up and down. so either you have logged with root or you can use these options with Sudo permission. Non-root users cant do interface up or vice-versa.

Giving Ip address with ifconfig command

you can give only static IP with ifconfig you cant set ifconfig with DHCP to give IP through DHCP is different thing that we discuss in another tutorial.

So to give manual IP the ifconfig command is ifconfig <space><interface name><space><IP address>. This how we given ip address to interface.

To give Netmask address with ifconfig command is ifconfig<space><interface name><space><netmask><space><netmask IP>.

to give netmask we use netmask option to understand ifconfig that it is netmask address otherwise it will accept that netmask as an IP address.

you don’t need to run that command separately we can run that two commands in a single line.

sudo ifconfig enp0s25 netmask

So in the above command, you can see I give Ip and netmask in a single command I’ll give Ip address which netmask is on interface enp0s25.

If you give IP address with ifconfig so this IP only exists until your boot system. Therefore once you boot system. your temporary IP in gone.

ifconfig with interface name

you can see a particular interface IP address. it is useful when your server has lots of Lan cards and you have to see only one interface information.

ifconfig -s

With s option, ifconfig will give you some information as to when you run only ifconfig but with s option, you see that information in lines.

ifconfig linux command
ifconfig Linux command

The ifconfig tunnel

The tunnel option is used to create a new SIT device. you can tunneling to the given destination with tunnel option.

ifconfig media type

This option is used to set Set the physical port or medium type to be used by the device. Not all devices can change this setting and those that can 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.

ifconfig pointopoint

This pointopoint option you can enable point to point mode for interface. it like this is a direct link between to machine. if a machine sends the packet only other machines can listen nobody else can listen.

multicast with ifconfig

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

hardware class address in ifconfig

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).

arp option with ifconfig

With arp option you can enable or disable arp protocol on a specific interface. arp stands for address resolution protocol, The Address Resolution Protocol is a communication protocol used for discovering the link-layer address, such as a MAC address, associated with a given internet layer address, typically an IPv4 address. This mapping is a critical function in the Internet protocol suite.

promisc mode in ifconfig

This mode helps you to enable Promiscuous mode in an interface. with this mode, you will receive all packet in your network it doesn’t matter that packet belongs to you or not. this mode is used to packet sniffing by hackers

In IEEE 802 networks such as Ethernet or IEEE 802.11, each frame includes a destination MAC address. With non-promiscuous mode, when a NIC receives a frame, it drops it unless the frame is addressed to that NIC’s MAC address or is a broadcast or multicast addressed frame. In promiscuous mode, however, the NIC allows all frames through, thus allowing the computer to read frames intended for other machines or network devices.


In this article, we see how can you use ifconfig Command in Linux and its option there are lots of option in ifconfig but here I cover some which I use mostly like ifconfig to see currently up interface IP address and ifconfig with a to see all interface doesn’t matter what interface is up or down.

Ifconfig option up and down to enable or disable the interface and with the help of ifconfig to give temporary IP address and netmask address.

I hope you enjoy my article. please subscribe to our newsletter to read my articles and share this to grow To Improve this article if you find anything incorrect so please comment below and I will update. to check out my home page click HERE one thing to remember On modern Linux systems, the IP command has replaced ifconfig which I cover in next article.

Reference: Wikipedia

2 thoughts on “ifconfig command in Linux or ubuntu 20.04”

Leave a Comment

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