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
-tTCP-uUDP-lListening-nNumeric 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 connectivityip addr / ifconfig– View IP addresses and interfacesnetstat / ss– Check ports and connectionscurl– Test web servicestraceroute– Trace network path- Monitoring tools like
iftophelp 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.
