How can I test if an IP port is accessible in Linux?
On Linux, you can utilize the telnet command to test the connectivity of an IP port. Here is a method to test if an IP port is reachable using telnet.
- Open the terminal.
- telnet IP address and port number
- connect to the IP address 192.168.0.1 using the telnet protocol on port 80
- Press the Enter key to execute the command.
- Attempting to connect to 192.168.0.1…
Successfully connected to 192.168.0.1.
Use ‘^]’ to exit. - Attempting to establish a connection with 192.168.0.1…
telnet: Unable to connect to 192.168.0.1: Connection rejected
Please note that the telnet command may not be installed by default on some Linux distributions. You can use a package manager to install it, for example, on Ubuntu, you can use the following command to install telnet:
sudo apt-get install telnet