Development Linux Ubuntu

iptable change that survives a reboot

I am using the following command to make my UniFi Controller instance available at instead of

sudo iptables -t nat -I PREROUTING -p tcp --dport 443 -j REDIRECT --to-ports 8443

I want this setting to survive a restart. I’ve tried to add this line (prepended with @reboot) to my crontab file but it doesn’t seem to take. Can anyone tell me what I’m doing wrong? Here’s my crontab entry:

@reboot /sbin/iptables -t nat -I PREROUTING -p tcp --dport 443 -j REDIRECT --to-ports 8443

Edit: I am running Ubuntu 18.04.3 (in response to comment below)

Solved: I needed a blank line at the bottom of my crontab file.

Leave a Reply

Your email address will not be published. Required fields are marked *