20 Network Troubleshooting Linux Commands Which Helps Lot
Here is a list of Networking and Troubleshooting commands. 20 Network Troubleshooting Linux Commands Which Helps Lot. When your facing any Network related issue with Linux servers / Linux Or Unix Like operating systems you can make use of below commands to identify issue.
20 Network Troubleshooting Linux Commands
- IP Address related issues
- Not getting Internet access to Linux machine All IP details are correct
- Not able to Ping using host name but IP is pinging
- Having lot of packet loss how to identify.?
- Collect Logs to identify failure
1. ifconfig command
Display and manipulate route and network interfaces. ifconfig command is used to configure the kernel-resident network interfaces.
- ifconfig -a — List all interfaces which are currently available, even down.
- ifconfig <Interface Name> – It will show only specified interface details
$ ifconfig -s
2. ip command
It is a replacement of ifconfig command in new releases. Show/manipulate routing, devices, policy routing and tunnels.
ip command a few examples below
$ ip address $ ip add $ ip route $ ip link $ ip -4 address
You can also refer IP Addressing
3. traceroute command
Network troubleshooting utility, which is used to identify the reach of IP address by it’s path. It will show 30 hops route path from source to destination so that we can easily identify from which device packet is getting lose.
# traceroute -4 192.168.111.2 traceroute to 192.168.111.2 (192.168.111.2), 30 hops max, 60 byte packets 1 ArkitServer (192.168.111.128) 3007.067 ms !H 3006.971 ms !H 3006.952 ms !H
4. tracepath command
Similar to traceroute but doesn’t require root privileges. Command tracepath will show including hop device name as well.
$ tracepath 18.104.22.168 1?: [LOCALHOST] pmtu 1500 1: 192.168.2.5 0.507ms 1: 192.168.1.5 0.501ms 2: 10.192.5.5 2.416ms 3: gi0-0-0-11.3164.nr12.b003122-0.sfo01.atlas.cogentco.com 6.259ms 4: te0-0-1-1.agr21.sfo01.atlas.cogentco.com 7.218ms 5: be2903.ccr22.sfo01.atlas.cogentco.com 5.843ms 6: be3179.ccr22.sjc01.atlas.cogentco.com 7.900ms 7: be3144.ccr41.sjc03.atlas.cogentco.com 7.323ms 8: tata.sjc03.atlas.cogentco.com 8.416ms
5. ping command
To check connectivity between two nodes. Mostly and widely used command to check remote host status. Ping uses the ICMP protocol’s mandatory ECHO_REQUEST datagram to elicit an ICMP ECHO_RESPONSE from a host or gateway.
$ ping arkit.co.in PING arkit.co.in (22.214.171.124) 56(84) bytes of data. 64 bytes from ip-166-62-28-131.ip.secureserver.net (126.96.36.199): icmp_seq=1 ttl=48 time=179 ms
6. netstat command
Display connection information. Print network connections, routing tables, interface statistics, masquerade connections, and multicast memberships. Connected network port details and statistics including its path from Operating system.
$ netstat -i Kernel Interface table
7. ss command
It is a replacement of netstat. ss is used to dump socket statistics. It allows showing information similar to netstat. It can display more TCP and state information than other tools.
8. dig command
Query DNS related information. Domain information Gropper, is a flexible tool for interrogating DNS Name servers. It performs DNS lookups and displays the answers that are returned from name servers. 20 Network troubleshooting Linux commands one is dig command.
$ dig google.com $ dig 188.8.131.52
9. nslookup command
Find DNS related query. Nslookup is a program to query Internet domain name servers. Nslookup has two modes: interactive and non-interactive. Interactive mode allows the user to query name servers for information about various hosts and domains or to print a list of hosts in a domain. Non-interactive mode is used to print just the name and requested information for a host or domain.
$ nslookup google.com Server: 192.168.3.8 Address: 192.168.3.8#53 Non-authoritative answer: Name: google.com Address: 184.108.40.206
10. route command
Shows and manipulate IP routing table. It will list out kernel routing table.
11. host command
Performs DNS lookups. Host is a simple utility for performing DNS lookups. It is normally used to convert names to IP addresses and vice versa. When no arguments or options are given, host prints a short summary of its command line arguments and options. Troubleshooting Linux Commands Helps Lot.
$ host 220.127.116.11 18.104.22.168.in-addr.arpa domain name pointer google-public-dns-a.google.com.
12. arp command
View or add contents of the kernel’s ARP table. Before using arp command in any Operating system just ping to that host and try arp so that it will provide you host MAC address details, Host name and Interface which is used to get the information.
$ arp IPADDRESS
13. iwconfig command
Used to configure wireless network interface. Iwconfig is similar to ifconfig, but is dedicated to the wireless interfaces. It is used to set the parameters of the network interface which are specific to the wireless operation. Iwconfig may also be used to display those parameters, and the wireless statistics.
$ iwconfig eth0 essid any
14. hostname command
To identify a network name. Hostname is used to display the system’s DNS name, and to display or set its hostname or NIS domain name. hostname command with -f option will provide you FQDN (Fully Qualified Domain Name).
15. curl command
To download a file from internet. curl is a tool to transfer data from or to a server, using one of the supported protocols (DICT, FILE, FTP, FTPS, GOPHER, HTTP, HTTPS, IMAP, IMAPS, LDAP, LDAPS, POP3, POP3S, RTMP, RTSP, SCP, SFTP, SMB, SMBS, SMTP, SMTPS, TELNET and TFTP). The command is designed to work without user interaction.
$ curl URL
16. wget command
GNU Wget is a free utility for non-interactive download of files from the Web. It supports HTTP, HTTPS, and FTP protocols, as well as retrieval through HTTP proxies.
$ wget <Direct Download URL Path>
17. mtr command
mtr combines the functionality of the traceroute and ping programs in a single network diagnostic tool. Combines ping and tracepath into a single command.
$ mtr <IP Address>
18. whois command
Will tell you about the website’s whois. whois searches for an object in a RFC 3912 database. Network Troubleshooting Linux commands helps lot
$ whois <Website URL>
19. ifplugstatus command
Tells whether a cable is plugged in or not. ifplugstatus is an utility which may be used to detect the link status of a local Linux Ethernet device, much in the same way mii-diag, mii-tool and ethtool work. Network Troubleshooting Linux commands helps lot.
$ ifplugstatus ens32: link beat detected lo: link beat detected
Thanks for your wonderful Support and Encouragement