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.

  1. Open the terminal.
  2. telnet IP address and port number
  3. connect to the IP address 192.168.0.1 using the telnet protocol on port 80
  4. Press the Enter key to execute the command.
  5. Attempting to connect to 192.168.0.1…
    Successfully connected to 192.168.0.1.
    Use ‘^]’ to exit.
  6. 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
bannerAds