I decided to run this command
iptables-save | tee iptables_backup.conf | grep -v '\-A'
but instead I accidentally put an extra command iptables-restore and ran this and now my server is locked. I cannot SSH anymore:
iptables-save | tee iptables_backup.conf | grep -v '\-A' | iptables-restore
I can access my server from the rescue disk and view all the files, but how do I revert the above command to start my server ?
I'm using Centos 8.
Smart of you to take a backup. Why not use it?
Since the backup was useless because it didn't contain ipv6, I should had done another backup for ipv6 like this:
I solved it by restoring the iptables to the original state at boot time using rc.local. So, when booting into recovery I edited this file:
Then, I rebooted the system. The above script will run, and now I can access my server.
After everything is ok, then I removed all the above commands to prevent auto run again for the second time.