iproute2 (ip, ss) Quick Reference¶
This document provides a concise quick-reference guide for essential iproute2 commands used in Linux network administration. It covers practical syntax for managing interfaces, IP addresses, routing tables, and socket statistics, serving as a modern replacement for legacy net-tools.
1. Network Interfaces (ip link)¶
Replaces legacy ifconfig for interface management.
List all network interfaces and their MAC addresses:
Show status and details of a specific interface (eth0):
Bring the eth0 interface up:
Bring the eth0 interface down:
Change the MAC address of eth0 (interface must be down first):
2. IP Addresses (ip addr)¶
Replaces legacy ifconfig for IP assignment.
List all IP addresses across all interfaces:
Show a brief, one-line-per-interface status including IP and state:
Show IP addresses assigned specifically to eth0:
Assign a static IPv4 address to eth0:
Assign a static IPv6 address to eth0:
Remove a specific IP address from eth0:
Remove all IP addresses dynamically assigned or static on eth0:
3. Routing Table (ip route)¶
Replaces legacy route command.
Display the kernel's IPv4 routing table:
Display the kernel's IPv6 routing table:
Add a default gateway route:
Add a static route to a specific subnet via a gateway:
Delete a specific route from the table:
Test and display the route the kernel will use to reach a specific IP:
4. Neighbor / ARP Table (ip neigh)¶
Replaces legacy arp command.
Display the neighbor/ARP cache table:
Clear the entire ARP cache for a specific interface:
Add a static, permanent ARP entry:
Delete a specific ARP entry:
5. Socket Statistics (ss)¶
Replaces legacy netstat for connection monitoring.
Show all listening TCP and UDP ports (in numeric format):
List all listening processes, extended statistics, and associated PIDs:
Display a summary of statistics for all network sockets:
Sources & Verification:
- Official
iproute2utility suite documentation (maintained by Stephen Hemminger and the Linux Foundation). - Command syntax and flag definitions verified against Daniil Baturin's task-centered
iproute2guide. - Legacy
net-toolsmappings and practical CLI examples verified via community network administration reference sheets.