Hello! I hope this post get's in the right place, cause I'm a newbie @ Linux
I'm trying to set up a Webserver, apache. And I'm confused which chain to set in IPTables. I hope'd someone could answer me a little more in detail, I've tryed googeling, but the answers were quite confusing for me, anyway here are the statement;
-A INPUT -p tcp -m tcp --dport 80 -j ACCEPT
and
-A INPUT -p tcp -m state --state NEW -m tcp --dport 80 -j ACCEPT
A know that that -A INPUT is for incoming packaes, -p specifies protocol TCP. But I'm unsure what -m does? Cause in the first line it is just "-m tcp" and in the second it is "-m state --state". So if someone could explant the diffrence and which one to use, I would be grateful.
And another question while I'm at it; In the start of IPTables I have;
-A INPUT ACCEPT
-P FORWARD ACCEPT
-P OUTPUT ACCEPT
What happens if I get a packet destined for some service, that isn't a chain in IPTables? Take port 80 for example, will IPTables accept the packet, but drop it at the end because there isn't any hit? If you understand what I mean. If -A INPUT would be DENY istead of ACCEPT, would the packet never ever get examined further then the first line?
Almost and the bottom of IPTables ther is a line;
-A INPUT -j REJECT --reject-with icmp-host-prohibited
Is it the chain that will be matched if there is not hit prior to it? What would happen if this line wasn't there?
Thank you very much for your help, I'm just wanna be sure little how IPTables work.
Best Regards; Stefan