Endpoints and Media Types · Topic 4 of 5
Checking Connectivity on Windows, Linux and macOS
Learn the basic network utilities on Windows, Linux and macOS, such as ipconfig, ip, ifconfig, ping and traceroute, and how to read their results.
- 4 min
- Windows uses
ipconfigto show addresses. Linux usesip addr show, and macOS usesifconfig. ipconfig /allshows the MAC address, DHCP status and DNS servers.- Windows uses
tracert. Linux and macOS usetraceroute.
What it is
Each operating system has built in tools that show a device's network settings and test whether it can reach other devices.
The tools are mostly run from a command window. Names differ a little between systems, but the ideas are the same.
This page covers desktop operating systems. The next page covers phones, tablets and wireless client settings.
How it works
Work from the inside out, checking your own settings first and then testing further away.
Windows
Open Command Prompt or PowerShell. The main commands are below.
C:\> ipconfig
C:\> ipconfig /all
C:\> ping 192.168.1.1
C:\> tracert web.example.com
C:\> nslookup web.example.com
ipconfig shows the IPv4 address, subnet mask and default gateway for each adapter. ipconfig /all adds more, such as the physical (MAC) address, whether DHCP is on, and the DNS servers.
ping sends test messages and shows replies. tracert lists each router on the way to a destination. nslookup asks a DNS server to turn a name into an address.
Windows ping sends four messages and then stops. The switch -t makes it continue until you stop it.
Linux
Open a terminal. Modern Linux uses the ip command, and the older ifconfig may still be present on some systems.
$ ip addr show
$ ip route show
$ ping -c 4 192.168.1.1
$ traceroute web.example.com
$ nslookup web.example.com
ip addr show lists the addresses on each interface. ip route show includes the default gateway.
Linux ping keeps going until you press Ctrl+C, so -c 4 limits it to four messages. The path tracing command is traceroute, and on some systems traceroute and nslookup must be installed first.
macOS
macOS is built on a Unix base, so its commands resemble Linux. Open the Terminal app.
% ifconfig
% ping -c 4 192.168.1.1
% traceroute web.example.com
% nslookup web.example.com
ifconfig lists the interfaces and their addresses. On many Mac laptops the Wi-Fi interface is named en0. Network settings can also be viewed in the system settings screens.
Command comparison
| Task | Windows | Linux | macOS |
|---|---|---|---|
| Show addresses | ipconfig | ip addr show | ifconfig |
| Test reachability | ping | ping | ping |
| Trace the path | tracert | traceroute | traceroute |
| Look up a name | nslookup | nslookup | nslookup |
Reading the results
A reply from ping shows the time taken, in milliseconds. If you see no reply, the message may have been lost, blocked or sent to an address that does not exist.
A tracert or traceroute result lists each router on the path, with the time to reach it. If the list stops part way, the trace has found where traffic no longer gets through, or a device that does not answer.
A simple method
Follow these steps in order.
- Check that the device has a sensible IP address. An address starting 169.254 suggests DHCP failed.
- Ping the default gateway. If it replies, the local link works.
- Ping a public address. If it replies, routing to the internet works.
- Ping or look up a name. If the address works but the name fails, DNS is the likely problem.
What to remember for the exam
Seven facts cover most questions on this topic.
- Windows uses
ipconfigto show addresses. Linux usesip addr show, and macOS usesifconfig. ipconfig /allshows the MAC address, DHCP status and DNS servers.- Windows uses
tracert. Linux and macOS usetraceroute. nslookuptests DNS name resolution.- Windows
pingsends four messages. Linux and macOSpingrun until stopped. - Test in order: own address, gateway, internet address, then name.
- An address starting 169.254 means the device did not receive an address from DHCP.
If pinging an address works but pinging a name fails, the problem is DNS and not the link.
Common mistakes
These four errors appear again and again.
Using the wrong command for the system. tracert is for Windows, and traceroute is for Linux and macOS.
Pinging a far destination first. Start with the gateway so you know where the fault sits.
Letting Linux ping run forever. Press Ctrl+C or use -c.
Reading a 169.254 address as normal. It means the device could not obtain an address.
A failed ping does not always mean a broken link. A firewall can be set to ignore ping requests.
Check yourself
Work through these three questions.
Which command shows the IP address and default gateway on a Windows PC?
The
ipconfigcommand shows them for each adapter.A ping to an IP address works, but a ping to a name fails. What is the likely cause?
DNS is the likely cause, because the link works but the name is not being turned into an address.
Which command traces the path to a destination on Linux?
The
traceroutecommand does this.
Topic 4 of 5 in Endpoints and Media Types
Test yourself on Endpoints and Media Types
The full Cisco CCST 100-150 Networking question bank has 749 questions, with timed practice exams and an explanation for every answer.
This study guide is independent and is not affiliated with, endorsed by, or sponsored by Cisco. Vendor names, certification names and exam codes are trademarks of their respective owners and are used for identification only.