Just wanted to understand what did I missed to configure? Any assistance to help me understand is much appreciated.
Task:We want to open all incoming connections to Nginx’s port and want to block all incoming connections to Apache’s port. Also make sure rules are permanent. Apache and Nginx ports are 8085 and 8094 respectively.
Thanks @Tej-Singh-Rana for the reply, but the issue was not that.
I figured out the issue which was that I used “–append” in the iptables rule which actually adds the rule in the end. I never noticed that the before i appended the rule, it was reject all.
Just that we need to be careful in checking the current rules before applying the new rules.
but you just did append that means added in the last line of chain. Even you added in first and last, rules will works. I think append options is also correct.
I think disable option is matter here. @Inderpreet can you please clear this issue. It will clear my doubts too. tasks failed reason is append option or service disable option? kindly brief more if possible.
sudo systemctl enable iptables is for start the service in next boot up automatically that’s not the process to make permanent.
iptables save something like command to make permanent.
Below image shows that iptable rules before. then i exited from ssh session. and then i sshed once again and listed the rules. both the times rules were same.