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.comto check if a host is reachable; add-c 5to stop automatically after 5 packets and view packet loss and round-trip times. - View IP addresses with ip addr or ifconfig:
ip addrshows all network interfaces and IPs;ifconfigis a classic alternative that may require installingnet-toolsviasudo apt install net-tools. - Check open ports with netstat or ss: Use
netstat -tulnorss -tulnto display listening TCP/UDP ports and active connections;ssis the modern replacement. - Test web services with curl and traceroute:
curl http://example.comverifies web service availability, whiletraceroute google.comshows each network hop to the target; install traceroute if needed. - Monitor real-time traffic with iftop: Install via
sudo apt install iftopand runsudo iftopto 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
-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.
