0

I have just bought the unmanaged VPS. I am running a node js application that uses a connection string for mysql database stored somewhere else.

The connection between vps (nodejs web) and mysql server is not successful.

It is successful, when I try a telnet call from my local machine to mysql server. However, when I do a telnet from the VPS SSH to the mysql server it is giving the following error:

r]# telnet 64.XX.XX.XX 3306
Trying 64.XX.XX.XX...
telnet: connect to address 64.XX.XX.XX: Connection timed out

I have tried to set the following firewall ruleset but there is no success.

iptables -L result:

Chain INPUT (policy ACCEPT)
target     prot opt source               destination         
ACCEPT     tcp  --  anywhere             anywhere             tcp spt:mysql ctstate ESTABLISHED
ACCEPT     tcp  --  anywhere             anywhere             tcp spt:mysql state ESTABLISHED

Chain FORWARD (policy ACCEPT)
target     prot opt source               destination         

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination         
ACCEPT     tcp  --  anywhere             anywhere             tcp dpt:mysql
ACCEPT     tcp  --  anywhere             anywhere             tcp dpt:mysql
codebased
  • 101
  • 4

1 Answers1

0

You appear to be only allow in ESTABLISHED connections, you need to allow NEW too for the connection to become ESTABLISHED.

I would try

iptables -I INPUT -p tcp -m tcp --dport 3306 -j ACCEPT

to see if it works then tune as required.

user9517
  • 115,471
  • 20
  • 215
  • 297