Linux test TCP/UDP port connectivity with nc command

TCP

# nc -z -v [hostname or IP address] [port number]
nc -z -v 192.168.100.1 443
Connection to  192.168.100.1 443 port [tcp/https] succeeded!

UDP

# nc -z -v -u [hostname or IP address] [port number]
# nc -z -v -u 192.168.100.1 123 
Connection to  192.168.100.1 123 port [udp/ntp] succeeded!

Bouns

We can also test TCP port with telnet command

telnet [hostname or IP address] [port number]
# telnet 192.168.100.1 443
Trying 192.168.100.1…
Connected to 192.168.100.1.
Escape character is '^]'.

If return “Connected to xxx.xxx.xxx.xxx”, it means the port is open and functional

If return “Trying xxx.xxx.xxx.xxx…”, it means the port is closed or not accessible.

Computer can only access Google, YouTube, microsoft.com etc. or Nothing at all

Keywords: Internet connection, Limited internet access, netsh, winsock, ipconfig, Microsoft Windows, WiFi, WiFi Router, Modem

Sometimes, you will find that your computer can only access Google, or microsoft.com etc.

For Mirosoft Windows there are many tricks you can try:

1 Win + R

2 Type cmd and hit Enter key.

Try each of these and hit enter at the end of each line

(If use netsh int ip reset, ignore netsh int ipv4 reset and netsh int ipv6 reset)

netsh winsock reset
netsh int ip reset
netsh int ipv4 reset
netsh int ipv6 reset

3 Restart your computer

4 Follow step 1-3 and type following commands, hit enter at the end of each line

ipconfig /release
ipconfig /renew

5 Wait 3 minutes

If you still can not get online.

Try to power cycle/restart your WiFi/Router/Modem. (Normally the box at home or small office you use to access WiFi and internet.)