> For the complete documentation index, see [llms.txt](https://chunhthanhde.gitbook.io/google-learning-programs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://chunhthanhde.gitbook.io/google-learning-programs/google-it-support-professional-certificate/course-2-the-bits-and-bytes-of-computer-networking/module-6-troubleshooting-and-the-future-of-networking/2.verifying-connectivity/3.testing-port-connectivity.md).

# Connectivity Testing Beyond the Network Layer 🌐

## Netcat: A Swiss Army Knife for Connectivity Testing 🛠️

Netcat on Linux and MacOS is a powerful tool that can be used to test connectivity at the transport layer. The `nc` command has two mandatory arguments: a host and a port. Running `nc google.com 80` would try to establish a connection on port 80 to google.com. If the connection succeeds, you'll see a blinking cursor waiting for more input, allowing you to send application-layer data to the listening service.

### Checking Port Status 🔍

To simply check the status of a port, you can use the `-z` (zero input output mode) and `-v` (verbose) flags with the `nc` command. The output will tell you whether a connection to the specified port is possible or not.

## Test-NetConnection on Windows 💻

On Windows, the `Test-NetConnection` command provides similar functionality. If you run `Test-NetConnection` with only a host specified, it will default to using an ICMP echo request, much like the `ping` program, but it will display more data, including the data link layer protocol being used. When you add the `-port` flag, you can test connectivity to a specific port.

## Beyond the Basics 🚀

It's important to note that both Netcat and Test-NetConnection are way more powerful than the brief port connectivity examples covered here. These are complex tools with a wide range of functionality, and covering all their capabilities would be too much for a single article. We encourage you to explore the full capabilities of these super powerful tools through further research and experimentation.
