The ip command from the iproute2 package is the modern replacement for legacy networking tools like ifconfig, route, and arp. It provides comprehensive control over network interfaces, routing tables, ARP tables, and network namespaces. As the standard tool for network configuration on modern Linux systems, mastering ip is essential for any system administrator.
📑 Table of Contents
Unlike its predecessors, ip offers consistent syntax across all networking subsystems and supports advanced features like policy-based routing, network namespaces, and traffic control. It’s the preferred tool for scripting and automation due to its predictable output format and comprehensive functionality.
Key Features
- Interface Management – Configure and monitor network interfaces
- Address Configuration – Add, delete, and modify IP addresses
- Routing Tables – Manage static routes and routing policies
- ARP/Neighbor Tables – View and manipulate ARP cache
- Network Namespaces – Create isolated network environments
- Tunnel Configuration – Set up GRE, IPIP, and other tunnels
Installation
# Pre-installed on most distributions
# If missing:
sudo apt install iproute2 # Debian/Ubuntu
sudo dnf install iproute # Fedora/RHEL
Interface Management
# Show all interfaces
ip link show
ip -c link show # With colors
# Bring interface up/down
sudo ip link set eth0 up
sudo ip link set eth0 down
# Show interface statistics
ip -s link show eth0
IP Address Management
# Show IP addresses
ip addr show
ip -4 addr show # IPv4 only
ip -6 addr show # IPv6 only
# Add IP address
sudo ip addr add 192.168.1.100/24 dev eth0
# Delete IP address
sudo ip addr del 192.168.1.100/24 dev eth0
Routing Management
# Show routing table
ip route show
# Add default gateway
sudo ip route add default via 192.168.1.1
# Add static route
sudo ip route add 10.0.0.0/8 via 192.168.1.254
# Delete route
sudo ip route del 10.0.0.0/8
Use Cases
- Server Configuration – Set up network interfaces
- Troubleshooting – Diagnose connectivity issues
- Container Networking – Configure network namespaces
- VPN Setup – Create tunnel interfaces
- Load Balancing – Configure multiple default routes
Was this article helpful?