open port in iptables code example
Example 1: iptables open port
sudo iptables -A INPUT -p tcp --dport xxxx -j ACCEPT
Example 2: iptables allow port from anywhere
sudo iptables -A INPUT -p tcp -m multiport --dports 80,443 -m conntrack --ctstate NEW,ESTABLISHED -j ACCEPT
sudo iptables -A OUTPUT -p tcp -m multiport --dports 80,443 -m conntrack --ctstate ESTABLISHED -j ACCEPT