How to Flush Iptables Properly
You Should Be Careful when you flush iptables rules, because if you do not flush iptables properly, you could end up being locked out of your server.
Use following bash script to flush iptables rules, instead of applying iptables -F Command Directly to the system.
#!/bin/bash
/sbin/iptables -P INPUT ACCEPT
/sbin/iptables -P OUTPUT ACCEPT
/sbin/iptables -F
Always make sure to set the default policy of the both input and output chain to Accept all packets before iptables flush. Otherwise, you will not be able to establish remote ssh connections to the server, Which means you will need physical access to the server in order to fix the problem.