iptables allow dyndns domain name and auto update rules

Posted by user3215 on Ask Ubuntu See other posts from Ask Ubuntu or by user3215
Published on 2010-10-13T08:24:31Z Indexed on 2010/12/29 20:59 UTC
Read the original article Hit count: 262

Filed under:

I have registered with dyndns domain for my dynamically changing public ip address to use with iptable rules. On a server I've allowed some ports for this domain in the iptables configuration like the below entries:

-A INPUT -s mycompany.dyndns.com -p tcp -m tcp --dport 22 -j ACCEPT
-A INPUT -s mycompany.dyndns.com -p tcp -m tcp --dport 3306 -j ACCEPT
-A INPUT -s mycompany.dyndns.com -p tcp -m tcp --dport 21 -j ACCEPT

But when ever my modem restarts, I couldn't connect to these allowed ports as public ip changes with modem restart and are not updated in the iptables on the server. Is there any option to automatically update iptable rules on server.

© Ask Ubuntu or respective owner

Related posts about iptables