Master Essential Linux Network Commands: ifconfig, host, route & traceroute
Learn how to use key Linux networking tools—including ifconfig, host, nslookup, route, and traceroute—to display interface details, query DNS, view routing tables, and trace packet paths, with practical examples, screenshots, and tips such as MAC address spoofing and interface listing.
ifconfig
The ifconfig command, similar to Windows' ipconfig, displays network interfaces, subnet masks, and other details. The left column shows the interface name (e.g., lo for the loopback interface). Below is a screenshot of the command output.
Related Tips
1. Print network interface list
By using ifconfig and cut to extract the first ten characters of each line, you can list interface names. Screenshot below.
2. MAC address spoofing
In some cases, you may need to spoof a hardware (MAC) address for authentication or filtering. The following command (requires root) changes the MAC address. Screenshot shows the result.
host and nslookup
These are DNS lookup tools. host lists all IP addresses for a domain, while nslookup provides detailed DNS information. Example screenshot querying www.baidu.com.
route
The route command displays the routing table, which contains information about how packets are forwarded. Using the -n option shows addresses numerically. Screenshot below.
traceroute
tracerouteshows each gateway a packet traverses, helping measure the number of hops to a destination. Example tracing www.baidu.com shows 12 hops.
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.
