From: Stewart Thompson Subject: RE: block ports Date: Mon, 16 Sep 2002 00:28:55 -0700 Sender: netfilter-admin@lists.netfilter.org Message-ID: References: <0H2I00K6GRXQU3@l-daemon> Reply-To: stewart.thompson@shaw.ca Mime-Version: 1.0 Content-Transfer-Encoding: 7BIT Return-path: In-reply-to: <0H2I00K6GRXQU3@l-daemon> Errors-To: netfilter-admin@lists.netfilter.org List-Help: List-Post: List-Subscribe: , List-Id: List-Unsubscribe: , List-Archive: Content-Type: text/plain; charset="us-ascii" To: PayalR , netfilter@lists.netfilter.org Hi Payal: The rule below would allow all connections except On port 22 because of the !.. Set your policy to Drop and then have a rule allowing each port you want to let in. #iptables -A INPUT -i eth0 -p tcp --dport 22 -j ACCEPT Stu........ -----Original Message----- From: netfilter-admin@lists.netfilter.org [mailto:netfilter-admin@lists.netfilter.org]On Behalf Of PayalR Sent: September 16, 2002 12:03 AM To: netfilter@lists.netfilter.org Subject: block ports Hi all, I have a stupid question. I want to have incoming internet access for only port 22, 25, 80 and 110. How do I go abut it? I thought of this rule first, #iptables -A INPUT -i eth0 -p tcp --dport ! 22 -j DROP and go for the other ports as well. But my problem is that if a packet arrives from port 110, it will be checked for rule 1 above and since it is not for port 22 it will be dropped disregarding the next rules. Right? What can I do about this? How do I exactly frame the rules? Thanks a lot and bye. -Payal