Networking at the Command Line

  • Focus on some network utilities used for troubleshooting, testing and diagnosing network connectivity issues.

Commands

ping

  • ping - send one ore more ICMP ECHO_REQUEST packages to network hosts.

    • it is part of the iputils package

ping google.com
    PING google.com (142.251.209.14) 56(84) bytes of data.
    64 bytes from mil04s50-in-f14.1e100.net (142.251.209.14): icmp_seq=1 ttl=128 time=37.6 ms
    64 bytes from mil04s50-in-f14.1e100.net (142.251.209.14): icmp_seq=2 ttl=128 time=33.2 ms
    64 bytes from mil04s50-in-f14.1e100.net (142.251.209.14): icmp_seq=3 ttl=128 time=32.9 ms
    64 bytes from mil04s50-in-f14.1e100.net (142.251.209.14): icmp_seq=4 ttl=128 time=33.6 ms
	# It continuee the ping until stop (Ctrl+C)

# Ping a certain number of times
ping -c 2 google.com
    PING google.com (142.251.209.46) 56(84) bytes of data.
    64 bytes from mil04s51-in-f14.1e100.net (142.251.209.46): icmp_seq=1 ttl=128 time=34.5 ms
    64 bytes from mil04s51-in-f14.1e100.net (142.251.209.46): icmp_seq=2 ttl=128 time=34.7 ms

    --- google.com ping statistics ---
    2 packets transmitted, 2 received, 0% packet loss, time 1002ms
    rtt min/avg/max/mdev = 34.493/34.606/34.719/0.113 ms

ifconfig

  • ifconfig - configure a network interface

    • it is part of the net-tools package

ip

  • ip - powerful tool for configuring network interfaces

route

  • route - show and manipulate the IP routing table

nslookup / dig

  • nslookup - query Internet name servers interactively

  • dig - DNS lookup utility. More information than nslookup

netstat

  • netstat - print network connections, routing tables, interface statistics, masquerade connections, and multicast memberโ€ships

ss

  • ss - it replaces the netstat command

๐Ÿ“Œ More on checking for listening ports here.


Last updated

Was this helpful?