- The connection was refused when attempting to contact the localhost

PDA

View Full Version : The connection was refused when attempting to contact the localhost


Rob
07-24-2004, 09:53 PM
I cannot connect to my localhost.
I tried localhost, localhost:80 and localhost:8080.
My httpd.conf file is listen 192.1768.1.100:8080 which is the location
of my linux server on a lan with two computers connected by a
linksys 4 port befsr41 router v3
using a static ip
FTP 21 192.168.1.
Telnet 23 192.168.1.
SMTP 25 192.168.1.
DNS 53 192.168.1.
TFTP 69 192.168.1.
finger 79 192.168.1.
HTTP 80 192.168.1.100 enabled
POP3 110 192.168.1.
NNTP 119 192.168.1.
SNMP 161 192.168.1.
http 8080 192.168.1.100 enabled
enabled local DHCP Server
mtu disable
administrator works on port 8081.
My ISP blocks port 80.

My localhost was working yesterday.
I followed instructions to install mysql, php and apache from
http://www.nitecon.com/downloads/rh9tut.htm

Could a change in IP address cause the problem?
My hosts in etc/ folder has the following entry.

127.0.0.1 localhost.localdomain localhost

These commands were done from my web server which never worked.
iptables -L
Chain INPUT (policy ACCEPT)
target prot opt source destination
RH-Lokkit-0-50-INPUT all -- anywhere anywhere

Chain FORWARD (policy ACCEPT)
target prot opt source destination
RH-Lokkit-0-50-INPUT all -- anywhere anywhere

Chain OUTPUT (policy ACCEPT)
target prot opt source destination

Chain RH-Lokkit-0-50-INPUT (2 references)
target prot opt source destination
ACCEPT tcp -- myhostname myhostname tcp
dpt:http flags:S
YN,RST,ACK/SYN
ACCEPT tcp -- myhostname myhostname tcp
dpt:ftp flags:SY
N,RST,ACK/SYN
ACCEPT tcp -- myhostname myhostname tcp
dpt:ssh flags:SY
N,RST,ACK/SYN
ACCEPT tcp -- myhostname myhostname tcp
dpt:telnet flags
:SYN,RST,ACK/SYN
ACCEPT udp -- myhostname myhostname udp
spts:bootps:boot
pc dpts:bootps:bootpc
ACCEPT udp -- myhostname myhostname udp
spts:bootps:boot
pc dpts:bootps:bootpc
ACCEPT all -- myhostname myhostname
REJECT tcp -- myhostname myhostname tcp
dpts:0:1023 flag
s:SYN,RST,ACK/SYN reject-with icmp-port-unreachable
REJECT tcp -- myhostname myhostname tcp
dpt:nfs flags:SY
N,RST,ACK/SYN reject-with icmp-port-unreachable
REJECT udp -- myhostname myhostname udp
dpts:0:1023 reje
ct-with icmp-port-unreachable
REJECT udp -- myhostname myhostname udp
dpt:nfs reject-w
ith icmp-port-unreachable
REJECT tcp -- myhostname myhostname tcp
dpts:x11:6009 fl
ags:SYN,RST,ACK/SYN reject-with icmp-port-unreachable
REJECT tcp -- myhostname myhostname tcp
dpt:xfs flags:SY
N,RST,ACK/SYN reject-with icmp-port-unreachable







ifconfig
eth0 Link encap:Ethernet HWaddr 00:04:5A:54:CB:84
inet addr:192.168.1.100 Bcast:192.168.1.255
Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:293 errors:0 dropped:0 overruns:0 frame:0
TX packets:207 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:100
RX bytes:260029 (253.9 Kb) TX bytes:33695 (32.9 Kb)
Interrupt:5 Base address:0x8000

lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:14737 errors:0 dropped:0 overruns:0 frame:0
TX packets:14737 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:824461 (805.1 Kb) TX bytes:824461 (805.1 Kb)

[root@localhost root]# /etc/rc.d/init.d/httpd stop
Stopping httpd: [ OK ]
[root@localhost root]# /etc/rc.d/init.d/httpd start
Starting httpd: [ OK ]




nmap 192.168.1.100

Starting nmap V. 3.00 ( www.insecure.org/nmap/ )
Interesting ports on (192.168.1.100):
(The 1595 ports scanned but not shown below are in state: closed)
Port State Service
21/tcp open ftp
22/tcp open ssh
111/tcp open sunrpc
443/tcp open https
6000/tcp open X11
8080/tcp open http-proxy

Nmap run completed -- 1 IP address (1 host up) scanned in 3 seconds

Paul Lutus
07-24-2004, 09:53 PM
Rob wrote:

> I cannot connect to my localhost.
> I tried localhost, localhost:80 and localhost:8080.
> My httpd.conf file is listen 192.1768.1.100:8080

It is, really? Is your configuration file typing on a par with your Usenet
typing?

ALWAYS COPY the EXACT contents of your configuration files to your post.

NEVER try to SUMMARIZE the contents by typing them in from memory.

Taken at face value, your entry:

> My httpd.conf file is listen 192.1768.1.100:8080

IS THE PROBLEM.

--
Paul Lutus
http://www.arachnoid.com

David Efflandt
07-24-2004, 09:53 PM
On 8 Oct 2003 10:53:39 -0700, Rob <robert3c@mail.klur.com> wrote:
> I cannot connect to my localhost.
> I tried localhost, localhost:80 and localhost:8080.
> My httpd.conf file is listen 192.1768.1.100:8080

Curious why you expect a server listening ONLY on 192.168.1.100:8080 to
answer a query to localhost (127.0.0.1) or port 80? Perhaps you should
change that to Listen 8080, so it will listen to that port for any IP on
your box (including localhost).

--
David Efflandt - All spam ignored http://www.de-srv.com/

Rob
07-24-2004, 09:53 PM
efflandt@xnet.com (David Efflandt) wrote in message news:<slrnbo9j26.52n.efflandt@typhoon.xnet.com>...
> On 8 Oct 2003 10:53:39 -0700, Rob <robert3c@mail.klur.com> wrote:
> > I cannot connect to my localhost.
> > I tried localhost, localhost:80 and localhost:8080.
> > My httpd.conf file is listen 192.1768.1.100:8080
>
> Curious why you expect a server listening ONLY on 192.168.1.100:8080 to
> answer a query to localhost (127.0.0.1) or port 80? Perhaps you should
> change that to Listen 8080, so it will listen to that port for any IP on
> your box (including localhost).

Thank you David and Paul for your expertise on this problem.

Here is a copy of my edited httpd.conf file. I s
#
# Listen: Allows you to bind Apache to specific IP addresses and/or
# ports, in addition to the default. See also the <VirtualHost>
# directive.
#
# Change this to Listen on specific IP addresses as shown below to
# prevent Apache from glomming onto all bound IP addresses (0.0.0.0)
#
#Listen 12.34.56.78:80
Listen 8080

#
# Load config files from the config directory "/etc/httpd/conf.d".
#
Include conf.d/*.conf
I could not access my localhost with listen 8080 but when I changed it
to 80 I could access it.
People outside my lan cannot access my ip address with my apache
started.
Not sure if I changed my http.conf to listen 8080 if this would help?
Seems to be related to my linksys router I guess. Here are the specs.

Routing Table Entry
Dest Lan IP Subnet Mask def Gateway Hopcount Internet
0.0.0.0 0.0.0.0 66.130.104.1 1 Internet
66.130.104.0 255.255.255.0 0.0.0.0 1 Internet
192.168.1.0 255.255.255.0 0.0.0.0 1 Local
local dhcp server enabled
DDNS disabled
UPnP enabled
PPPoE Passthrough Disabled
IPSec Passthrough Disabled
DMZ Disabled
Admin Port 8081

If you find anything wrong with this setup that would interfere with
putting my live please let me know.
Thanks,
Rob

David Efflandt
07-24-2004, 09:54 PM
On 9 Oct 2003 07:45:22 -0700, Rob <robert3c@mail.klur.com> wrote:
> efflandt@xnet.com (David Efflandt) wrote in message news:<slrnbo9j26.52n.efflandt@typhoon.xnet.com>...
>> On 8 Oct 2003 10:53:39 -0700, Rob <robert3c@mail.klur.com> wrote:
>> > I cannot connect to my localhost.
>> > I tried localhost, localhost:80 and localhost:8080.
>> > My httpd.conf file is listen 192.1768.1.100:8080
>>
>> Curious why you expect a server listening ONLY on 192.168.1.100:8080 to
>> answer a query to localhost (127.0.0.1) or port 80? Perhaps you should
>> change that to Listen 8080, so it will listen to that port for any IP on
>> your box (including localhost).
>
> Thank you David and Paul for your expertise on this problem.
>
> Here is a copy of my edited httpd.conf file. I s
> #
> # Listen: Allows you to bind Apache to specific IP addresses and/or
> # ports, in addition to the default. See also the <VirtualHost>
> # directive.
> #
> # Change this to Listen on specific IP addresses as shown below to
> # prevent Apache from glomming onto all bound IP addresses (0.0.0.0)
> #
> #Listen 12.34.56.78:80
> Listen 8080
>
> #
> # Load config files from the config directory "/etc/httpd/conf.d".
> #
> Include conf.d/*.conf
> I could not access my localhost with listen 8080 but when I changed it
> to 80 I could access it.
> People outside my lan cannot access my ip address with my apache
> started.
> Not sure if I changed my http.conf to listen 8080 if this would help?
> Seems to be related to my linksys router I guess. Here are the specs.

I assume you forwarded port 8080 on the Linksys to Linux IP.
Does 'netstat -atn' on Linux show anything listening on 0.0.0.0:8080?
Do apache logs give any clue of attempting connection when it is set to
Listen 8080 and someone attempts to connect to your URL with that port?

--
David Efflandt - All spam ignored http://www.de-srv.com/

Rob
07-24-2004, 09:56 PM
efflandt@xnet.com (David Efflandt) wrote in message news:<slrnboc2on.4oh.efflandt@typhoon.xnet.com>...
> On 9 Oct 2003 07:45:22 -0700, Rob <robert3c@mail.klur.com> wrote:
> > efflandt@xnet.com (David Efflandt) wrote in message news:<slrnbo9j26.52n.efflandt@typhoon.xnet.com>...
> >> On 8 Oct 2003 10:53:39 -0700, Rob <robert3c@mail.klur.com> wrote:
> >> > I cannot connect to my localhost.
> >> > I tried localhost, localhost:80 and localhost:8080.
> >> > My httpd.conf file is listen 192.1768.1.100:8080
> >>
> >> Curious why you expect a server listening ONLY on 192.168.1.100:8080 to
> >> answer a query to localhost (127.0.0.1) or port 80? Perhaps you should
> >> change that to Listen 8080, so it will listen to that port for any IP on
> >> your box (including localhost).
> >
> > Thank you David and Paul for your expertise on this problem.
> >
> > Here is a copy of my edited httpd.conf file. I s
> > #
> > # Listen: Allows you to bind Apache to specific IP addresses and/or
> > # ports, in addition to the default. See also the <VirtualHost>
> > # directive.
> > #
> > # Change this to Listen on specific IP addresses as shown below to
> > # prevent Apache from glomming onto all bound IP addresses (0.0.0.0)
> > #
> > #Listen 12.34.56.78:80
> > Listen 8080
> >
> > #
> > # Load config files from the config directory "/etc/httpd/conf.d".
> > #
> > Include conf.d/*.conf
> > I could not access my localhost with listen 8080 but when I changed it
> > to 80 I could access it.
> > People outside my lan cannot access my ip address with my apache
> > started.
> > Not sure if I changed my http.conf to listen 8080 if this would help?
> > Seems to be related to my linksys router I guess. Here are the specs.
>
> I assume you forwarded port 8080 on the Linksys to Linux IP.
> Does 'netstat -atn' on Linux show anything listening on 0.0.0.0:8080?
> Do apache logs give any clue of attempting connection when it is set to
> Listen 8080 and someone attempts to connect to your URL with that port?

Thanks for your help Dave. When I tried netstat -atn it didn't seem to
be listening to any particular site like some other ports seemed to be
listening. I tried to reboot my computer without the router and it
said as I logged in

"Could not look up internet for x1-6...-84
This will prevent GNOME from operating correctly.It may be possible to
correct this problem by adding x1-6...-84 to the file /etc/hosts."

I selected Login anyway and my Apache wouldn't start. I added the
value to the hosts file and Apache worked. I reconnected the computer
to the router and it worked as well. I still have no idea why this
worked.
Next step is to see how much security I have on my server.
Thanks again,
Rob