In this guide I will use cPanel’s Dynamic DNS feature to create a subdomain, then add that subdomain to CSF to automatically whitelist each IP that calls the URL.
#1 Create Dynamic DNS
In cPanel go to Dynamic DNS and create a new subdomain.
![Whitelist Dynamic IP in CSF and cPanel image 27 - Whitelist Dynamic IP in CSF and cPanel](https://i0.wp.com/pcx3.com/wp-content/uploads/2022/03/image-27.png?resize=714%2C585&ssl=1)
cPanel will generate a unique URL that you need to open from your device:
![Whitelist Dynamic IP in CSF and cPanel image 28 - Whitelist Dynamic IP in CSF and cPanel](https://i0.wp.com/pcx3.com/wp-content/uploads/2022/03/image-28.png?resize=736%2C386&ssl=1)
#2 Set DynDNS in CSF
SSH to the server and add the hostname in csf.dyndns file
nano /etc/csf/csf.dyndns
![Whitelist Dynamic IP in CSF and cPanel image 29 - Whitelist Dynamic IP in CSF and cPanel](https://i0.wp.com/pcx3.com/wp-content/uploads/2022/03/image-29.png?resize=736%2C405&ssl=1)
edit csf.conf and set DYNDNS = “120” (to check for IP updates every 2 minutes) and DYNDNS_IGNORE = “1” to ignore activity from this IP.
nano /etc/csf/csf.conf
![Whitelist Dynamic IP in CSF and cPanel image 30 - Whitelist Dynamic IP in CSF and cPanel](https://i0.wp.com/pcx3.com/wp-content/uploads/2022/03/image-30.png?resize=736%2C402&ssl=1)
restart the firewall
csf -r
That’s it, now every time your IP changes you simply call the URL, cPanel crates A record for that subdomain, and CSF adds it.
![Whitelist Dynamic IP in CSF and cPanel image 31 - Whitelist Dynamic IP in CSF and cPanel](https://i0.wp.com/pcx3.com/wp-content/uploads/2022/03/image-31.png?resize=736%2C170&ssl=1)