The ip
command is a versatile tool for managing and querying network interfaces and IP addresses on a Linux system. Here are some common examples of using the ip
command:
- Display information about all network interfaces:
$ ip addr show
- Display information about a specific network interface:
$ ip addr show eth0
Replace
eth0
with the name of the network interface you want to query. - Display information about all IP addresses:
$ ip address show
- Display the routing table:
$ ip route show
- Add a new IP address to a network interface:
$ ip addr add 192.168.1.100/24 dev eth0
Replace
192.168.1.100/24
with the IP address and subnet mask, andeth0
with the name of the network interface. - Delete an IP address from a network interface:
$ ip addr del 192.168.1.100/24 dev eth0
Replace
192.168.1.100/24
with the IP address and subnet mask, andeth0
with the name of the network interface. - Display information about network connections:
ip link show
These are just a few examples of how to use the ip
command. For more information and advanced usage, refer to the ip
command manual pages by executing man ip
.