ip Command: Tutorial & Examples

Display information about network interfaces

The ip command is a newer command-line utility that is used to view and configure network interfaces on a device running the Linux operating system. It is designed to replace the older ifconfig command, which is still widely used but has been deprecated in modern Linux distributions.

The ip command has a number of advantages over ifconfig, including a more flexible and powerful syntax and the ability to view and configure a wider range of network options.

You can use the ip command to view the current configuration of a network interface by running the following command:

ip address show

This will display a list of all the network interfaces on the device, along with their current configuration.

You can also use the ip command to set the configuration of a network interface by running a command like the following:

ip address add IP_address/prefix dev interface_name

Replace IP_address with the IP address you want to assign to the interface, prefix with the subnet prefix, and interface_name with the name of the network interface you want to configure.

Here is an example of how to set the IP address and netmask of the eth0 interface using the ip command:

ip address add 192.168.1.10/24 dev eth0

This will set the IP address of the eth0 interface to 192.168.1.10 and the netmask to 255.255.255.0.

In addition to setting the IP address and netmask, the ip command can also be used to bring a network interface up or down, enable or disable promiscuous mode, and perform other network configuration tasks.

CleverUptime uses the ip command to detect IP addresses and network interfaces on your server.

Except where otherwise noted, content on this site is licensed under a CC BY-SA 4.0 license CC BY SA