Master Linux Networking: Using the ip Command to Manage Interfaces, Routes, and Stats
This guide explains how to use the powerful Linux ip command—replacing ifconfig—to configure IP addresses, manage routing tables, view network statistics, monitor netlink messages, handle ARP entries, and control interfaces, with practical examples and code snippets for system administrators and developers.
Linux's ip command is a more powerful replacement for ifconfig , part of the iproute2 suite, and is intended to supersede the deprecated ifconfig from net-tools.
Most Linux distributions already include iproute2; you can also download it or compile the latest source with:
git clone https://kernel.googlesource.com/pub/scm/linux/kernel/git/shemminger/iproute2.gitSetting and Deleting IP Addresses
Assign an IP address to an interface: sudo ip addr add 192.168.0.193/24 dev wlan0 Note the CIDR suffix (e.g., /24) indicating the subnet mask (255.255.255.0). Verify the address with: ip addr show wlan0 Delete the address by replacing add with del:
sudo ip addr del 192.168.0.193/24 dev wlan0Listing Routing Table Entries
Show the current routing table: ip route show Query the route a specific destination would take:
ip route get 10.42.0.47Changing the Default Route
Set a new default gateway:
sudo ip route add default via 192.168.0.196Displaying Network Statistics
Show detailed statistics for an interface (e.g., p2p1) using the -s -s options:
ip -s -s link ls p2p1ARP Entries
View the ARP table (IP to MAC address mappings) with:
ip neighbourMonitoring Netlink Messages
Monitor netlink events to see interface state changes (e.g., REACHABLE, STALE):
ip monitor allActivating and Deactivating Network Interfaces
Bring an interface down or up, similar to ifconfig:
sudo ip link set ppp0 down sudo ip link set ppp0 upGetting Help
If you are unsure about an option, use the help subcommand (the man page often lacks details):
ip route helpConclusion
For network administrators and all Linux users, the ip command is an essential tool that should replace ifconfig , especially when writing scripts.
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.
MaGe Linux Operations
Founded in 2009, MaGe Education is a top Chinese high‑end IT training brand. Its graduates earn 12K+ RMB salaries, and the school has trained tens of thousands of students. It offers high‑pay courses in Linux cloud operations, Python full‑stack, automation, data analysis, AI, and Go high‑concurrency architecture. Thanks to quality courses and a solid reputation, it has talent partnerships with numerous internet firms.
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.
