I want to allow a new application server to access mysql on current 3306 port, I used the following command
iptables -I INPUT 13 -s 111.222.333.444 -p tcp --dport 3306 -j ACCEPT
It is working as expected. I can check if the rule is set as expected.
iptables -nvL
4 240 ACCEPT tcp -- * * 111.222.333.444 0.0.0.0/0 tcp dpt:3306
How do I revoke the access?
You can delete the rule using:
You can see
man iptablesfor more options.Please, note that this assumes that default INPUT policy is
DROP. Otherwise, you need to add an explicitDROPrule.If you want to deny remote access to mysql server for all IPs, you can change the listen address to be
127.0.0.1.