Networking is the essential part of the device to provide the services. The network interface is the connection between the device and a network. In Linux, the system links the software side with the hardware side as network interface parameters. How do I display and configure the network interfaces in Linux? The configuration of networks in Linux is simple and can be done by a command-based system in Linux. There are a couple of commands that can be used to configure and list network interface parameters in Linux. We will discuss them in detail in the below section of the guide.
Linux Commands to View Network Interface Parameters
You can use the following commands to list the available network interfaces in Linux:
- ifconfig command
- ip command
- netstat command
- nmcli command
- tcpdump command
1: Use ifconfig Command to Display Network Interface Parameters
In Linux, ifconfig, also known as interface configuration, is the command line utility used for the configuration, and manages the network interface parameters. This command is used to view the network interface parameters, set the IP address to parameters, and enable and disable the parameters.
If you run the ifconfig command without any argument it will display the list of all active interfaces:
The output shows the following information:
- List of active interfaces enp0s3 and l0, they vary for each system
- The hardware MAC address, netmask, IP, broadcast addresses
- The maximum transmission value MTU
If you execute the ifconfig command with -a parameter it will list down all the active and non-active parameters:
For displaying the details of the specific network parameter, run the ifconfig command with the name of the parameter as an argument:
Here in our case, we are executing the ifconfig command to display the information of lo (loopback) interface parameter:
For displaying the shortlist of the interface parameters:
Use ifconfig Command to Set Network Interface Parameters
Using the ifconfig command, you can also configure the parameters. If you want to enable the specific parameter, use the up or ifup with the interface name:
For disabling the specific network interface use the down or ifdown flag with the specified network interface:
Assign the IP address to a specific interface with the following command:
Here we are assigning the Ip address 22.214.171.124 to the enp0s3 interface with the following command:
2: Other Network Utilities for Displaying the Network Interface Parameters in Linux
i: ip command is used to show or config the routing, devices, and tunnels. It is the replacement of the ifconfig command. Execute the following command in the Linux terminal to display the IP address and other information of the network interface parameters:
ii: nmcli it is used to control the Network Manager and report the network information:
iii: netstat is the command line tool for monitoring the incoming and outcoming network traffic on a device. It is helpful in analyzing and troubleshooting the problems and amount of traffic on the network:
iv: tcpdump it is also a command line package manager for monitoring the network traffic, and is a powerful data-network packet analyzer. It listens to the network traffic and displays the information of the packet set by us about specific protocols and ports:
Linux needs an internet connection to provide the services, if the connection fails the service will fail.
The admin must have appropriate commands and tools to analyze the network interface parameters.
In this article we have covered the commands to display and configure the network interface parameters.