Home / Localhost / Test a port and find your IP

Test if a port is open (nc -zv) and find your local IP address

Check whether a remote port is open with nc -zv or Test-NetConnection, and find your computer's local IP address with ip a, ifconfig or ipconfig.

Two small checks solve many connection problems: can this computer reach a port on another machine, and what is this computer's own address. Use nc or Test-NetConnection for the first and ip, ifconfig or ipconfig for the second.

Check a port, then find your address

  1. Test the port: nc -zv hostname 443 on macOS and Linux, or Test-NetConnection hostname -Port 443 on Windows PowerShell.
  2. Read the result: a line saying succeeded means the port accepted the connection.
  3. Find your own address with the command for your system (below).
  4. Use that address from your phone or another computer, as in open from phone.

Commands you can copy

Test one port (macOS, Linux)
nc -zv example.com 443
Test a range of ports
nc -zv example.com 20-30
With a timeout
nc -zv -w 3 example.com 443
Windows PowerShell
Test-NetConnection example.com -Port 443
Windows: true or false only
Test-NetConnection example.com -Port 443 -InformationLevel Quiet
Linux: local address
ip a
Linux: short form
ip -br -4 addr
macOS or older Linux
ifconfig
Windows
ipconfig

Reading the results

nc -z and -v
-z checks whether something is listening without sending data. -v prints the result, such as Connection to host 22 port [tcp/ssh] succeeded!. -w sets a timeout in seconds; without it there is none.
UDP
nc -uz always reports success whatever the target's state, so it cannot tell you whether a UDP port is open.
Test-NetConnection
With -Port it tests TCP and shows TcpTestSucceeded : True or False. Without -Port it pings. -CommonTCPPort accepts SMB, HTTP, RDP and WINRM.
Succeeded but the app still fails
The port is open but the app may reject you, or use another protocol. Check the app's log.
Failed or timed out
A firewall, a wrong address, or nothing listening. Test from another network to separate your firewall from theirs. For your own machine, see the port checker.
ip a
The object name can be abbreviated: ip a is ip address. -br gives a short table, and -4 shows only IPv4. Look for an address like 192.168.1.25 on your Wi-Fi or Ethernet interface.
127.0.0.1 is not your network address
That is the loopback address. Your address for other devices is the 192.168.x.x or 10.x.x.x one.
Router address
Your router's address is a different thing; use the router IP finder.

Questions about Test a port and find your IP

How do I test if a port is open?
nc -zv host port on macOS and Linux, or Test-NetConnection host -Port port on Windows.
How do I find my local IP address on Linux?
Run ip a, or ip -br -4 addr for a short list.
How do I find my IP on macOS?
Run ifconfig and look for the inet line on en0 (Wi-Fi), or open System Settings, then Wi-Fi.
Is telnet still needed?
Usually not. nc and Test-NetConnection do the same job and are more often installed.

Updated 2026-10-27

Related pages