September 21, 2025
Linux Command Line

Linux Command Line

The ‘ifconfig’ command is a powerful tool that allows users to configure and manage network interfaces on a Linux system. This command is commonly used to assign IP addresses, configure network masks, and set up network interfaces for communication. In this article, we will explore the basics of using the ‘ifconfig’ command and provide some examples of its usage.

General Use

To use the ‘ifconfig’ command, open a terminal window and enter the command followed by the name of the network interface that you wish to configure. For example, if you wish to configure the ‘eth0’ interface, you would enter ‘ifconfig eth0’. You can also display all interfaces by using the command ‘ifconfig’

The ‘ifconfig’ command can be used to view the current status of a network interface. When you enter the command followed by the name of the interface, you will see information such as the IP address, netmask, and status of the interface.

IP Address

One of the most common uses of the ‘ifconfig’ command is to assign an IP address to a network interface. This can be done by using the ‘ifconfig’ command followed by the name of the interface and the IP address that you wish to assign. For example, ‘ifconfig eth0 192.168.1.100’ would assign the IP address of ‘192.168.1.100’ to the ‘eth0’ interface.

The Netmask

Another important use of the ‘ifconfig’ command is to configure the netmask of a network interface. The netmask is used to determine the size of the network and the range of IP addresses that can be used on the network. To configure the netmask of an interface, use the ‘ifconfig’ command followed by the name of the interface and the netmask. For example, ‘ifconfig eth0 netmask 255.255.255.0’ would configure the netmask of the ‘eth0’ interface to ‘255.255.255.0’.

Managing the interface

The ‘ifconfig’ command can also be used to bring a network interface up or down. To bring an interface up, use the ‘ifconfig’ command followed by the name of the interface and the keyword ‘up’. For example, ‘ifconfig eth0 up’ would bring the ‘eth0’ interface up. To bring an interface down, use the ‘ifconfig’ command followed by the name of the interface and the keyword ‘down’. For example, ‘ifconfig eth0 down’ would bring the ‘eth0’ interface down.

The ‘ifconfig’ command is a powerful tool for configuring and managing network interfaces on a Linux system. It can be used to view the current status of a network interface, assign IP addresses, configure netmasks, and bring interfaces up or down. Understanding the basic usage of the ‘ifconfig’ command is essential for any Linux administrator or power user.

Examples:

  1. To view the current status of a network interface: ifconfig eth0
  2. To assign IP address to a network interface: ifconfig eth0 192.168.1.100
  3. To configure the netmask of a network interface: ifconfig eth0 netmask 255.255.255.0
  4. To bring an interface up: ifconfig eth0 up
  5. To bring an interface down: ifconfig eth0 down

See our list of 75 Linux commands you should know about.

0 0 votes
Article Rating
Subscribe
Notify of
guest
0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x
Share via
Copy link
Powered by Social Snap