Yep, the most common way I've lost access to machines is by messing up the iptables/ipfw rules. Read a post here about avoiding that by having a timed reset with sleep.
Or use `at` to run `iptables-restore`. Simpler than setting up a cronjob (and if youre doing it manually, cron has a bunch of gotchas that at least bite me in the ass once in a blue moon).
Ah yes, that's simpler: systemctl stop iptables. Also need to do systemctl disable iptables just in case, otherwise if the server reboots the iptables service will restart.
and add it for ex to /etc/cron.hourly directory
This way you can test your iptables rules and they'll get clear at every hour. Once you check they are OK you can delete this cronjob.
(NOTE: I'm typing from memory, haven't tested this)