ip command
Detailed Explanation
The ip command is a powerful network management tool used in Linux to configure network interfaces, routing, and tunnels. It is part of the iproute2 package and has largely replaced older tools like ifconfig, route, and arp.
Basic Syntax
ip [ OPTIONS ] OBJECT { COMMAND | help }
Where OBJECT is the network entity you want to manage (e.g., link, addr, route, neigh).
Common Flags/Options
| Option | Description |
|---|---|
-V, -Version | Print the version of the ip utility and exit. |
-h, -human | Output statistics with human-readable values. |
-s, -stats | Output more information/statistics. |
-c, -color | Use color output. |
-br, -brief | Print only basic information in a tabular format. |
Real-world Examples
Show all IP addresses:
ip addr show
Show IP addresses in a brief format:
ip -br addr show
Bring an interface up or down:
ip link set eth0 up
ip link set eth0 down
Display the routing table:
ip route show
Add a static route:
ip route add 192.168.2.0/24 via 192.168.1.1