In case you have run some iptable command and locked yourself out of remote access to the server but can gain console or direct access, run the following commands to reset the rules back to default “accept” and flash the tables:
# iptables -P INPUT ACCEPT
# iptables -P OUTPUT ACCEPT
# iptables -P FORWARD ACCEPT
# iptables -F
Tech Junction Edited answer May 29, 2024