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>
Latest posts by Ruwantha Nissanka (see all)
- 4 ways to hide your identity using linux - January 18, 2021
- How To Install Kali Linux in Virtualbox - December 31, 2020
- Kali Linux : The OS That Hackers Use - December 31, 2020
- How to monitor user activity in Linux with Acct - December 30, 2020
- Debsecan : You will not miss another security update - December 28, 2020