Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Linux 101: Network troubleshooting commands
#1
Information 
Test connectivity between two computers

ping

Sample output:

~$ ping -c 5 1.1.1.1

PING 1.1.1.1 (1.1.1.1) 56(84) bytes of data.
64 bytes from 1.1.1.1: icmp_seq=1 ttl=58 time=18.6 ms
64 bytes from 1.1.1.1: icmp_seq=2 ttl=58 time=18.4 ms
64 bytes from 1.1.1.1: icmp_seq=3 ttl=58 time=18.3 ms
64 bytes from 1.1.1.1: icmp_seq=4 ttl=58 time=18.4 ms
64 bytes from 1.1.1.1: icmp_seq=5 ttl=58 time=18.2 ms

--- 1.1.1.1 ping statistics ---
5 packets transmitted, 5 received, 0% packet loss, time 4005ms
rtt min/avg/max/mdev = 18.280/18.428/18.645/0.214 ms


Trace path to remote server

traceroute

Sample output:

~$ traceroute 1.1.1.1

traceroute to 1.1.1.1 (1.1.1.1), 30 hops max, 60 byte packets
1  * * *
2  45.63.113.1 (45.63.113.1)  4.686 ms  7.636 ms  10.529 ms
3  * * *
4  prs-b7-link.telia.net (62.115.58.17)  0.690 ms  0.678 ms  0.666 ms
5  prs-bb4-link.telia.net (62.115.121.72)  0.617 ms prs-bb4-link.telia.net (213.155.134.228)  0.627 ms prs-bb4-link.telia.net (62.115.120.26)  0.615 ms
6  prs-b8-link.telia.net (62.115.138.139)  1.191 ms prs-b8-link.telia.net (62.115.138.133)  1.181 ms  14.394 ms
7  cloudflare-ic-154355-prs-b8.c.telia.net (80.239.194.118)  1.870 ms  1.865 ms  1.735 ms
8  one.one.one.one (1.1.1.1)  0.807 ms  0.961 ms  0.969 ms


Perform DNS lookup and display the answer that is returned from the name server

dig

Sample output:

~$ dig linuxfornoobs.com

; <<>> DiG 9.10.3-P4-Ubuntu <<>> linuxfornoobs.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 330
;; flags: qr rd ra; QUERY: 1, ANSWER: 2, AUTHORITY: 0, ADDITIONAL: 1

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 4096
;; QUESTION SECTION:
;linuxfornoobs.com.             IN      A

;; ANSWER SECTION:
linuxfornoobs.com.      300     IN      A       104.27.187.153
linuxfornoobs.com.      300     IN      A       104.27.186.153

;; Query time: 19 msec
;; SERVER: 108.61.10.10#53(108.61.10.10)
;; WHEN: Tue Feb 05 11:23:56 CET 2019
;; MSG SIZE  rcvd: 78

Alternative #1:

nslookup

Sample output:

~$ nslookup linuxfornoobs.com

Server:         10.10.10.10
Address:        10.10.10.10#53

Non-authoritative answer:
Name:   linuxfornoobs.com
Address: 104.27.186.153
Name:   linuxfornoobs.com
Address: 104.27.187.153
Name:   linuxfornoobs.com
Address: 2606:4700:30::681b:ba99
Name:   linuxfornoobs.com
Address: 2606:4700:30::681b:bb99

Alternative #2:

host

Sample output:

~$ host linuxfornoobs.com

linuxfornoobs.com has address 104.27.187.153
linuxfornoobs.com has address 104.27.186.153
linuxfornoobs.com has IPv6 address 2606:4700:30::681b:ba99
linuxfornoobs.com has IPv6 address 2606:4700:30::681b:bb99
linuxfornoobs.com mail is handled by 10 c2b0268c838472d1.mx1.emailprofi.seznam.cz.
linuxfornoobs.com mail is handled by 20 c2b0268c838472d1.mx2.emailprofi.seznam.cz.


Active Internet connections (servers and established)

ss -neopa

Alternative (deprecated):

netstat -neopa


Active Internet connections (only servers)

ss -tulpn

Alternative (deprecated):

netstat -tulpn


Show routing table

ip r

Alternatives (deprecated):

netstat -rnv
route


Display ethernet card settings such as auto-negotiation, port speed, duplex mode, and Wake-on-LAN

ethtool

Sample output:

~$ sudo ethtool ens32

Settings for ens32:
        Supported ports: [ TP ]
        Supported link modes:   10baseT/Half 10baseT/Full
                                100baseT/Half 100baseT/Full
                                1000baseT/Full
        Supported pause frame use: No
        Supports auto-negotiation: Yes
        Supported FEC modes: Not reported
        Advertised link modes:  10baseT/Half 10baseT/Full
                                100baseT/Half 100baseT/Full
                                1000baseT/Full
        Advertised pause frame use: No
        Advertised auto-negotiation: Yes
        Advertised FEC modes: Not reported
        Speed: 1000Mb/s
        Duplex: Full
        Port: Twisted Pair
        PHYAD: 0
        Transceiver: internal
        Auto-negotiation: on
        MDI-X: off (auto)
        Supports Wake-on: d
        Wake-on: d
        Current message level: 0x00000007 (7)
                               drv probe link
        Link detected: yes
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)