Today I have to change the firewall rules to allow connection to MySQL from a remote server. First I check existing rules on the server that has MySQL and I see where to add the new rule.
# /sbin/iptables –list –line-numbers
Chain INPUT (policy DROP)
num target prot opt source destination
[...]
13 ACCEPT tcp — anywhere anywhere tcp dpt:https state NEW
14 ACCEPT tcp — anywhere anywhere tcp dpt:snpp state NEW
15 ACCEPT tcp — anywhere anywhere tcp dpt:microsoft-ds state NEW
16 ACCEPT tcp — anywhere anywhere state NEW tcp dpt:ssh recent: CHECK name: SSH side: source
[...]
I think between rule 15 and 16 is fine, so I add it.
# /sbin/iptables -I INPUT 15 -p tcp -m state –state NEW -s 82.96.97.91 –dport 3306 -j ACCEPT
# /sbin/iptables –list –line-numbers
[...]
14 ACCEPT tcp — anywhere anywhere tcp dpt:snpp state NEW
15 ACCEPT tcp — masako.obliquid.com anywhere state NEW tcp dpt:mysql
16 ACCEPT tcp — anywhere anywhere tcp dpt:microsoft-ds state NEW
[...]
Now host masako can connect to MySQL on sakura.



