[SOLVED] Unable to Connect to Apache on local network

General support questions

[SOLVED] Unable to Connect to Apache on local network

Postby atrumblood » 2013/06/01 22:14:11

Hello all,

I have just setup Centos 6.4 and when I try to access apache from another computer on my network I get Unable to connect.
I am able to connect from the localhost on my server.

I have port 80 forwarded to my server on my router.

Just to confirm that it is not my router messing with me I setup a web server on my windows machine and I am able to connect to it from my centos server with no issues. This leads me to believe I have something setup wrong on my server.


Some info from my server.

# uname -a
Linux curtisdorris.com 2.6.32-358.el6.x86_64 #1 SMP Fri Feb 22 00:31:26 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux

# netstat -an | grep LIST | grep 80
tcp 0 0 :::80 :::* LISTEN

# lspci | egrep -i 'network|ethernet'
00:14.0 Bridge: NVIDIA Corporation MCP51 Ethernet Controller (rev a3)

# cat /etc/httpd/conf/httpd.conf | grep Listen
Listen 80


Any assistance would be appreciated. If any more information is needed please ask me and I will provide it.
Thanks,
Atrum
atrumblood
 
Posts: 39
Joined: 2010/04/11 17:49:13

[SOLVED] Unable to Connect to Apache on local network

Postby TrevorH » 2013/06/01 22:53:06

Run `iptables-save` and look to see if there is a rule there, if not then add one modeled after the existing port 22 one.
User avatar
TrevorH
Forum Moderator
 
Posts: 12757
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: Unable to Connect to Apache on local network

Postby atrumblood » 2013/06/02 20:17:44

Ok,

So I have been trying to figure out how to insert a rule after the port 22 rule that you mentioned.

I believe I have it added given the output of iptables-save
Code: Select all
# iptables-save
# Generated by iptables-save v1.4.7 on Sun Aug 17 03:52:29 2008
*filter
:INPUT ACCEPT [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [36:4721]
-A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
-A INPUT -p icmp -j ACCEPT
-A INPUT -i lo -j ACCEPT
-A INPUT -p tcp -m state --state NEW -m tcp --dport 80 -j ACCEPT
-A INPUT -p tcp -m state --state NEW -m tcp --dport 22 -j ACCEPT
-A INPUT -j REJECT --reject-with icmp-host-prohibited
-A FORWARD -j REJECT --reject-with icmp-host-prohibited
COMMIT
# Completed on Sun Aug 17 03:52:29 2008
 


However after restarting iptables I am still unable to connect on port 80.

Also just for kicks I turned off iptables and tried to connect and bam! went straight through to my hello world page.

Am I missing something else here?
atrumblood
 
Posts: 39
Joined: 2010/04/11 17:49:13

Re: Unable to Connect to Apache on local network

Postby TrevorH » 2013/06/02 20:25:57

If you add the rule then it's active already. Then you need to run `service iptables save`. If you don't then next time you restart iptables it will load up the old rules from /etc/sysconfig/iptables and be missing your newly added rules.
User avatar
TrevorH
Forum Moderator
 
Posts: 12757
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: Unable to Connect to Apache on local network

Postby atrumblood » 2013/06/02 20:36:30

So are the commands "iptables-save" and "service iptables save" different?
atrumblood
 
Posts: 39
Joined: 2010/04/11 17:49:13

Re: Unable to Connect to Apache on local network

Postby TrevorH » 2013/06/02 20:44:51

Yes. Running `service iptables stop|start|save|restart` tells the iptables service to do whatever action you told it. Running `iptables-save` is a command that spits out the current rules to stdout (or wherever you have redirected stdout) - it doesn't save the iptables rules, just prints them in the same format that `iptables-restore` uses to restore them.
User avatar
TrevorH
Forum Moderator
 
Posts: 12757
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: [SOLVED] Unable to Connect to Apache on local network

Postby atrumblood » 2013/06/02 20:54:30

Thanks for the help TrevorH, got it all working now.
atrumblood
 
Posts: 39
Joined: 2010/04/11 17:49:13


Return to CentOS 6 - General Support

Who is online

Users browsing this forum: No registered users and 4 guests