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
I somehow stumbled across this old Gist and have some tips for future wanderers.
INPUT
rules above it pointless.state
module with--state
, notconntrack
with--ctstate
. It also doesn't need to explicitly allowESTABLISHED
packets because the rule on line 12 already takes care of that.169.254.0.0/16
).FORWARD ACCEPT
policy on line 9. All packets will be forwarded indiscriminately.InstanceServices
rules shouldn't be modified. The Oracle Cloud docs explicitly state rules having to do with port3260
should be left alone, but I think you can extend that to all the rules in that chain unless you know what you're doing. Regardless, modifying them is unnecessary if the only goal is running a simple web server.If you need to open up ports
80
and443
, just adddirectly below
and you're ready to go!
And remember to update the Security List for your Compute instance's VNC, too.