Linux

Chapter 8: Networking Basics in WSL Ubuntu

Chapter 8: Networking Basics in WSL Ubuntu

Networking is an essential skill for any Linux user. Whether you want to test connectivity, troubleshoot issues, or understand your system’s IP configuration, WSL Ubuntu provides powerful tools.

In this chapter, you’ll learn the basic networking commands to check connectivity, view IP addresses, monitor ports, and perform simple network tests.

🌐 Checking Connectivity

📌 ping – Test Connection to a Host

ping google.com

Stops automatically with Ctrl + C. Displays packet loss, round-trip time, and connectivity.

📍 Viewing IP Addresses

📌 ip addr – Display Network Interfaces

ip addr

Shows all network interfaces with IP addresses.

📌 ifconfig – Classic Method

ifconfig

Displays interface configuration. May require installation:

sudo apt install net-tools

🔌 Check Open Ports and Connections

📌 netstat

Displays active connections, listening ports, and routing tables:

netstat -tuln
  • -t TCP
  • -u UDP
  • -l Listening
  • -n Numeric IP/Port

📌 ss – Modern Alternative to netstat

ss -tuln

🔗 Test Network Services

📌 curl – Fetch URLs

curl http://example.com

Checks if a web service is reachable and shows response data.

📌 traceroute – Trace Network Path

traceroute google.com

Shows each hop from your system to the target server. Install if needed:

sudo apt install traceroute

📊 Monitor Network Traffic

📌 ping -c 5 google.com

Pings the host 5 times and stops automatically.

📌 iftop – Real-time Traffic Monitoring

sudo apt install iftop
sudo iftop

🧪 Practice Exercises

# Test connectivity
ping -c 4 google.com

# Check IP addresses
ip addr
ifconfig

# Test web server
curl http://example.com

# Monitor ports
ss -tuln
netstat -tuln

✅ Summary

  • ping – Test connectivity
  • ip addr / ifconfig – View IP addresses and interfaces
  • netstat / ss – Check ports and connections
  • curl – Test web services
  • traceroute – Trace network path
  • Monitoring tools like iftop help track traffic in real-time

▶️ Coming Up Next

Chapter 9 – Managing Processes in WSL Ubuntu
Learn how to view, kill, and manage running processes using ps, top, htop, and related commands.

Leave a Reply

Your email address will not be published. Required fields are marked *