Situatie
Whether you are troubleshooting network connectivity issues or configuring a firewall, one of the first things to check is what ports are actually opened on your system.
View the listening ports with the netstat command:
netstat -lntu
The output above shows the port 8080 is opened.
List the open sockets with the ss command:
ss -lntu
The port appears as part of the socket.
Test the port by specifying its number to the nmap command.
nmap localhost -p 8080
Test the Port with the Netcat Utility
The Netcat tool features the nc command that you can use to test an open port. To do so:
1. Use a command such as echo to pipe output to Netcat and specify the port to listen to. The example below pipes a message to test port 8
echo “Testing port 8080” | nc -l -p 8080
2. Leave the command running and open another terminal window.
3. In that terminal window, use a command such as telnet to query the local socket.
telnet localhost 8080
If the port is open, the output of the telnet command contains the message piped to nc in step 1.
Leave A Comment?