Solved

CentOS Open a Port

Posted on 2012-03-20
5
345 Views
Last Modified: 2012-03-21
I am trying to open port 80 & 443 to everyone.  My et/sysconfig/iptables looks like:

# Generated by iptables-save v1.3.5 on Tue Mar 20 19:14:47 2012
*filter
:INPUT ACCEPT [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [133643:8702644]
:RH-Firewall-1-INPUT - [0:0]
-A INPUT -j RH-Firewall-1-INPUT
-A FORWARD -j RH-Firewall-1-INPUT
-A RH-Firewall-1-INPUT -p tcp -m tcp --dport 5901 -j ACCEPT
-A RH-Firewall-1-INPUT -i lo -j ACCEPT
-A RH-Firewall-1-INPUT -p icmp -m icmp --icmp-type any -j ACCEPT
-A RH-Firewall-1-INPUT -p esp -j ACCEPT
-A RH-Firewall-1-INPUT -p ah -j ACCEPT
-A RH-Firewall-1-INPUT -d 224.0.0.251 -p udp -m udp --dport 5353 -j ACCEPT
-A RH-Firewall-1-INPUT -p udp -m udp --dport 631 -j ACCEPT
-A RH-Firewall-1-INPUT -p tcp -m tcp --dport 631 -j ACCEPT
-A RH-Firewall-1-INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
-A RH-Firewall-1-INPUT -p tcp -m state --state NEW -m tcp --dport 22 -j ACCEPT
-A RH-Firewall-1-INPUT -p tcp -m tcp --dport 80 -j ACCEPT
-A RH-Firewall-1-INPUT -p tcp -m tcp --dport 443 -j ACCEPT
-A RH-Firewall-1-INPUT -j REJECT --reject-with icmp-host-prohibited
COMMIT
# Completed on Tue Mar 20 19:14:47 2012
"/etc/sysconfig/iptables" 23L, 1071C


When i test the ports with a port query tool it tells me they are not open.  What did i miss?
0
Comment
Question by:deklinm
5 Comments
 
LVL 21

Accepted Solution

by:
Papertrip earned 500 total points
Comment Utility
Are you sure Apache is running when you run the port scan?

Do you have anything in /etc/hosts.allow or /etc/hosts.deny ?
0
 

Author Comment

by:deklinm
Comment Utility
/etc/hosts.allow or /etc/hosts.deny are both empty

Apache is not running
0
 
LVL 21

Expert Comment

by:Papertrip
Comment Utility
Start up Apache and run the port scan again.
0
 
LVL 5

Expert Comment

by:1ly4me
Comment Utility
What about IPTables and Firewall? Are they running?
0
 
LVL 4

Expert Comment

by:JZeolla
Comment Utility
Your syntax seems correct.  

First make sure you start up whatever is going to be connecting to port 80.  Then verify that the system is listening on port 80 using:
netstat --listen -an | awk '/LISTEN/ && /:80 / && /tcp/'

Now run your port scan.  Since it's a tcp port scan, it requires a response to be considered 'up' and therefore it needs to have traffic allowed in addition to a listening service on that server's port 80.
0

Featured Post

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

In this tutorial I will explain how to make squid prevent malwares in five easy steps: Squid is a caching proxy for the Web supporting HTTP, HTTPS, FTP, and more. It reduces bandwidth and improves response times by caching and reusing frequently-…
How many times have you wanted to quickly do the same thing to a list but found yourself typing it again and again? I first figured out a small time saver with the up arrow to recall the last command but that can only get you so far if you have a bi…
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…

728 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now