Use ifconfig Command to resolve TCP/IP Problems on Linux
The ifconfig command has not been completely removed from the Red Hat Linux operating system. However, it has been deprecated and is no longer the preferred way to manage network interfaces. The ip command is now the preferred command for managing network interfaces in Red Hat Linux.
If you try to run the ifconfig command in Red Hat Linux, you will receive a warning message that the command is deprecated. You can still use the ifconfig command, but it is not recommended.
Here are some of the reasons why the ifconfig command has been deprecated:
It is not as powerful or flexible as the ip command.
It does not support some of the newer features of Linux networking.
It is not consistent with the other networking commands in Linux.
Use the IP Command
If you are using Red Hat Linux, you should use the ip command instead of the ifconfig command. The ip command is a more modern command that provides a wider range of features for managing network interfaces. It is also more consistent with the other networking commands in Linux.
Here are some examples of how to use the ip command to manage network interfaces:
To display information about all network interfaces, use the following command:
To set the IP address of an interface, use the following command:
ip addr add 192.168.1.100/24 dev eth0
To enable an interface, use the following command:
ip link set eth0 up
To disable an interface, use the following command:
ip link set eth0 down
ifconfig's default action displays data on each active interface. If /sbin is not in your PATH variable, you must type the command's entire path,
to display the data. To see the status of just the eth0 interface, tell ifconfig to display this interface by typing ifconfig eth0 at a command prompt. ifconfig's -a option shows all interfaces, whether they are active or not. View the carousel below to view a typical output from ifconfig -a.
Correcting network parameters
If ifconfig indicates that some parameter is configured incorrectly, you can fix the problem by editing the interface's network script. Network scripts are located in the /etc/sysconfig/network-scripts directory. The first Ethernet interface's script is called ifcfg-eth0, and the second is called ifcfg-eth1. The following image shows an ifcfg-eth0 file that has the same IP address and netmask as the interface.
To make a change, edit the file to update, or correct the network information;, executing ifup eth0 will bring up the eth0 interface, and load the new parameters. If the interface is already activated, then precede this command with "ifdown eth0".
In the next lesson, you will learn how to troubleshoot TCP/IP with arp.