aws server connect: no route to host solution

After setting up the security group on aws, the servers can be pinged, but not telneted, which may be a problem with the firewall.

On Linux, there are two common firewalls: iptables and firewalld.

If you get a "dial tcp 52.194.118.92:9090: connect: no route to host" error message, it means that you cannot connect to the specified server and port.

There can be several reasons for this error, such as:

Server is down: If the target server is down or inaccessible, you cannot connect to it. Please check that the server is running and the network connection is working.

A firewall is blocking the connection: If a firewall is enabled on your system, it may be blocking connections to certain ports. Make sure your firewall is properly configured to allow connections to port 9090. You can check if iptables allows connections to port 9090 with the command

sudo iptables -L INPUT -n | grep 9090

If there is no response message, the firewall port is not open

iptables

sudo iptables -A INPUT -p tcp --dport 9090 -j ACCEPT
sudo service iptables save
sudo service iptables reload

firewalld

If sudo service iptablesyou get an "iptables: unrecognized service"error , your Linux system may be using a firewall management tool other than iptables.

In some Linux distributions, such as CentOS 7 or RHEL 7, firewalld is used as the default firewall solution instead of iptables. If you are using firewalld, use the following command to list the current firewall status:
sudo firewall-cmd --state
If the output shows that the firewall is functioning normally, you can use the following command to modify the firewall rules:

sudo firewall-cmd --zone=public --add-port=9090/tcp --permanent
sudo firewall-cmd --reload

Guess you like

Origin blog.csdn.net/majiayu000/article/details/129518487