Linux IP Command – Examples + Options

Last updated: March 15, 2022

The Linux IP command is a versatile tool that helps users in configuring network interfaces of Linux systems. It is the preferred command over the ifconfig command which is now deprecated. The IP utility is used to perform a wide range of network administration tasks. You can use it to modify network interfaces and configure network parameters such as the IP address of a network interface, manage the routing table and ARP cache, and configure the MTU. 

In this tutorial, we learn about Linux IP command and demonstrate, through examples, how you can use this powerful tool to perform several network administration tasks.

How to use the IP Command in Linux

The IP command is provided by default in modern Linux operating systems, and hence no installation is required.

The IP command takes the following basic format:


The OPTION refers to the various flags you can use with the command to modify the output. The  OBJECT refers to the various subcommands that you can use alongside the IP command.

Some of the widely used sub-commands include:

  • address( addr / a ) - This is used to view/display or change an IP address.
  • link ( l ) -  Used to display the state of a network interface.
  • route ( r ) - Used to view or modify the routing table.
  • neigh ( n ) - Displays and modifies the ARP table ( neighbor objects ).

To display a list of arguments for each of these objects use the syntax:

ip OBJECT help

Manage IP Addresses

Another common use of the IP command is managing IP addresses associated with network interfaces. This includes displaying IP addresses, configuring static routing, and even deleting the ip addresses from the network interfaces. Let us have a look at how you can accomplish each of these.

Display information about IP Addresses

To display or view a list of all the network interfaces alongside their associated IP addresses, run the command:

ip address


ip addr


ip addr show

The output provides you with all the network interfaces (including the loopback interface) their associated IPv4 and IPv6 addresses alongside other information such as the maximum transmission unit (mtu) and transmit queue length (txqueuelen).

show ip address

To narrow the output to just one network interface, use the syntax:

ip address show interface-name

For example,  to view the IP address of interface ens3, run:

ip address show ens3 
show IP address of specific interface

In addition, you can use the -4 or -6 options to specify protocol address selection. For example, to display IPv4 addresses, run:

ip -4 a
display IPV4 address

To display IPv6 addresses, type:

ip -6 a
display IPv6 addresse

Add IP Address to an interface 

To add an IP address to a network interface, use the following command where the ip_address should be accompanied by a subnet mask.

ip addr add [ip_address] dev [interface-name]

For example, to assign an ip address e.g and netmask to the ens33 network interface run the command:

sudo ip addr dev ens33

To view the assigned ip address, once again, run:

ip addr show ens33
add IP address and show ip

Alternatively, you can use the CIDR notation instead of specifying the netmask.

sudo ip addr dev ens33
add ip use CIDR

To add a broadcast address to an interface, use the syntax:

ip addr add brd [ip-address] dev [interface-name]

Delete IP address from an interface 

If you wish to delete an IP address from a network interface use the syntax as follows:

ip addr del [ip_address] dev [interface]

For example, to delete the IP address we have just assigned to the interface, we will run the command:

sudo ip addr del dev ens33
delete ip address

For more ip addr command options, run the command:

ip addr help

How to manage network interfaces

We will begin by looking at how you can manage network interfaces. This includes displaying network interface information and modifying the status of the interfaces.

Display  network interface  information

To list all the network interfaces on your system, use the link subcommand. It manages and displays the status of all the network interfaces. It allows you to display interface information such as the interface name, state (whether UP or DOWN) maximum transmission unit (MTU), and transmission queue (txqueuelen).

To view the information of all the network interfaces on your system, run the following commands:

ip link


ip link show

From the output shown below, you can see information about all the network interfaces including the loopback address (lo) and ens33.

display all network interface information

To narrow down and display information about a specific network interface name, use the syntax

ip link show dev interface-name

For example, to display link information of ens33 we will execute the command.

ip link show dev ens33
specific interface information

To monitor network traffic such as the total number of packets transmitted and received and even errors, of all the interfaces, use the -s option.

ip -s link
display network statistics on interfaces

Similarly, you can display the same information for a single network interface:

ip -s link ls ens33
network statistics for specific interface

To display all running network interfaces execute:

ip link ls up
display running network interfaces

Modify Network Interface Status 

The ip link command can also be used to change the status of a network interface from UP to DOWN or vice versa. 

To bring down or deactivate an interface, use the syntax as follows. Be advised that you need sudo or root privileges to change the state of an interface.

sudo ip link set interface-name down

For example, to deactivate interface ens33, run the command

sudo ip link set ens33 down

To confirm the interface is deactivated, you can try pinging a remote host. You should get the alert: ‘Network is unreachable’.

set interface down

To activate or bring an offline ip link up,  run the command:

sudo ip link set ens33 up
set interface up

Change the txqueuelen 

The IP command can also be used to modify the transmit queue length - txqueuelen for a network interface. . This is the network interface value that sets the number of packets allowed per kernel transmit queue of an interface. 

By default, this value is set to 1000, and the txqueuelen is denoted by the qlen parameter. You can verify this using the following commands:

ip address


ip addr


ip a
output of ip a command

To change the txqueuelen value, use the syntax:

sudo ip link set txqueuelen [number] dev [interface]

For example, to set the txqueuelen value to 5000, run the command

sudo ip link set txqueuelen 5000 dev ens33

To confirm the change, run:

ip a show ens33 | grep -i qlen
set txqueuelen

Change the MTU

MTU, short for Maximum Transmission Unit, is the size of the largest protocol data unit  ( PDU ) that can be transmitted in a network. By default, this is set to 1500  bytes on most Linux systems.

ip a show ens33
display MTU

To change or set the MTU of a network interface, use the syntax:

sudo ip link set mtu [number] dev [interface]

For example, to set the MTU of interface ens33 to 2000 run the command:

sudo ip link set mtu 2000 dev ens33
set mtu

For additional options with the command run the help command shown.

ip link help
ip link help

Manage IP Routing Table

In managing the routing tables, the route object is normally used along with these three sub-commands:  list, add, and del. These sub-commands are used when displaying the kernel routing tables, adding and deleting routes respectively.

Display IP Routing Table

To view the routing table, run the following command

ip route


ip route list
show routing table

To view the route entries for a specific network, for instance, run the command:

ip route list
show specific network routes

Modify IP Routing Table

You can add a new route to the routing table using the syntax:

ip route add ip-address via default gateway-address

For instance, to add a routing table entry such as via, run the following command. Here, is the default gateway. In most cases, the default gateway is the ip address of the default router on the local network.

ip route add via

To confirm the routing entries, type:

ip route
add route

Suppose you want to add a default route, via a local gateway such as to be accessed on eth0, type:

ip route add default via dev eth0

Delete an IP Route

To remove or delete a route entry from the routing table, run the following command:

ip route del via
ip route delete

To delete a default route, execute the following command:

ip route del default

For more ip route command options, run the command:

ip route help

Manage Neighbor Entries

Neighbor entries are synonymous with ARP ( Address Resolution Protocol) Tables. ARP is an internet protocol that connects a link-layer address such as a MAC address to a corresponding  IPv4 address.

The ip neigh ( you can also use ip neigh, or ip neighbor) command allows you to display and manage ARP cache. In this section, we shall see how you can display and modify neighbor entries.

Display IP Neighbor Entries

To display existing entries in the ARP table, run the following command:

ip neigh show
display arp table

A device can be in 4 states:

  1. REACHABLE - This indicates a valid entry.
  2. PERMANENT - This is a persistent entry that can only be removed by the administrator.
  3. STALE - This is a valid yet unreachable entry. The Linux kernel needs to look for it at the first transmission.
  4. DELAY - This is a state that indicates that the kernel is on standby waiting for validation from the stale entry.

Modify IP Neighbor Entries

To add a new entry to the ARP table, use the syntax:

ip neigh add [ip_address] lladdr mac-address dev [interface]

For example, to add an entry of network device with IP and MAC address A4:C3:F0:9F:56:B9 run the following command.

ip neigh add lladdr A4:C3:F0:9F:56:B9 dev ens33
add entries in ARP table

To delete an entry, use the following syntax:

ip neigh del [ip_address] dev [interface]


ip neigh del dev ens33
delete arp table entry

For additional options of the ip neigh command, use the following syntax.

ip neigh help
ip neigh help


That was a round-up of widely used IP commands. As you have seen, the IP command is a useful tool in configuring network interface parameters such as IP addresses, MTU as well as modifying the kernel routing table. It performs similar tasks to the ifconfig command and ships with modern Linux distributions hence no installation is required.

It’s our hope that by now you have a clear understanding of the Linux IP command. For more command options simply visit the man pages by running the man ip command.



Please add comments below to provide the author your ideas, appreciation and feedback.

Leave a Reply

Leave a Comment