7 ways to look at network connections on Linux


Whether you’re managing a network at work or just watching out for your home systems, it’s important to understand your network connections–how you communicate with public systems and those on the local network. This article covers some of the most important commands available on Linux to help you get a clear understanding of your local network and how it reaches outside.

While the links provided include important tips on using network commands, some include commands that have been deprecated in favor of newer commands. Some of the most important commands to know today include ip a, ip neigh, ping, tracepath, dig, tcpdump and whois.

(If a command is deprecated, it doesn’t mean it doesn’t work or isn’t available. It means that the command has been replaced with a newer command that serves the same purpose and is likely better supported.)

ip a

The ip a command will provide information on your network interface. This includes your assigned IP address (even if assigned automatically) and the loopback address that is used when the system needs to communicate with itself, the benefit being that it remains stable where the assigned IP address may not always be the same.

The ip a command has largely replaced the deprecated ifconfig command. It provides the same variety of data, but in a different format. The output below shows the loopback (lo) address ( and the system’s assigned (enp0s25) address (

$ ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host
       valid_lft forever preferred_lft forever
2: enp0s25: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
    link/ether 00:1d:09:77:9d:08 brd ff:ff:ff:ff:ff:ff
    inet brd scope global dynamic noprefixroute enp0s25
       valid_lft 74857sec preferred_lft 74857sec
    inet6 fe80::bb32:464a:77a3:acd7/64 scope link noprefixroute
       valid_lft forever preferred_lft forever

The ip link command provides similar information, but less of it.

$ ip link
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: enp0s25: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP mode DEFAULT group default qlen 1000
    link/ether 00:1d:09:77:9d:08 brd ff:ff:ff:ff:ff:ff

ip neigh

$ arp -a
_gateway ( at 1c:64:99:ec:b1:97 [ether] on enp0s25
? ( at b0:c0:90:3f:10:15 [ether] on enp0s25
? ( at 74:e2:0c:da:27:53 [ether] on enp0s25
? ( at cc:3d:82:39:78:85 [ether] on enp0s25
? ( at <incomplete> on enp0s25
$ ip neigh dev enp0s25 lladdr 1c:64:99:ec:b1:97 STALE dev enp0s25 lladdr b0:c0:90:3f:10:15 REACHABLE dev enp0s25 lladdr 74:e2:0c:da:27:53 REACHABLE dev enp0s25 lladdr cc:3d:82:39:78:85 REACHABLE dev enp0s25  FAILED
fe80::1e64:99ff:feec:b197 dev enp0s25 lladdr 1c:64:99:ec:b1:97 router STALE

The ip neigh command can provide even more detail about systems on your network including MAC address, and it supports removing IP addresses from your arp table.


The ping command continues to be very useful by sending packets to another system to gather a response that shows that the system is up and reachable.

$ ping www.networkworld.com
PING idg.map.fastly.net ( 56(84) bytes of data.
64 bytes from ( icmp_seq=1 ttl=57 time=49.2 ms
64 bytes from ( icmp_seq=2 ttl=57 time=32.4 ms
64 bytes from ( icmp_seq=3 ttl=57 time=125 ms
64 bytes from ( icmp_seq=4 ttl=57 time=75.9 ms

--- idg.map.fastly.net ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 3000ms
rtt min/avg/max/mdev = 32.388/70.534/124.680/34.892 ms


The tracepath command follows in the footsteps of the traceroute command. It allows you to see the route that a system takes to reach a remote system and is often used in troubleshooting connection problems. If you use tracepath to check your connection to your local router, the response should be short and quick. Remote systems usually require more time as tracepath moves between links and often descends into a series of “no reply” messages as routers along the way may not respond with details.

The tracepath command defaults to a limit of 30 hops (connections between routers), but this can be increased using the -m options (e.g., tracepath -m 50).

$ tracepath
 1?: [LOCALHOST]                      pmtu 1500
 1:  _gateway                                              3.503ms reached
 1:  _gateway                                              2.558ms reached
     Resume: pmtu 1500 hops 1 back 1
$ tracepath world.std.com
 1?: [LOCALHOST]                      pmtu 1500
 1:  _gateway                                              3.526ms
 1:  _gateway                                              4.212ms
 2:  _gateway                                              7.928ms pmtu 1492
 2:                                          40.141ms
 3:                                           50.127ms
 4:                                          68.552ms
 5:                                          45.820ms asymm  4
 6:                                          54.701ms asymm  5
 7:  rest-b2-link.ip.twelve99.net                         75.532ms asymm  6
 8:  rest-bb1-link.ip.twelve99.net                        66.185ms asymm  9
 9:  ash-b2-link.ip.twelve99.net                          73.287ms asymm  6
10:  no reply
11:  no reply
12:  ae23.cs1.lga5.us.eth.zayo.com                        81.707ms asymm 13
13:  ae8.mpr3.bos2.us.zip.zayo.com                        82.203ms asymm 10
14:               58.666ms asymm 12
15:                                         66.011ms asymm 13
16:                                       74.448ms asymm 14
17:  world.std.com                                       112.248ms reached
     Resume: pmtu 1492 hops 17 back 14

nslookup and dig

While the nslookup command is still well used, the dig command has largely replaced it and is considered a better choice. Here are some samples of the kind of output the dig command will provide:

$ dig world.std.com

; <<>> DiG 9.16.33-RH <<>> world.std.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 62339
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 1

; EDNS: version: 0, flags:; udp: 65494
;world.std.com.                 IN      A

world.std.com.          7180    IN      A

;; Query time: 2 msec
;; WHEN: Mon Dec 12 11:19:00 EST 2022
;; MSG SIZE  rcvd: 58


The tcpdump command can print out the headers of network packets as they reach your server or can be used with various filters to select just the packets you want to see. You can also save packets for later analysis. Acting as a sniffer, tcpdump can be a valuable troubleshooting tool.


The whois command can find a lot of information about a domain. The output below is truncated but shows the kind of information you can expect to retrieve.

$ whois networkworld.com | head -8
[Querying whois.verisign-grs.com]
[Redirected to whois.markmonitor.com]
[Querying whois.markmonitor.com]
Domain Name: networkworld.com
Registry Domain ID: 293248_DOMAIN_COM-VRSN
Registrar WHOIS Server: whois.markmonitor.com
Registrar URL: http://www.markmonitor.com

Testing upload and download speeds

The speedtest tool, which you likely will have to install, can be used to calculate your upload and download speed.

$ speedtest
Retrieving speedtest.net configuration...
Testing from Shentel Communications (
Retrieving speedtest.net server list...
Selecting best server based on ping...
Hosted by Lumos Fiber (Waynesboro, VA) [112.99 km]: 33.642 ms
Testing download speed................................................................
Download: 6.87 Mbit/s
Testing upload speed..................................................................
Upload: 1.38 Mbit/s


Linux provides a lot of very useful commands for checking network settings and testing connectivity.

Copyright © 2022 IDG Communications, Inc.

Source link


Please enter your comment!
Please enter your name here

Share post:


More like this

Winklevoss crypto firm Gemini to return $1.1bn to customers

Gemini was co-founded by twins Tyler and Cameron...

Quordle today – hints and answers for Thursday, February 29 (game #766)

It's time for your daily dose of Quordle...

‘I’d heard the big, bad, scary conversation about AI’

Janna Salokangas, co-founder of Miami-based Mia, says that...

Google Gemini’s new Calendar capabilities take it one step closer to being your ultimate personal assistant

Google’s new family of artificial intelligence (AI) generative...