LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Security
User Name
Password
Linux - Security This forum is for all security related questions.
Questions, tips, system compromises, firewalls, etc. are all included here.

Notices


Reply
  Search this Thread
Old 08-30-2005, 04:29 AM   #1
newguy88
LQ Newbie
 
Registered: Aug 2005
Posts: 3

Rep: Reputation: 0
Unhappy my iptables problem


Hi,

I 'm a new user of Linux. I just installed a Fedora 4 in my PC (with DNS, httpd service). I would like to set up my firewall with iptables.

My pc is a standalone to connect internet, however i cannot see the webpage after i setup my table (as below).

--------------------------------------------------------------------------------------
[root@localhost~]# iptables -L -n

Chain FORWARD (policy DROP)
target prot opt source destination


Chain INPUT (policy DROP)
target prot opt source destination
ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:53 state NEW,RELATED,ESTABLISHED
ACCEPT udp -- 0.0.0.0/0 0.0.0.0/0 udp dpt:53 state NEW,RELATED,ESTABLISHED
ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:80 state NEW,RELATED,ESTABLISHED
ACCEPT udp -- 0.0.0.0/0 0.0.0.0/0 udp dpt:80 state NEW,RELATED,ESTABLISHED


Chain OUTPUT (policy ACCEPT)
target prot opt source destination

Chain RH-Firewall-1-INPUT (0 references)
target prot opt source destination

---------------------------------------------------------------------------------------

So, what 's wrong of my setting? Any suggest?
Sorry for my stupid!

Thanks!
 
Old 08-30-2005, 05:01 AM   #2
nixcraft
Member
 
Registered: Nov 2004
Location: BIOS
Distribution: RHEL3.0, FreeBSD 5.x, Debian 3.x, Soaris x86 v10
Posts: 379

Rep: Reputation: 30
Where is your OUTPUT rule? You need to setup both INPUT and OUTPUT rule for iptables to work. Here is an example for httpd http://www.cyberciti.biz/nixcraft/vi...k-or-open.html and port 53 (DNS) http://www.cyberciti.biz/nixcraft/vi...k-or-open.html

Hope this helps
 
Old 08-30-2005, 05:48 AM   #3
newguy88
LQ Newbie
 
Registered: Aug 2005
Posts: 3

Original Poster
Rep: Reputation: 0
Hi,

Thanks for your help.

Just wondering why still need to setup the OUTPUT?
Because my OUTPUT table is:

Chain OUTPUT (policy ACCEPT)
target prot opt source destination


Is it assume all output packet can be go out?

Why i cannot go to any web page by browser. Am i make a mistake in my table?

Thanks!
 
Old 08-30-2005, 06:27 AM   #4
Capt_Caveman
Senior Member
 
Registered: Mar 2003
Distribution: Fedora
Posts: 3,658

Rep: Reputation: 69
Yeah, with no rules in OUTPUT and a default policy of ACCEPT it should allow all outgoing traffic.

Try adding a logging rule to the end of the INPUT chain and check your system logs to see what's getting dropped:
iptables -A INPUT -j LOG --log-prefix "INPUT DROPPED"

Offhand, I'd say you need a general rule in the INPUT chain to allow ESTABLISHED,RELATED connections:
iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
 
Old 08-30-2005, 07:03 AM   #5
nixcraft
Member
 
Registered: Nov 2004
Location: BIOS
Distribution: RHEL3.0, FreeBSD 5.x, Debian 3.x, Soaris x86 v10
Posts: 379

Rep: Reputation: 30
You are right about OUTPUT, but in the past I had same prob and since then I always add input and output rule to avoid problem and it works. So just try to add output
 
Old 08-30-2005, 07:36 AM   #6
newguy88
LQ Newbie
 
Registered: Aug 2005
Posts: 3

Original Poster
Rep: Reputation: 0
Hi nixcraft,

Thanks for your help.
I set the INPUT AND OUTPUT to DROP.
Could you kindly to let me know which port needs to make ACCEPT for the web browser? 80 only?

or can you let me know what is your iptables setting for my reference. (because i still have a problem).

Thanks!
 
Old 08-30-2005, 07:51 AM   #7
fllabron
LQ Newbie
 
Registered: Jan 2005
Posts: 4

Rep: Reputation: 0
I always had a doubt: if without rules in the iptables,the httpd works correctly,why add rules? the iptables block all the other doors but the 80 ?
 
Old 08-30-2005, 01:20 PM   #8
nixcraft
Member
 
Registered: Nov 2004
Location: BIOS
Distribution: RHEL3.0, FreeBSD 5.x, Debian 3.x, Soaris x86 v10
Posts: 379

Rep: Reputation: 30
Yup, port 80, 443 (if httpd-ssl) and then outgoing DNS are minimum
 
  


Reply



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 problem , please help John Micheal Linux - Security 4 05-22-2004 03:01 AM
Iptables problem,help me please. ryanux Linux - Security 1 05-21-2004 09:59 PM
iptables problem fleshwound Linux - Networking 6 12-27-2003 05:30 PM
iptables - where is my problem cristi1979 Linux - Networking 9 07-14-2003 02:46 PM
iptables problem? poulaum Linux - Networking 12 02-27-2003 03:57 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Security

All times are GMT -5. The time now is 11:28 PM.

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