Networking 101 - unable to connect to localhost

Issues related to configuring your network
pjwelsh
Posts: 2629
Joined: 2007/01/07 02:18:02
Location: Central IL USA

Re: Networking 101 - unable to connect to localhost

Post by pjwelsh » 2007/01/19 18:32:48

Now I'm *REALY* confusedish... The netstat command with the "t" option gives TCP ports of the program "p" running. Just to make sure that something wierd with netstat is going on, run:
[quote]netstat -tnp[/quote]
This should produce a few lines of programs running on TCP ports. If that works, then httpd is *NOT* listening on network ports and the access_log is giving sprurious info.
You could also take a more broad approach with netstat and look for all "a" via:
[quote]netstat -anp|grep httpd[/quote]
(now that I think about it, I have had the "-t" option not 100% work -- like with "netstat -tnp|grep sshd" not giving sshd)
Please do something like:
[quote]tail -30 /var/log/httpd/error_log[/quote]
I don't know how many other httpd.conf or conf.d/* file changes you have made, but I would look to go back to some basic install version of those and start over...

kphill
Posts: 14
Joined: 2006/12/11 23:17:00

Re: Networking 101 - unable to connect to localhost

Post by kphill » 2007/01/19 19:44:03

[quote]
pjwelsh wrote:
[snip], run:
[quote]netstat -tnp[/quote]
[snip]
You could also take a more broad approach with netstat and look for all "a" via:
[quote]netstat -anp|grep httpd[/quote]
(now that I think about it, I have had the "-t" option not 100% work -- like with "netstat -tnp|grep sshd" not giving sshd)
Please do something like:
[quote]tail -30 /var/log/httpd/error_log[/quote]
I don't know how many other httpd.conf or conf.d/* file changes you have made, but I would look to go back to some basic install version of those and start over...[/quote]

[root@mail ~]# netstat -tnp
Active Internet connections (w/o servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 71.113.222.213:32865 72.14.211.99:80 ESTABLISHED 6369/firefox-bin
tcp 0 0 71.113.222.213:445 71.113.131.37:2239 ESTABLISHED 6045/smbd

[root@mail ~]# netstat -anp|grep httpd
tcp 0 0 71.113.222.213:80 0.0.0.0:* LISTEN 5152/httpd
tcp 0 0 0.0.0.0:443 0.0.0.0:* LISTEN 5152/httpd

[root@mail ~]# tail -30 /var/log/httpd/error_log
[Thu Jan 18 13:34:47 2007] [notice] Apache/2.0.52 (CentOS) configured -- resuming normal operations
[Thu Jan 18 18:01:52 2007] [notice] caught SIGTERM, shutting down
[Fri Jan 19 08:05:34 2007] [notice] core dump file size limit raised to 18446744073709551615 bytes
[Fri Jan 19 08:05:35 2007] [notice] suEXEC mechanism enabled (wrapper: /usr/sbin/suexec)
[Fri Jan 19 08:05:35 2007] [notice] Digest: generating secret for digest authentication ...
[Fri Jan 19 08:05:35 2007] [notice] Digest: done
[Fri Jan 19 08:05:35 2007] [notice] LDAP: Built with OpenLDAP LDAP SDK
[Fri Jan 19 08:05:35 2007] [notice] LDAP: SSL support unavailable
[Fri Jan 19 08:05:37 2007] [notice] mod_python: Creating 4 session mutexes based on 150 max processes and 0 max threads.
[Fri Jan 19 08:05:37 2007] [notice] Apache/2.0.52 (CentOS) configured -- resuming normal operations
[Fri Jan 19 09:44:44 2007] [notice] caught SIGTERM, shutting down
[Fri Jan 19 09:49:55 2007] [notice] core dump file size limit raised to 18446744073709551615 bytes
[Fri Jan 19 09:49:56 2007] [notice] suEXEC mechanism enabled (wrapper: /usr/sbin/suexec)
[Fri Jan 19 09:49:56 2007] [notice] Digest: generating secret for digest authentication ...
[Fri Jan 19 09:49:56 2007] [notice] Digest: done
[Fri Jan 19 09:49:56 2007] [notice] LDAP: Built with OpenLDAP LDAP SDK
[Fri Jan 19 09:49:56 2007] [notice] LDAP: SSL support unavailable
[Fri Jan 19 09:49:58 2007] [notice] mod_python: Creating 4 session mutexes based on 150 max processes and 0 max threads.
[Fri Jan 19 09:49:58 2007] [notice] Apache/2.0.52 (CentOS) configured -- resuming normal operations
[Fri Jan 19 11:19:44 2007] [notice] caught SIGTERM, shutting down
[Fri Jan 19 11:19:45 2007] [notice] core dump file size limit raised to 18446744073709551615 bytes
[Fri Jan 19 11:19:46 2007] [notice] suEXEC mechanism enabled (wrapper: /usr/sbin/suexec)
[Fri Jan 19 11:19:46 2007] [notice] Digest: generating secret for digest authentication ...
[Fri Jan 19 11:19:46 2007] [notice] Digest: done
[Fri Jan 19 11:19:46 2007] [notice] LDAP: Built with OpenLDAP LDAP SDK
[Fri Jan 19 11:19:46 2007] [notice] LDAP: SSL support unavailable
[Fri Jan 19 11:19:47 2007] [notice] mod_python: Creating 4 session mutexes based on 150 max processes and 0 max threads.
[Fri Jan 19 11:19:47 2007] [notice] Apache/2.0.52 (CentOS) configured -- resuming normal operations
[Fri Jan 19 12:48:27 2007] [error] [client 74.6.74.226] File does not exist: /var/www/html/robots.txt
[Fri Jan 19 13:04:21 2007] [error] [client 68.192.73.36] Directory index forbidden by rule: /var/www/html/, referer: http://www.filmshooting.com/scripts/forum/viewtopic.php?t=15929&postdays=0&postorder=asc&start=0

kphill
Posts: 14
Joined: 2006/12/11 23:17:00

Re: Networking 101 - unable to connect to localhost

Post by kphill » 2007/01/19 19:47:13

[quote]
pjwelsh wrote:
[much snipping]
I don't know how many other httpd.conf or conf.d/* file changes you have made, but I would look to go back to some basic install version of those and start over...[/quote]

I don't think I made any changes other than the Listen On address line. Perhaps I did something inadvertently. I forgot to ask what would be the best way to go about installing a basic version?

pjwelsh
Posts: 2629
Joined: 2007/01/07 02:18:02
Location: Central IL USA

Re: Networking 101 - unable to connect to localhost

Post by pjwelsh » 2007/01/19 20:20:33

From the netstat -anp, you will notice the line "71.113.222.213:80". This is letting you know that httpd is *ONLY* listening on IP address of 71.113.222.213 port 80. For IPV4 "all" interfaces you get something like "0.0.0.0:80" or for IPV6 something like ":::80" for httpd. You will not be able to connect to "localhost" in this configuration.

If the "listen" is the only change, just comment that out and restart httpd. The default is to listen on "all" interfaces.

kphill
Posts: 14
Joined: 2006/12/11 23:17:00

Re: Networking 101 - unable to connect to localhost

Post by kphill » 2007/01/19 20:57:30

[quote]
pjwelsh wrote:
From the netstat -anp, you will notice the line "71.113.222.213:80". This is letting you know that httpd is *ONLY* listening on IP address of 71.113.222.213 port 80. For IPV4 "all" interfaces you get something like "0.0.0.0:80" or for IPV6 something like ":::80" for httpd. You will not be able to connect to "localhost" in this configuration.

If the "listen" is the only change, just comment that out and restart httpd. The default is to listen on "all" interfaces.[/quote]


OK, I changed the "Listen" directive to "0.0.0.0:80" and now I can connect to localhost and get the Apache test page. Also, here's the return from netstat -anp:
[root@mail ~]# netstat -anp|grep httpd
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 6962/httpd
tcp 0 0 0.0.0.0:443 0.0.0.0:* LISTEN 6962/httpd

pjwelsh
Posts: 2629
Joined: 2007/01/07 02:18:02
Location: Central IL USA

Re: Networking 101 - unable to connect to localhost

Post by pjwelsh » 2007/01/19 21:02:05

AHHHHHH done... :-D

Post Reply

Return to “CentOS 4 - Networking Support”