Network Diagnostics and Configuration
Network Connectivity and Configuration Diagnosis
🎯 Learning Objective
By the end of this unit, you'll master essential network diagnostic commands for troubleshooting connectivity issues, validating server configurations, and diagnosing infrastructure problems in production environments.
📚 Concept Introduction
Network connectivity diagnosis is fundamental to DevOps operations, enabling rapid resolution of deployment failures, service outages, and infrastructure issues. When applications fail to communicate, databases become unreachable, or external APIs timeout, systematic network troubleshooting prevents extended downtime.
Production scenarios requiring network diagnostics include validating new server deployments, troubleshooting service-to-service communication failures, diagnosing API connectivity issues, investigating database connection problems, and verifying network changes. These skills form the foundation for maintaining reliable distributed systems.
📁 Pre-created:
- Ubuntu 24.04 system with network configuration
- External connectivity for testing
- Local HTTP server for diagnostics
🔍 Systematic Connectivity Testing
◆ Understanding ping for Production Diagnostics
ping tests network reachability by sending ICMP echo request packets and measuring response times. In production environments, ping validates basic connectivity before investigating application-specific issues.
Basic ping syntax:
ping [hostname_or_ip]
Basic ping command:
ping google.com
The basic ping command sends packets continuously until stopped with Ctrl+C. While useful for interactive testing, this creates problems in automated scripts and production environments.
Production-ready ping with packet limit:
ping -c 3 google.com
The -c option limits packet count, making ping suitable for automation and preventing infinite testing in CI/CD pipelines.
Production-focused ping examples:
- Test external connectivity (DNS + routing)
ping -c 3 google.com
- Test specific server by IP (bypass DNS)
ping -c 3 8.8.8.8
- Test internal server communication
ping -c 3 192.168.1.10
◆ Interpreting ping Results for Troubleshooting
Successful ping output analysis:
- 0% packet loss - Network path is functional
- Response times - Network latency indicators
- TTL values - Network hop count information
Failure pattern diagnosis:
- 100% packet loss - Complete connectivity failure
- Partial packet loss - Network congestion or intermittent issues
- "Destination Host Unreachable" - Routing problems
- "Name resolution failed" - DNS configuration issues
◆ Advanced ping Troubleshooting Techniques
Network path diagnosis:
- Test local network stack
ping -c 3 localhost
- Test loopback interface
ping -c 3 127.0.0.1
These commands validate that the local networking subsystem is functional before testing external connectivity.
🖧 Network Interface Configuration Analysis
◆ Modern Network Configuration with ip Command
The ip command suite provides comprehensive network configuration information essential for infrastructure validation and troubleshooting.
View all network interfaces:
ip addr show
Shorter form:
ip a
Critical information in ip output:
- Interface names -
lo(loopback),eth0/ens3/enp0s*(Ethernet) - Interface state -
UP/DOWN/UNKNOWNoperational status - IP addresses - IPv4 (
inet) and IPv6 (inet6) assignments - MAC addresses - Hardware identifiers for network interfaces
- Network masks - CIDR notation (e.g.,
/24,/16)
Finding specific interface details:
ip addr show eth0
🛣️ Network Routing
◆ Understanding Traffic Flow with Routing Tables
Network routing determines how traffic flows between systems. The routing table shows available network paths and is crucial for diagnosing connectivity failures.
View routing table:
ip route show
Shorter form:
ip r
Key routing table components:
- Default route -
default via <gateway_ip>- Where unknown traffic goes - Local networks - Direct network connections
- Interface assignments - Which interface handles specific networks
Example routing analysis:
- Typical routing table output:
default via 192.168.1.1 dev eth0 # Default gateway
192.168.1.0/24 dev eth0 # Local network
◆ Routing Troubleshooting Scenarios
Common routing problems:
- Missing default route - No path to external networks
- Incorrect gateway - Traffic sent to wrong destination
- Interface conflicts - Multiple routes for same network
Verification workflow:
- Check if default route exists
- Verify gateway IP is reachable
- Confirm interface assignments match network configuration
◆ Legacy vs. Modern Network Tools
| Task | Modern Command | Legacy Alternative |
|---|---|---|
| View interfaces | ip addr show | ifconfig |
| View routing | ip route show | netstat -rn |
| Network statistics | ss -tuln | netstat -tuln |
Modern ip commands are part of the iproute2 package, standard on current distributions. Legacy tools require the net-tools package and may not be available in minimal installations.
💡 Key Takeaways
- Network connectivity testing with
pingvalidates basic infrastructure functionality before investigating application issues - The
-coption limits ping packet count for automated scripts and prevents infinite testing in production environments - Modern
ip addr showprovides comprehensive interface information essential for server configuration validation - IPv4 addresses on non-loopback interfaces identify primary network connectivity for service communication
- Routing table analysis with
ip route showreveals traffic flow paths and helps diagnose connectivity failures - Network configuration validation is fundamental to successful server deployments and service connectivity
- These diagnostic skills form the foundation for troubleshooting complex distributed system communication issues
Mastering basic network diagnostics enables reliable infrastructure management and rapid resolution of connectivity problems in production environments.
Examining Active Network Connections
🎯 Learning Objective
By the end of this unit, you'll master essential network connection inspection commands for identifying running services, troubleshooting port conflicts, and conducting security audits in production environments.
📚 Concept Introduction
Network connection inspection is critical for DevOps operations, When services fail to start, ports appear occupied, or unexpected network activity occurs, systematic socket inspection provides immediate insights.
Production scenarios requiring network connection analysis include validating service startup after deployments, investigating port conflicts during scaling operations etc. These skills enable proactive infrastructure monitoring and rapid incident response.
📁 Pre-created:
- Ubuntu 24.04 system with network utilities
- Background service listening on port
8888 - Active network connections for analysis
🔍 Modern Socket Inspection with ss
◆ Understanding Network Sockets in Production
Network sockets represent communication endpoints between processes and networks. In production environments, socket inspection reveals which services are running, which ports are available, and how applications communicate with external systems.
The ss command (socket statistics) is the modern replacement for legacy netstat, providing faster performance and more detailed information about network connections.
Basic ss command syntax:
ss [options]
Basic socket inspection command:
ss -tulnp
The basic ss -tulnp command shows network connections but may not display process information for all sockets due to permission restrictions.
Production-ready command with elevated privileges:
sudo ss -tulnp
The sudo prefix provides administrative privileges, allowing ss to access process information for all running services. This is essential for production troubleshooting where you need to identify which applications own specific network connections.
Option breakdown:
-t- TCP sockets (reliable, connection-oriented)-u- UDP sockets (fast, connectionless)-l- Listening sockets only (services waiting for connections)-n- Numerical output (avoid DNS lookups for speed)-p- Process information (which application owns each socket)
◆ Interpreting ss Output for DevOps Analysis
Critical columns in ss output:
Netid- Protocol type (tcp,udp,tcp6,udp6)State- Connection status (LISTENfor services,ESTABfor active connections)Local Address:Port- Where the service listens (0.0.0.0:80= all interfaces,127.0.0.1:8080= localhost only)Process- Application name and PID owning the socket
🔧 Legacy Network Tools Awareness
◆ Understanding netstat for Legacy Systems
While ss is preferred for modern systems, netstat remains common on legacy infrastructure and older documentation. Understanding both tools ensures compatibility across diverse environments.
Legacy netstat equivalent:
sudo netstat -tulnp
Key differences:
- Performance -
ssis significantly faster for large connection counts - Availability -
netstatrequiresnet-toolspackage installation - Output format - Slightly different column layouts but similar information
When you might encounter netstat:
- Legacy production systems
- Container base images without
ss - Older troubleshooting documentation
- Systems with minimal package installations
This systematic approach ensures comprehensive service validation and security assessment.
💡 Key Takeaways
- Modern
ss -tulnpcommand provides comprehensive socket information essential for service validation and troubleshooting - Socket inspection reveals which services are running, their network binding patterns, and potential security exposures
- The
-loption filters for listening sockets, focusing analysis on active services rather than transient connections - Legacy
netstatprovides similar functionality but with reduced performance on systems with many connections - Network socket analysis is fundamental for diagnosing port conflicts and validating microservice communication
Mastering network connection inspection enables proactive service monitoring and rapid resolution of connectivity issues in production environments.
- Next lesson
- Remote Access and File Transfer