Fundamentals 4 min read

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.

MaGe Linux Operations
MaGe Linux Operations
MaGe Linux Operations
Master Essential Linux Network Commands: ifconfig, host, route & traceroute

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.

ifconfig output
ifconfig 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.

interface list
interface list

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.

MAC spoof command
MAC spoof command
MAC spoof result
MAC spoof 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.

host/nslookup result
host/nslookup result

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.

route table
route table
route -n output
route -n output

traceroute

traceroute

shows each gateway a packet traverses, helping measure the number of hops to a destination. Example tracing www.baidu.com shows 12 hops.

traceroute result
traceroute result
Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

routingDNSifconfig
MaGe Linux Operations
Written by

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.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.