Chapter 8: Networking Basics in WSL Ubuntu

Chapter 8: Networking Basics in WSL Ubuntu

AI Reading

Quick summary of this article

This chapter covers essential networking commands in WSL Ubuntu, helping users test connectivity, inspect IP configurations, and monitor network activity. It introduces both classic and modern tools for common network tasks, with practical examples for each command.

  • Test connectivity with ping: Use ping google.com to check if a host is reachable; add -c 5 to stop automatically after 5 packets and view packet loss and round-trip times.
  • View IP addresses with ip addr or ifconfig: ip addr shows all network interfaces and IPs; ifconfig is a classic alternative that may require installing net-tools via sudo apt install net-tools.
  • Check open ports with netstat or ss: Use netstat -tuln or ss -tuln to display listening TCP/UDP ports and active connections; ss is the modern replacement.
  • Test web services with curl and traceroute: curl http://example.com verifies web service availability, while traceroute google.com shows each network hop to the target; install traceroute if needed.
  • Monitor real-time traffic with iftop: Install via sudo apt install iftop and run sudo iftop to track live network bandwidth usage per connection.

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 *