Master Linux Network Management with the Powerful ‘ip’ Command
This guide explains how to use the Linux ‘ip’ command to view current network settings, configure IP addresses, gateways, DNS, interface states, and perform common troubleshooting tasks such as checking link status, traffic statistics, routing tables, and active IP assignments.
Check Current Network Information
Before using ip, you need to view the current network details. The command ip addr show displays each interface with its IP address, MAC address, broadcast address, and subnet mask. Example output shows the loopback interface and an Ethernet interface (eth0) with their respective configurations.
Configure Network Interface
After understanding the existing configuration, you can modify interfaces using various ip sub‑commands:
Set an IP address: sudo ip addr add 192.168.1.100/24 dev eth0
Set the default gateway: sudo ip route add default via 192.168.1.1
Configure a DNS server: sudo echo "nameserver 8.8.8.8" > /etc/resolv.conf
Bring an interface up or down: sudo ip link set eth0 up and sudo ip link set eth0 down
Network Troubleshooting
The ip command also assists in diagnosing network problems. Common troubleshooting commands include:
Check whether an interface is connected: sudo ip link show <interface_name>
Show interface speed and traffic statistics: sudo ip -s link show <interface_name>
Display the routing table: sudo ip route show
List all assigned IP addresses: sudo ip addr | grep inet
Conclusion
The ip command provides comprehensive control over Linux networking, allowing you to inspect interfaces, assign IP addresses, set gateways, configure DNS resolvers, and troubleshoot connectivity. While this article covers essential commands, many additional options are documented in the manual page ( man ip) for deeper exploration.
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
Liangxu Linux
Liangxu, a self‑taught IT professional now working as a Linux development engineer at a Fortune 500 multinational, shares extensive Linux knowledge—fundamentals, applications, tools, plus Git, databases, Raspberry Pi, etc. (Reply “Linux” to receive essential resources.)
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
