Listen to this Post

Introduction:
Linux networking commands are the backbone of system administration, DevOps, and cybersecurity. Mastering these tools ensures efficient network management, troubleshooting, and security hardening. This guide compiles essential commands for interface configuration, packet analysis, DNS resolution, and traffic monitoring—boosting productivity for IT professionals.
Learning Objectives:
- Configure and manage network interfaces using
ifconfig,ip, andnmcli. - Monitor network traffic with
tcpdump,iftop, andnetstat. - Diagnose connectivity issues via
ping,traceroute, anddig. - Secure network services with
iptables,ufw, andss. - Optimize routing tables using `route` and
ip route.
1. Network Interface Configuration
Command:
ip addr show
Step-by-Step Guide:
- Lists all network interfaces and their IP addresses.
- Use `ip addr add 192.168.1.10/24 dev eth0` to assign a static IP.
- Bring an interface up/down with
ip link set eth0 up.
Alternative:
ifconfig
(Deprecated but still widely used for quick checks.)
2. Real-Time Traffic Monitoring
Command:
sudo tcpdump -i eth0 -n
Step-by-Step Guide:
1. Captures live packets on `eth0`.
- Filter by protocol (e.g., `tcpdump -i eth0 port 80` for HTTP traffic).
- Save output to a file:
tcpdump -w capture.pcap.
Alternative:
sudo iftop -i eth0
(Displays bandwidth usage per connection.)
3. DNS Troubleshooting
Command:
dig example.com
Step-by-Step Guide:
1. Queries DNS records for `example.com`.
2. Check specific record types: `dig example.com MX`.
3. Use `+trace` to follow DNS resolution path.
Alternative:
nslookup example.com
(Legacy but useful for quick lookups.)
4. Firewall & Security Hardening
Command:
sudo iptables -A INPUT -p tcp --dport 22 -j ACCEPT
Step-by-Step Guide:
1. Allows SSH traffic (port 22).
- Block an IP:
iptables -A INPUT -s 10.0.0.1 -j DROP.
3. Save rules: `iptables-save > /etc/iptables.rules`.
Alternative (UFW):
sudo ufw allow 22/tcp
5. Routing & Connectivity Testing
Command:
traceroute google.com
Step-by-Step Guide:
1. Maps the network path to `google.com`.
2. Identify latency hops with `-I` (ICMP mode).
Alternative:
mtr google.com
(Combines `ping` + `traceroute` for real-time analysis.)
6. Network Service Diagnostics
Command:
ss -tulnp
Step-by-Step Guide:
1. Lists all listening ports and services.
- Filter by protocol: `ss -t` (TCP), `ss -u` (UDP).
Alternative (Legacy):
netstat -tulnp
7. Bandwidth & Performance Analysis
Command:
nethogs eth0
Step-by-Step Guide:
1. Monitors bandwidth per process.
2. Kill abusive processes directly from the interface.
What Undercode Say:
- Key Takeaway 1: Automation via scripting (
bash+cron) saves hours in network audits. - Key Takeaway 2: `tcpdump` and `Wireshark` are indispensable for cybersecurity forensics.
Analysis:
Network commands are not just administrative tools—they form the first line of defense in intrusion detection. A sysadmin who masters iptables, tcpdump, and `ss` can preemptively block attacks, analyze breaches, and optimize infrastructure. As hybrid cloud adoption grows, CLI proficiency remains a non-negotiable skill for IT professionals.
Prediction:
With AI-driven network automation (e.g., AI-powered `iptables` rule generation), expect a 40% reduction in manual config errors by 2026. However, CLI expertise will remain critical for debugging and legacy systems.
Final Word: Bookmark this cheat sheet—your future self (and your CISO) will thank you. 🚀
IT/Security Reporter URL:
Reported By: Activity 7352023050239852544 – Hackers Feeds
Extra Hub: Undercode MoN
Basic Verification: Pass ✅


