Ifconfig Command

The ifconfig command stands for "interface configuration" operating systems to display and configure network interfaces on a system. It shows information such as IP addresses, network masks, and interface status. You can also use it to configure network interfaces, although newer systems often use the ip command instead.Additionally, it can be used to configure network settings such as assigning IP addresses, setting netmasks, enabling/disabling interfaces, and more. However, in recent years, ifconfig has been deprecated in favor of the more versatile ip command.

Here's a breakdown of its functionalities:

Displaying Interface Information:

When run without any arguments, ifconfig lists all active network interfaces along with their configuration details such as IP addresses, MAC addresses, network status (up/down), and packet statistics.

Activating/Deactivating Interfaces:

You can use ifconfig to bring up (up) or bring down (down) network interfaces. For example, ifconfig eth0 up will activate the Ethernet interface eth0, while ifconfig eth0 down will deactivate it.

Assigning IP Addresses:

You can assign an IP address to a network interface using the ifconfig command. For instance, ifconfig eth0 192.168.1.2 assigns the IP address 192.168.1.2 to the eth0 interface.

Setting Netmasks:

Netmasks define the range of IP addresses within a network. You can set the netmask for an interface using ifconfig. For example, ifconfig eth0 netmask 255.255.255.0 sets the netmask to 255.255.255.0 for the eth0 interface.

Changing MAC Addresses:

Although this is not typically recommended or necessary, ifconfig can be used to change the MAC address of a network interface. For example, ifconfig eth0 hw ether 00:11:22:33:44:55 changes the MAC address of eth0 to 00:11:22:33:44:55.

Displaying Specific Interface Information:

You can specify a particular interface to display its information. For example, ifconfig eth0 will only display information about the eth0 interface.

It's worth noting that ifconfig has been deprecated in favor of the more modern ip command, which provides more advanced functionality and is more consistent across different Linux distributions. However, ifconfig is still widely used and understood, especially by those familiar with older Unix systems.

What is Public and Private IP in Linux?

In the realm of networking, both in Linux and other operating systems, IP addresses are categorized as either public or private. These designations are crucial for facilitating communication between devices on a network, whether it’s the global internet or a local intranet. Let’s delve into the distinctions between public and private IP addresses in Linux.

How to Find Your IP Address in Linux | ifconfig Command:

Knowing your IP address is fundamental for network administration, troubleshooting, and various Linux system tasks. In this article, we will explore several methods to find your IP address in a Linux environment. Whether you are a seasoned Linux user or just getting started, understanding these methods will empower you to navigate and manage your network effectively.

ifconfig (interface configuration) command is used to configure the kernel-resident network interfaces. It is used at the boot time to set up the interfaces as necessary. After that, it is usually used when needed during debugging or when you need system tuning. Also, this command is used to assign the IP address and netmask to an interface or to enable or disable a given interface.

Syntax of `ifconfig`Command in Linux

ifconfig [interface] [options]

Where:

[interface] is the network interface you want to configure or display information for (e.g., eth0, wlan0).

[options] are various command-line options that can be used to modify the behavior of ifconfig.

Options available in `ifconfig` Command in Linux

add addr/prefixlen:-

Add an IPv6 address to an interface

Syntax: ifconfig interface add addr/prefixlen

del addr/prefixlen:-

Remove an IPv6 address from an interface.

Syntax: ifconfig interface del addr/prefixlen

[-]arp:

Enable/disable the use of ARP protocol on an interface

Syntax: ifconfig interface [-]arp

[-]promisc:-

Enable/disable promiscuous mode on an interface

Syntax: ifconfig interface [-]promisc

[-]allmulti :-

Enable/disable all-multicast mode for an interface

Syntax: ifconfig interface [-]allmulti

mtu N:-

Set the Maximum Transfer Unit (MTU)

Syntax: ifconfig interface mtusize size

-a :-

Display all interfaces, including those that are down

Syntax: ifconfig -a

-s:-

Display a short list, instead of details

Syntax: ifconfig -s

-v:-

Run the command in verbose mode

Syntax: ifconfig -v

up:-

Activate the driver for the given interface

Syntax: ifconfig interface up

down:-

Deactivate the driver for the given interface ifconfig interface down

||