Most of the Linux Admins are familiar with the ‘ifconfig’ tool for managing the network connections & interfaces but there are other commands as well that can be used to manage network connections and one of those CLI commands utility is ‘ip command’. IP command is rather a new introduction to Linux but still, it has been around for quite some time. It is one of the most important commands & we as Linux enthusiasts or System Admin should know how to use it.

In this tutorial, we will learn about IP command with the help of some examples. If also wants to know about ‘ifconfig command’, you can also refer to our tutorial here.

Recommended Read: SpeedTest-CLI: Run network speedtest on Linux CLI

Also Read: Configure IP address (Networking) in RHEL/CentOS 7

Now let’s start this tutorial,

IP Command examples

1- List all network interfaces & related information

To get the list all network interfaces available on our system & information like IP address, gateway etc for these network interfaces, then the command is,

# ip addr show

Alternatively, you can also use,

# ip a

2- List information for a single interface

To only get information for a single interface, we use the following command,

# ip a enp0s3

Where ‘enp0s3’ is the name of the network interface.

3- Bring UP /enable a network interface

To enable a network interface that is currently disabled, execute the following command from the terminal,

# ip link set enp0s3 up

4- Bring DOWN /disable a network interface

To disable a currently enabled network interface, we can use the following command,

# ip link set enp0s3 down

5- Add a new IP address to an interface

To add a new IP address to a network interface, command to be used would be,

# ip addr address add dev enp0s4

or we can also use the following command,

# ip a add dev enp0s4

6- Remove an IP address from an interface

Command to remove an IP address from a network interface is similar to mentioned above. The exact command is,

# ip addr address del dev enp0s4

Alternatively, you can also use,

# ip a del dev enp0s4

7- Add multiple IP addresses to a single interface

Similar to how we added a single IP address to an interface, we can also assign multiple IP addresses to single network interface as well,

# ip a add dev enp0s4

# ip a add dev enp0s4

# ip a add dev enp0s4

8- Updating the routing table of the system

We can also update a static route on our system, or can also change the default gateway of our network interfaces or we can even reject traffic to a network range using the following command,

# ip route

We have a detailed tutorial for IP route command HERE, please read this tutorial for detailed instructions.

9- Monitoring the network interfaces

IP command also provides us with a utility to continuously monitor all the network interfaces, IP address & their routes etc. Command is

# ip monitor

10- Getting Help

We have only discussed some of the most used ip command options here & there are plenty of other options as well. & like with any other command, we can get a complete list of options that we can use with the following command,

# ip help

With this, we end this tutorial on how to use IP commands for beginners. Please do send in any questions or queries using the comment box below.

If you think we have helped you or just want to support us, please consider these:-

Connect to us: Facebook | Twitter

Linux TechLab is thankful for your continued support.