By Sandra Henry-Stocker, Unix Dweeb, Network World |
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.)
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 (127.0.0.1) and the system’s assigned (enp0s25) address (192.168.0.7).
The ip link command provides similar information, but less of it.
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.
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).
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:
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.
The speedtest tool, which you likely will have to install, can be used to calculate your upload and download speed.
Linux provides a lot of very useful commands for checking network settings and testing connectivity.
Next read this:
- 9 career-boosting Wi-Fi certifications
- What is MPLS, and why isn’t it dead yet?
- 11 ways to list and sort files on Linux
- 5 free network-vulnerability scanners
- How-to measure enterprise Wi-Fi speeds
Sandra Henry-Stocker has been administering Unix systems for more than 30 years. She describes herself as “USL” (Unix as a second language) but remembers enough English to write books and buy groceries. She lives in the mountains in Virginia where, when not working with or writing about Unix, she’s chasing the bears away from her bird feeders.
Copyright © 2022 IDG Communications, Inc.
Copyright © 2023 IDG Communications, Inc.