The ip command v/s the ifconfig command

The ip command is a replacement for the ifconfig command. In earlier versions of Linux, the ifconfig command was the default utility for checking and verifying IP configuration. The ifconfig command does not support many modern features that were not relevant in earlier times.

The ifconfig command is deprecated. Although some Linux distributions still include the ifconfig command for backward compatibility in their current version of Linux, they may consider gradually removing it from their upcoming Linux versions.

Because of this, even if the ifconfig command is still available on some Linux distributions, you should use the ip command for all IP validation and verification-related tasks. The ip command is designed to meet the requirements of modern networks.

The following table lists how to perform some common tasks using both commands.

ifconfig command Task ip command
ifconfig Show ip configuration of all interfaces ip address show
ifconfig [interface] Show ip configuration of the specified interface ip address [interface]
ifconfig [interface] down Bring the specified interface down ip link set [interface] down
ifconfig [interface] up Bring the specified interface up ip link set [interface] up
ifconfig [interface] [ip address]
ifconfig [interface] [subnet mask]
Assign a temporary IP address to the specified interface ip address add [ip address/subnet mask] dev [interface]

The following image shows how to list the IP configuration of all interfaces using both commands.

ifconfig or ip commands

The following image shows how to change the link state information of an interface using both commands.

ifconfig v/s ip commands

The following image shows how to assign a temporary IP configuration on an interface using both commands.

comparing ip command with ifconfig

Conclusion

The ifconfig command is deprecated. Some Linux distributions have removed it, while others still include it to provide backward compatibility. No matter whether the ifconfig command is available or not, you should always use the ip command.

ComputerNetworkingNotes Linux Tutorials The ip command v/s the ifconfig command