If you need to open up ports 80
and 443
, on file /etc/iptables/rules.v4
just add
-A INPUT -p tcp -m state --state NEW -m multiport --dports 80,443 -j ACCEPT
directly below
-A INPUT -p tcp -m state --state NEW -m tcp --dport 22 -j ACCEPT
And reboot OR run bellow
sudo /sbin/iptables-restore < /etc/iptables/rules.v4
Thanks for the suggestion @11k
See that some lines of the rules.v4
file are commented with # at the beginning
you command not work
sudo iptables -I INPUT -s 0.0.0.0/0 -p tcp --dport 80 -j ACCEPT
sudo iptables -I INPUT -s 0.0.0.0/0 -p tcp --dport 443 -j ACCEPT
sudo iptables-save
sudo apt-get update
sudo apt-get install iptables-persistent -y
sudo netfilter-persistent save
sudo netfilter-persistent reload