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
In a nutshell
  • Windows uses ipconfig to show addresses. Linux uses ip addr show, and macOS uses ifconfig.
  • ipconfig /all shows the MAC address, DHCP status and DNS servers.
  • Windows uses tracert. Linux and macOS use traceroute.

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.

Check addressipconfig or ipthenTest gatewaypingthenTest internetping an addressthenTest namesnslookup

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

TaskWindowsLinuxmacOS
Show addressesipconfigip addr showifconfig
Test reachabilitypingpingping
Trace the pathtracerttraceroutetraceroute
Look up a namenslookupnslookupnslookup

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.

  1. Check that the device has a sensible IP address. An address starting 169.254 suggests DHCP failed.
  2. Ping the default gateway. If it replies, the local link works.
  3. Ping a public address. If it replies, routing to the internet works.
  4. Ping or look up a name. If the address works but the name fails, DNS is the likely problem.
PC192.168.1.50ping 1Gateway192.168.1.1ping 2Internet addressreached by numberping 3 by nameDNSname lookup

What to remember for the exam

Seven facts cover most questions on this topic.

  • Windows uses ipconfig to show addresses. Linux uses ip addr show, and macOS uses ifconfig.
  • ipconfig /all shows the MAC address, DHCP status and DNS servers.
  • Windows uses tracert. Linux and macOS use traceroute.
  • nslookup tests DNS name resolution.
  • Windows ping sends four messages. Linux and macOS ping run 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.
Exam tip

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.

Watch out

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 ipconfig command 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 traceroute command 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.