Learn IP Command to Manage Networking on Linux

IP (Internet Protocol) command is used to manage, view network configuration on a Linux system.  The command ‘IP’ and its uses are same in all the Linux family – Fedora, Debian, Ubuntu,Red Hat, CentOS and Arch Linux etc. It is the command-line utility that is part of iproute2 package installed in kernel.

This article is going to demonstrate usage of IP command and how IP command is used to manage networking on Linux system

The syntax of IP command is as follow:



  • OBJECTS: Are address, route, rule, tunnel etc.
  • OPTIONS: Are version, statistics, details, timestamp etc.

The best way to use any command is look at its help menu and summarize it’s syntax.  For example, we want to know about the syntax of IP command, we can find it using the help option as below:

$ ip --help


We need to use options and object as defined in the help section. We are going deep into each object of IP command as far as possible. Let’s see some examples cases.

1)  Getting IP information

First you need to find out the interfaces and related information. For this just type,

$ ip addr

The following picture shows output of ‘ip addr’ command. There are three interfaces lo (loopback), enp9s0 and wlps0. The loopback interface has IP address of The interface enp9s0 doesn’t have any IP address. The interface wlp6s0 has ether address of 54:35:30:92:ac:09 with the IPv4 address of


To see just the specific interface information,

$ ip addr show [ INTERFACE_NAME]

Likewise, To list IPv4 address,

$ ip -4 addr

To list IPv6 address,

$ ip -6 addr

2) Assign and Remove(Flush) IP address

To add IP address to a interface on the fly,

$ sudo ip addr add [ IP_ADDRESS] dev [ INTERFACE_NAME]

$ sudo ip addr add dev enp9s0
$ sudo ip addr add brd + dev enp9s0

To remove IP address from an interface,

$ sudo ip addr del [ IP_ADDRESS] dev [ INTERFACE_NAME]

$ ip addr del dev enp9s0

3)  Display, Modify and Delete Route table

Route table contains set of rules which determine where your network traffic will flow or your subnet is directed. To see current route table in Linux system use,

$ ip route

In the following output, we can summarize,

  • Default route is going from which is DHCP provided IP.
  • For the network the interface is wlp6s0.


If you want to add new route you can do just by,

$ sudo ip route add [ IP_ADDRESS] dev [ INTERFACE]

Remember: Adding route in this way is not persistent. Meaning that after reboot they will be deleted.

Similarly, to add a new route via gateway,

$ sudo ip route add [ IP_ ADDRESS] via [ GATEWAY_IP]

Or there might be the cases where you need to add a route for all addresses via default gateway,

$ sudo ip route add default [ IP_ADDRESS] dev [ INTERFACE_NAME]

To delete existing route table entry use

$ sudo ip route del [IP_ADDRESS] dev [ INTERFACE_NAME]

To delete default route use,

$ sudo ip route del default

4) Link Layer information

The network devices which have driver loaded are shown in link information.

To see link-layer information use the command,

$ ip link show

To see transferred or dropped packet on the interfaces use,

$ ip -s link

In following output, you can see the interface status as well as received, sent, error and dropped packets.


You can also set interface up/enable or down/disable.

To bring up a network interface use,

$ ip link set [ INTERFACE] up

To bring a network interface down use,

$ ip link set [ INTERFACE] down

To improve the network performance you can set MTU (Maximum Transmission Unit):

$ ip link set mtu [ NUMBER] dev [ INTERFACE]

5) Display, Modify IP neighbor/ ARP entries

Neighbour  entries are also called address resolution protocol (ARP).  ARP is a procedure for mapping a dynamic IP address to a permanent physical MAC address in a local area network.

To display neighbour table, use following command,

$ ip neigh show


The state of device can be either of the following:

  • REACHABLE – The entry is reachable
  • PERMANENT – Permanent entry in the table
  • STALE – The entry is valid but is unreachable
  • DELAY – The kernel system is waiting for validation from STALE entry.

To add new neighbor entry use,

$ sudo ip neigh add [ IP_ADDRESS] dev [ INTERFACE ]

To remove existing neighbor entry,

$ sudo ip neigh del [ IP_ADDRESS} dev [ INTERFACE ]


IP command is helpful for administrator for managing networking on linux servers. This tutorial helps you to use ip command efficiently. You can also refer manual page of IP command for the reference.

Also Read : 11 rsync command examples for Linux Beginners

Leave a Comment

eight + 5 =