IP Command Cheatsheet
Quick reference for using ip command to manage addresses, routes, links, and network diagnostics in Linux
The ip command is the standard Linux tool for managing network interfaces, IP addresses, routes, ARP/neighbor entries, and policy routing. This cheatsheet covers the most common commands you will use in daily administration and troubleshooting.
Basic Syntax
Use this structure for most ip operations.
| Command | Description |
|---|---|
ip [OPTIONS] OBJECT COMMAND | General ip command syntax |
ip -br a | Show addresses in brief format |
ip -c a | Show colorized output |
ip -4 a | Show only IPv4 addresses |
ip -6 a | Show only IPv6 addresses |
Show Interfaces and Addresses
Inspect links and assigned IP addresses.
| Command | Description |
|---|---|
ip link show | Show all network interfaces |
ip link show dev eth0 | Show one interface |
ip addr show | Show all IP addresses |
ip addr show dev eth0 | Show addresses on one interface |
ip -br addr | Brief interface and address overview |
Add and Remove IP Addresses
Assign or remove IP addresses on interfaces.
| Command | Description |
|---|---|
sudo ip addr add 192.168.1.50/24 dev eth0 | Add IPv4 address |
sudo ip addr del 192.168.1.50/24 dev eth0 | Remove IPv4 address |
sudo ip addr add 2001:db8::50/64 dev eth0 | Add IPv6 address |
sudo ip addr flush dev eth0 | Remove all addresses from interface |
ip addr show dev eth0 | Verify interface addresses |
Bring Interfaces Up or Down
Enable, disable, or rename network links.
| Command | Description |
|---|---|
sudo ip link set dev eth0 up | Bring interface up |
sudo ip link set dev eth0 down | Bring interface down |
sudo ip link set dev eth0 mtu 9000 | Change MTU |
sudo ip link set dev eth0 name lan0 | Rename interface |
ip -br link | Show link state quickly |
Routing Table
Inspect and manage network routes.
| Command | Description |
|---|---|
ip route show | Show IPv4 routing table |
ip -6 route show | Show IPv6 routing table |
ip route get 8.8.8.8 | Show route used for destination |
sudo ip route add default via 192.168.1.1 | Add default gateway |
sudo ip route del default | Remove default gateway |
sudo ip route add 10.10.0.0/16 via 192.168.1.254 dev eth0 | Add static route |
Neighbor (ARP/NDP) Table
View and manage neighbor cache entries.
| Command | Description |
|---|---|
ip neigh show | Show neighbor table |
ip neigh show dev eth0 | Show neighbors for one interface |
sudo ip neigh flush dev eth0 | Clear neighbor entries on interface |
sudo ip neigh del 192.168.1.10 dev eth0 | Remove a neighbor entry |
ip -s neigh | Show neighbor statistics |
Policy Routing
Work with multiple routing tables and rules.
| Command | Description |
|---|---|
ip rule show | List policy routing rules |
sudo ip rule add from 192.168.10.0/24 table 100 | Route source subnet using table 100 |
sudo ip route add default via 10.0.0.1 table 100 | Add default route to custom table |
sudo ip rule del from 192.168.10.0/24 table 100 | Remove policy rule |
ip route show table 100 | Show routes in table 100 |
Network Namespaces
Inspect or run commands inside network namespaces.
| Command | Description |
|---|---|
ip netns list | List network namespaces |
sudo ip netns add ns1 | Create namespace |
sudo ip netns exec ns1 ip a | Run ip a inside namespace |
sudo ip netns del ns1 | Delete namespace |
ip -n ns1 route | Show routes in namespace |
Troubleshooting
Fast checks for common network issues.
| Issue | Check |
|---|---|
| No IP assigned to interface | ip addr show dev eth0 |
| Interface is down | ip link show dev eth0 then sudo ip link set dev eth0 up |
| Wrong default route | ip route show and verify default via ... |
| Cannot reach destination | ip route get DESTINATION_IP |
| Stale ARP/neighbor entry | sudo ip neigh flush dev eth0 |
Related Guides
Use these articles for detailed networking workflows.
| Guide | Description |
|---|---|
Linux ip Command with Examples | Complete ip command guide |
How to Find Your IP Address in Linux | Public and private IP lookup methods |
Traceroute Command in Linux | Path and hop diagnostics |
UFW Cheatsheet | Firewall rules quick reference |