Iptables is your weapon to secure your server from outsider. You will allow the traffic that you know only. You have the capability to choose which traffic you allow to access your server and which traffic can go outside. If you have work with many rules and you have messed your rules and want to comeback to default iptables rules, this guide will allow you to clear and get the default iptables rules.
iptables -P INPUT ACCEPT iptables -P FORWARD ACCEPT iptables -P OUTPUT ACCEPT iptables -t nat -F iptables -t mangle -F iptables -F iptables -X
To clear ipv6 tables
ip6tables -P INPUT ACCEPT ip6tables -P FORWARD ACCEPT ip6tables -P OUTPUT ACCEPT ip6tables -t nat -F ip6tables -t mangle -F ip6tables -F ip6tables -X
To verify you have the default iptables rules, type
iptables -nvL will show you the information similar to this:
# iptables -nvL Chain INPUT (policy ACCEPT 1341 packets, 161K bytes) pkts bytes target prot opt in out source destination Chain FORWARD (policy ACCEPT 0 packets, 0 bytes) pkts bytes target prot opt in out source destination Chain OUTPUT (policy ACCEPT 1624 packets, 1661K bytes) pkts bytes target prot opt in out source destination