I cannot connect to mysql from a remote server. I have bind-address
commented out but when I add rules in iptables to block other connections the requesting server's connection times out.
I tried this suggestion:
iptables -I INPUT 1 -p tcp -s 1.2.3.4 --dport 3306 -j ACCEPT
iptables -I INPUT 1 -p tcp --dport 3306 -j DROP
But my connection still times out. It doesn't matter which order I enter these two lines. I am echoing the remote server ip address when I attempt to connect and it is indeed the ip address I am using in my iptables. Without the DROP
line, the connection works fine, as it does when nothing is in my iptables.
The print out of echo -e "target prot opt source destination\n$(iptables -L INPUT -n | grep 3306)"
:
target prot opt source destination
ACCEPT tcp -- 1.2.3.4 0.0.0.0/0 tcp dpt:3306
DROP tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:3306
(above I have replaced the actual ip with 1.2.3.4)
Attempting a connection from another server (VPS) was successful. Which leads me to believe there is an issue with the shared server I am attempting to request from.