Linux Commands to Troubleshoot Network Issues

1. Ping : Check connectivity to another host.

ping google.com

2. ifconfig : View and configure network interface parameters.

ifconfig

3. ip : Modern replacement for ifconfig.

ip a

4. Traceroute : Trace the route packets take to a host.

traceroute google.com

5. Tracepath : Similar to traceroute but does not require superuser privileges. It identifies the path to a network host.

tracepath google.com

6. netstat : Display network connections, routing tables, and more

netstat -a

7. ss : Similar to netstat but faster.

ss -t

8. dig : Advanced DNS query tool

dig google.com

9. nslookup : Query DNS servers for DNS information

nslookup google.com

10. Route : View and manipulate the IP routing table.

route -n

11. ARP : Display and modify the ARP cache, which maps IP addresses to MAC addresses.

arp -a

12. curl / wget : Fetch data from web servers; both can be used to check connectivity to web services.

curl -I http://example.com
wget http://example.com

13. journalctl : View system logs for networking-related messages.

journalctl -u NetworkManager

14. systemctl : Manage and check the status of network services.

systemctl status NetworkManager

15. ethtool : Display and modify Ethernet device settings.

ethtool eth0

16. ufw : Check and manage firewall rules.

sudo ufw status

17. iftop : Monitor real-time network traffic usage.

iftop

18. lsof : List open files, including network sockets.

lsof -i :80

19. tcpdump : Capture and analyze network packets.

tcpdump -i eth0 port 80

Leave a Comment