learn/phase-2/p2-w4/lesson 03
Week 4 · lesson 3

Linux: Network Commands

Hands-on. The everyday network commands a tester lives in.

What you'll learn

  • Inspect your own addresses and interfaces with ip and ifconfig.
  • Test reachability with ping.
  • See open/listening ports with ss or netstat.

Linux: Network Commands

These four commands answer the everyday questions: what is my address, can I reach that host, and what is listening?

Your own addresses

ip            # modern: interfaces, addresses, /prefix
ifconfig      # classic view of the same information

Look for your interface (often eth0), its inet address, and the /24-style prefix you learned to read in the subnetting lesson.

Can I reach it?

ping example.com

ping sends small ICMP echo packets and times the replies. Replies with low, steady times mean a healthy path. No replies can mean the host is down, or simply that a firewall drops ICMP, absence of a reply is not proof of absence.

What is listening?

ss            # sockets: what is listening and what is connected
netstat       # older tool, similar output

The LISTEN state means a service is waiting for connections on that port. This is the inside view of the same thing nmap shows from the outside, comparing them is a great habit.

Try it

ip, then ping example.com, then ss. You are now reading a host's network identity and exposure with three commands, the daily bread of recon.

Check your understanding

3 questions

Type an answer and press Check. Grading is keyword-based and forgiving, so short answers are fine.

  1. 1

    Which command shows your machine's IP address and its interface?

  2. 2

    ss output shows LISTEN 0.0.0.0:22. Which service is exposed to the network?

  3. 3

    You ping a host and get no reply. Give one reason other than the host being down.