Welcome to the most active Linux Forum on the web.
Go Back > Forums > Linux Forums > Linux - Software
User Name
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.


  Search this Thread
Old 02-10-2005, 04:52 AM   #1
Registered: Jun 2004
Location: Nottingham, England
Posts: 89

Rep: Reputation: 15
IPtables - Block all except what I allow

Im making a new server with various services running (httpd, smtp etc)

I want to block all but allow access to these services

Ive started IPTables but it looks by default that it allows everything. Im using trustix 2.2.

Ive done many a search and with this being my first time with IPTables im a little confused.

I think Ive managed to block all with...

iptables -P INPUT DROP

Is that correct?
Old 02-10-2005, 05:06 AM   #2
Senior Member
Registered: Jan 2004
Location: Slovenia
Distribution: Slackware 10.1, SLAX to the MAX :)
Posts: 1,040

Rep: Reputation: 45
yes, now just allow what you want with iptables -P input ACCEPT protocol
Old 02-10-2005, 05:09 AM   #3
Registered: Jun 2004
Location: Nottingham, England
Posts: 89

Original Poster
Rep: Reputation: 15
iptables -P input ACCEPT 80

I get an error with this, also any idea where the config file for iptables is? Its not in /etc/sysconfg/

Last edited by ]SK[; 02-10-2005 at 05:40 AM.
Old 02-10-2005, 05:53 AM   #4
Registered: Jan 2004
Location: /lost+found
Distribution: Slackware 14.2
Posts: 845

Rep: Reputation: 33
it's not P after you already made the default policy it the A flag

iptable -A INPUT -s 0/0 -d 0/0 --sport 80 -j ACCEPT
Old 02-10-2005, 06:14 AM   #5
Registered: Jun 2004
Location: Nottingham, England
Posts: 89

Original Poster
Rep: Reputation: 15
OK ive got it working with

iptables -P input DROP
iptables -A INPUT -p tcp --dport 80 -j ACCEPT
iptables -A INPUT -p ICMP -j ACCEPT

How do I make these settings save as upon an 'service iptables restart' its back at allowing everything?


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
IPTables and PPTPD :S (to block or not to block) thewonka Linux - Networking 0 03-24-2005 06:58 PM
iptables block IP subnets bratch Linux - Networking 5 02-07-2005 02:03 AM
iptables, block port 80? frank2 Linux - Security 4 09-12-2004 09:14 AM
IPTables to block IP protocol ppuru Linux - Security 3 06-26-2004 02:20 AM
Block UT2003 with iptables Kostko Linux - Networking 1 11-23-2002 08:29 AM > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 08:33 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration