Networking Commands
By Pooja | 22nd July 2025

Introduction
 understanding networking is not optional—it’s essential. DevOps professionals manage, deploy, troubleshoot, and monitor applications that rely on seamless network connectivity. The foundation of this control is a set of powerful networking commands used in Linux and cloud environments.
This article explores the most critical networking commands in DevOps, how they are used in real-world scenarios, and why they are integral to successful infrastructure automation and application deployment.
Importance of Networking in DevOps
DevOps brings development and operations together, focusing on collaboration, automation, and monitoring. Networking is the backbone of any distributed system, and in DevOps:
- Applications often run in different environments (cloud, containers, on-premises).
- Services interact over HTTP, TCP, UDP, or other protocols.
- Troubleshooting DNS, latency, firewall issues is routine.
- Cloud and Kubernetes deployments demand understanding of networking.
Thus, networking commands help DevOps engineers ensure uptime, reliability, and secure communication across systems.
Overview of Common Networking Tasks
Networking tasks in DevOps typically include:
- Checking connectivity to external services
- Verifying DNS resolution
- Inspecting open ports and active connections
- Monitoring bandwidth and packet loss
- Troubleshooting latency and unreachable hosts
- Validating firewall and NAT configurations
- Testing microservices and container networking
Essential Networking Commands
ping
Purpose: Tests connectivity to a host and measures latency.
bash
CopyEdit
ping google.com
Usage in DevOps:
- Checking if a remote server is online.
- Testing network availability from containers or VMs.
- Diagnosing ICMP blocking in firewalls.
Purpose: Transfers data to/from a server using various protocols (HTTP, HTTPS, FTP).
bash
CopyEdit
curl -I https://api.example.com
Usage:
- Checking HTTP service status.
- Sending API requests in automation scripts.
- Debugging HTTP headers or SSL certs.
- wget
Purpose: Downloads files from URLs.
bash
CopyEdit
wget https://example.com/file.zip
Usage:
- Pulling configuration files or artifacts.
- Testing HTTP download behavior.
- Automating deployments in scripts.
- netstat
Purpose: Displays open ports, active connections, and routing tables.
bash
CopyEdit
netstat -tulnp
Usage:
- Verifying that a service is listening on the expected port.
- Identifying all inbound and outbound connections.
- Legacy tool (now replaced by ss in modern systems).
- ss
Purpose: Displays socket statistics (successor to netstat).
bash
CopyEdit
ss -lntp
Usage:
- Showing listening TCP ports with process info.
- Diagnosing service bindings and port usage.
- Faster and more accurate than netstat.
- traceroute
Purpose: Traces the route packets take to reach a host.
bash
CopyEdit
traceroute example.com
Usage:
- Diagnosing slow connections.
- Locating where traffic is getting blocked or delayed.
- Identifying routing loops or ISP issues.
- nslookup and dig
Purpose: Queries DNS records for a domain.
bash
CopyEdit
nslookup example.com
dig example.com
Usage:
- Verifying DNS resolution for services.
- Checking A, MX, CNAME, and TXT records.
- Diagnosing DNS propagation issues in CI/CD or migration.
- ip and ifconfig
Purpose: Display and manage network interfaces.
bash
CopyEdit
ip a          # Preferred over ifconfig
ifconfig      # Deprecated but still used
Usage:
- Viewing IP addresses and MAC addresses.
- Restarting or modifying interfaces.
- Diagnosing DHCP issues or subnet mismatches.
- host
Purpose: Resolves domain names to IP addresses.
bash
CopyEdit
host example.com
Usage:
- DNS lookups in minimal container environments.
- Quick and easy name resolution checks.
- telnet and nc (Netcat)
Purpose: Checks if a port is open on a remote host.
bash
CopyEdit
telnet example.com 22
nc -zv example.com 80
Usage:
- Diagnosing firewall or service issues.
- Testing remote service availability.
- Using nc for file transfers or socket listeners in CI jobs.
- arp
Purpose: Displays and modifies ARP cache.
bash
CopyEdit
arp -a
Usage:
- Troubleshooting IP conflicts.
- Viewing MAC-to-IP mappings.
- Identifying spoofed devices or duplicate IPs.
- route
Purpose: Views or manipulates the routing table.
bash
CopyEdit
route -n
Usage:
- Understanding traffic paths in multi-NIC servers.
- Diagnosing static route misconfigurations.
- iptables and ufw
Purpose: Firewall configuration and control.
bash
CopyEdit
iptables -L
ufw status
Usage:
- Securing Linux instances in production.
- Controlling access to services and ports.
- Automating firewall rules with Ansible, Terraform, or shell scripts.
Advanced Tools and Utilities
Tool | Purpose |
iperf | Bandwidth testing |
tcpdump | Packet capture and analysis |
wireshark | GUI network packet analyzer |
ethtool | Ethernet settings and stats |
nmap | Port scanning and host discovery |
Use case: Deep analysis and validation during system testing or security audits.
Use in CI/CD and Cloud Environments
Networking commands are frequently embedded in:
- CI/CD scripts: Test endpoint availability (curl, nc)
- Startup scripts: Ensure DB or backend is reachable before launching app
- Health checks: Use ping, curl, or nc to validate readiness
- Cloud provisioning: Validate that firewall/NAT/security group rules allow desired traffic
Example in a Jenkins pipeline:
groovy
CopyEdit
sh ‘curl -sSf https://my-api/health || exit 1’
Troubleshooting with Networking Commands
Scenario-based examples:
- App can’t reach database: Use ping, telnet, ss to test route, port, and service.
- DNS misconfigured: Use dig or nslookup to check resolution.
- High latency: Use traceroute and ping to find bottlenecks.
- Firewall blocking traffic: Use iptables, ufw, and nc to test and open ports.
Best Practices
- Prefer ip over ifconfig for modern Linux distros.
- Use curl and nc in health checks and deployment scripts.
- Automate iptables rules using Ansible or Terraform.
- Combine commands in bash scripts for reusability.
- Always log output when using network tests in CI.
- Mask sensitive data (e.g., API keys in curl commands).
Real-World Use Cases
Use Case 1: Docker Container Fails to Reach API
Check inside the container:
bash
CopyEdit
docker exec -it myapp bash
ping api.example.com
curl http://api.example.com/health
Use Case 2: Deployment Failing in CI Pipeline
Add debug steps:
bash
CopyEdit
nslookup db.internal
nc -zv db.internal 5432
Use Case 3: Cloud Load Balancer Not Forwarding Traffic
Verify:
bash
CopyEdit
curl -I http://localhost:8080
ss -lntp | grep 8080
more deep into this Importance of Linux in DevOps​
Conclusion
Mastering networking commands is essential for any DevOps engineer. From deployment scripts and debugging pipelines to securing production environments, these tools empower teams to work faster, diagnose issues effectively, and automate confidently.
In a DevOps workflow where connectivity, automation, and visibility are key, networking commands are your first line of defense and control. They bridge the gap between systems, services, and teams, enabling high-performing, reliable infrastructures.