The ip command is a useful tool for assigning an address to a network interface and/or configure network interface parameters on Linux operating systems.  It is used to bring interfaces up or down, assign and remove addresses and routes, manage ARP cache, and much more. This command replaces old good and now deprecated ifconfig command on modern Linux distributions. In this article, we will discover the practical use cases of this command

Display network interfaces information

You can use the following command to display all ip addresses associated on all network interfaces:

#ip a

Display information about a single interface

It is also possible to specify and list particular interface details.

#ip addr show dev <interface>

Assign IP address to an interface

Use the following command to assign an IP address to an interface

#ip addr add <ip_address>/<netmask> dev <interface>

Add a broadcast address to an interface

We have to set the broadcast address manually as the ip command does not set any broadcast address by default.

#ip addr add brd <ip_address> dev <interface>

Delete an IP address from an interface

To delete a previously set ip address, use the following command:

#ip a del <ip_address> dev <interface>

Display IP routing table

You can view the IP routing table by using the following command

#ip route list

View routing for a distinct network

Run this command to view routing for a specified network:

#ip route list <ip address>

add a new entry in the routing table

#ip route add <ip_address> dev <interface>

delete an existing entry in the routing table,

#ip route del <ip address>

display neighbor tables

#ip neigh show

Add a new table entry

#ip neigh add <ip address> dev <interface>

remove an existing ARP entry

#ip neigh del <ip_address> dev <interface>

 

 

 

 

 

The following two tabs change content below.
Ruwantha Nissanka is a Professional Cyber Security Engineer from Sri lanka with having a demonstrated history of providing cyber security services for multiple organizations in Sri Lanka. He is a positive person who wants to believe the best in others and he likes to help, encourage people and make them feel good.