To troubleshoot Linux network issues, there are several essential commands and techniques you can use. Here are some of them:
- Ping: Use the ping command to check network connectivity and test reachability to a remote host. For example,
ping google.com
.
2. ifconfig: This command helps you view and configure network interfaces. For example,
ifconfig eth0
3. ip: The ip command is a powerful replacement for ifconfig. It provides more advanced functionality and information about network interfaces. For instance, ip addr show
.
4. netstat: Use the netstat command to display network statistics, active network connections, and listening ports. For example,
netstat -tuln
5. traceroute: This command helps you trace the route that packets take to reach a destination host. It provides information about each hop along the path. For example,
traceroute google.com
6. nslookup/dig: These commands are used to perform DNS lookups and retrieve DNS-related information about domains and IP addresses. For example,
nslookup google.com
or dig A google.com
7. tcpdump: tcpdump allows you to capture and analyze network traffic. It can be helpful in diagnosing network-related issues. For example,
tcpdump -i eth0
8. ss: The ss command provides detailed information about network sockets, both listening and established connections. For instance,
ss -tuna
9. iptables: iptables is a powerful firewall management tool. It is used to set up, maintain, and inspect rules for packet filtering and network address translation (NAT). For example,
iptables -L
10. Wireshark: Wireshark is a GUI-based network protocol analyzer. It allows you to capture and examine network traffic in real-time or from saved capture files. It can help you identify and troubleshoot network issues at a deeper level.
These commands can help you identify and diagnose network issues on a Linux system.