Could not open connection to host (ubuntu server) on port 23, 5432, 3306
Your machine has a local IP address, if you want to access it from the internet you have to do a Static Port Mapping or Static Nating.
the best way to do that is from your router if it support static/custom port mapping by do the following
forward 192.168.0.33 port 23 to 23
and then you can access your server from your public IP address.
these are sample images for the router configurations.
also you can know your public IP from google https://www.google.com.eg/search?q=my+ip or from your router.
kuri
Updated on September 18, 2022Comments
-
kuri over 1 year
I have recently installed few packages for telnet, mysql and postgreSQL. I can access all these service locally on the ubuntu server but somehow I am not able to access these services from other machines. Below are the active internet connections using:
sudo netstat -tulpn tcp 0 0 0.0.0.0:23 0.0.0.0:* LISTEN 18776/inetd tcp 0 0 0.0.0.0:3306 0.0.0.0:* LISTEN 19451/mysqld tcp 0 0 0.0.0.0:5432 0.0.0.0:* LISTEN 8453/postgres
I am not able to figure out what I am missing. I am almost sure that I have configured these packages correctly to allow outside world connections.
When I am trying telnet from windows, I got "Could not open connection to the host, on port 23: Connect failed"
I doubt, my router might have blocked these connections but I don't know how to troubleshoot or unblock these connections. Please suggest, Many thanks!
-
Ahmed Daif about 10 yearsare you trying to access it from the local network or the internet ??
-
kuri about 10 yearsI am trying to access it from internet
-
kuri about 10 yearsMy machine has local network IP address i,e 192.168.0.33
-
-
kuri about 10 years
22 DENY Anywhere
2222 ALLOW Anywhere
80 ALLOW Anywhere
25 ALLOW Anywhere
143 ALLOW Anywhere
110 ALLOW Anywhere
993 ALLOW Anywhere
995 ALLOW Anywhere
8080 ALLOW Anywhere
3306 ALLOW Anywhere
23 ALLOW Anywhere
-
kuri about 10 yearsabove is the result of
sudo ufw status
. Sorry for bad formatting but I don't understand how this damn thing works. I tried using two spaces at the end of each line also using linebreaks <br/> -
2707974 about 10 yearsok, port 23 is for telnet. Is open. If I understand you try to connect to server and server and pc on same lan? If not, and traffic flow is pc -> router -> internet -> router -> server, you must add port forwarding rule to router on server side.
-
hmayag about 10 years@2707974 has a point. If you are using a xDSL modem/router, then look in the setup for something like "virtual servers" or "port forwarding" and create a rule for each one of your servers. Also for postgres make sure that the sever is configured to listen for external TCP/IP connections. The default is to listen only to
localhost
for security reasons. Read here for more information. -
kuri about 10 yearsThanks 2707974 and hmayag. Suggestion to add port forwarding rule in router, works :)