Linux ip Command Guide: Modern Networking Made Simple
In modern Linux systems, the ip command—part of the iproute2 suite—has replaced legacy tools like ifconfig and route. It provides a powerful, flexible interface for managing network configuration directly through the kernel.
🔍 Inspecting Network Interfaces #
The ip command uses objects like link and addr to represent network components.
View Network Interfaces #
ip link show
Example Output #
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP
link/ether 00:11:22:33:44:55 brd ff:ff:ff:ff:ff:ff
Key Insights #
state UPindicates an active interfaceLOWER_UPconfirms physical link connectivitylink/ethershows the MAC address
🌐 Managing IP Addresses #
The ip addr object allows dynamic assignment and removal of IP addresses.
Assign an IP Address #
sudo ip addr add 192.168.0.10/24 dev eth0
Enable or Disable an Interface #
sudo ip link set eth0 up
sudo ip link set eth0 down
These commands are commonly used in provisioning and troubleshooting workflows.
🛣️ Routing Table Management #
Routing determines how packets travel between networks.
View Routing Table #
ip route show
Set Default Gateway #
sudo ip route add default via 192.168.0.1
Add a Static Route #
sudo ip route add 10.0.0.0/24 via 192.168.1.1 dev eth0
This is essential for multi-network environments and custom routing logic.
🧪 Practical Use Cases #
| Scenario | Application |
|---|---|
| Server Provisioning | Assign static IPs for consistent network identity |
| VLAN and Tunneling | Create virtual interfaces using ip link add |
| Troubleshooting | Detect link issues (NO-CARRIER) or inspect ARP with ip neigh |
🔄 ip vs ifconfig Comparison #
| Task | Legacy Tool | Modern Tool |
|---|---|---|
| Show IP addresses | ifconfig |
ip addr |
| Show routes | route -n |
ip route |
| Enable interface | ifconfig eth0 up |
ip link set eth0 up |
| Show ARP table | arp -n |
ip neigh |
✅ Conclusion #
The ip command is more than a replacement for older networking tools—it is a comprehensive, object-oriented interface to the Linux networking stack.
By mastering iproute2, you gain:
- Greater control over network configuration
- Improved performance and flexibility
- Compatibility with modern Linux distributions
For system administrators and developers alike, the ip command is an essential tool for managing today’s networked systems.