# [solved] How can I open port 80? Newbie Iptables problem...

## marcion

I have a little network:

A. Server/Router with Hardened Gentoo (Selinux etc) no X server, on 24/7

B. Desktop, (turned off when not in use)

-A has cable modem plugged in, this gives internet access to B - this bit works fine.

-I have installed Apache on A, and need to open port 80 which is being blocked by IPtables (when I stop IPtables, the website works).

IP tables on router was setup according to: 

http://www.gentoo.org/doc/en/home-router-howto.xml#doc_chap5_sect3

I have been googling for two hours for a rule to cut and paste but they all didn't work (perhaps because I am not synthesizing the examples enough with the above router guide). What is the command I need to allow people outside to access Apache?Last edited by marcion on Mon Dec 12, 2005 1:46 pm; edited 1 time in total

----------

## aaronamd

iptables -A INPUT -p TCP --dport 80 -i [interface] -j ACCEPT

put the external interface ( the one that is connected to the net) where the word interface is, and remove the brackets around it and you should be set to serve!   :Very Happy: 

and don't forget to save the table state so it'll come back up when you reboot

to do that do:

/etc/init.d/iptables save

good luck

----------

## marcion

 *aaronamd wrote:*   

> iptables -A INPUT -p TCP --dport 80 -i [interface] -j ACCEPT

 

Does not seem to work   :Sad:   - is this conflicting with one of the other IPtables rules?

 *Quote:*   

> 
> 
> First we flush our current rules
> 
> # iptables -F
> ...

 

----------

## MrUlterior

Your port 80 rule must appear before:

```
# iptables -A INPUT -p TCP -i ! ${LAN} -d 0/0 --dport 0:1023 -j DROP

# iptables -A INPUT -p UDP -i ! ${LAN} -d 0/0 --dport 0:1023 -j DROP 
```

----------

## marcion

Thanks everyone - it works now !

----------

