Networking 101 - unable to connect to localhost

Issues related to configuring your network
kphill
Posts: 14
Joined: 2006/12/11 23:17:00

Networking 101 - unable to connect to localhost

Post by kphill » 2007/01/18 19:28:30

I know I'm going to feel foolish when I read the answers to this question but I'm drawing a blank and need help. I'm using Centos 4.4 and run both Web and e-mail servers. The computer has two NICs; one goes out to the Internet; the other goes to my LAN. Things had been working smoothly (mostly) until the other day when I moved the computer from one location to another (I recently rented office space and got DSL connection to it). The IP Address at the new location is different from the previous location. I went into the DNS files and changed to the new IP Address. I changed the "Listen on" line in the httpd.conf file to the new IP Address. Now both the Web server and e-mail servers are not getting out. (Actually, I can send e-mail *out* but cannot receive it.) When I type http://localhost/ in the browser I get a message that it is unable to connect. When I try to telnet to the server from a command prompt it is showing that it is trying to connect to the *old* IP Address. Obviously I am overlooking something. I don't do this often enough to remember where to look and what to do. Doing ifconfig shows that the loopback device is working. Both NICs (eth0 and eth1) appear to be working properly. By the way, the Internet gets to *me* on the computer just fine; I/my server just can't get out to it. Thanks for any help.

Kevin

foxb
Posts: 1927
Joined: 2006/04/20 19:03:33
Location: Montreal/QC

Re: Networking 101 - unable to connect to localhost

Post by foxb » 2007/01/18 20:08:56

Firewall?

/etc/hosts?

yyagol
Posts: 1015
Joined: 2006/06/10 18:27:44
Location: 32 4′N 34 47′E
Contact:

Re: Networking 101 - unable to connect to localhost

Post by yyagol » 2007/01/18 20:17:20

Can you post some details like :

[code]
ifconfig
route -n
iptables -L
cat /etc/sysconfig/network-scripts/ifcfg-eth0
ping 127.0.0.1
echo -e "bla\nbla" | nc 127.0.0.1 80
echo -e "helo bla\nquit" | nc 127.0.0.1 25
[/code]

for a start

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/18 20:36:24

The explicit "listen on" will make it ONLY listen on that interface. You have *atleast* disabled httpd on localhost...

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

Re: Networking 101 - unable to connect to localhost

Post by kphill » 2007/01/18 21:07:34

Firewall is enabled; the trusted services are WWW, SMTP, FTP, SSH; trusted devices are eth0, eth1, eth2; other prots are 1029:tcp, 443:tcp, 110:tcp&udp. /etc/hosts has localhost.localdomain at 127.0.0.1.
ifconfig:
ifconfig
eth0 Link encap:Ethernet HWaddr 00:E0:81:2E:76:96
inet addr:71.113.222.213 Bcast:71.113.222.255 Mask:255.255.255.0
inet6 addr: fe80::2e0:81ff:fe2e:7696/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:11535 errors:0 dropped:0 overruns:0 frame:0
TX packets:9874 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:10209090 (9.7 MiB) TX bytes:2175607 (2.0 MiB)
Interrupt:193

eth1 Link encap:Ethernet HWaddr 00:E0:81:2E:76:97
inet addr:10.0.0.1 Bcast:10.255.255.255 Mask:255.0.0.0
inet6 addr: fe80::2e0:81ff:fe2e:7697/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:9140 errors:0 dropped:0 overruns:0 frame:0
TX packets:10746 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:2068804 (1.9 MiB) TX bytes:9944462 (9.4 MiB)
Interrupt:201

lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:2586 errors:0 dropped:0 overruns:0 frame:0
TX packets:2586 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:3572297 (3.4 MiB) TX bytes:3572297 (3.4 MiB)

route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
71.113.222.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
169.254.0.0 0.0.0.0 255.255.0.0 U 0 0 0 eth1
10.0.0.0 0.0.0.0 255.0.0.0 U 0 0 0 eth1
0.0.0.0 71.113.222.1 0.0.0.0 UG 0 0 0 eth0

(I have never figured out why 169.254.0.0 is there; I cannot delete it)
cat /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0
BOOTPROTO=none
BROADCAST=71.113.222.255
HWADDR=00:E0:81:2E:76:96
IPADDR=71.113.222.213
NETMASK=255.255.255.0
NETWORK=71.113.222.0
ONBOOT=yes
TYPE=Ethernet
GATEWAY=71.113.222.1
USERCTL=no
IPV6INIT=no
PEERDNS=yes

I am able to ping 127.0.0.1 just fine without packet loss.

echo -e "bla\nbla" | nc 127.0.0.1 80 doesn't return any information.

echo -e "helo bla\nquit" | nc 127.0.0.1 25
220 mail.9-5usa.org ESMTP Sendmail 8.13.1/8.13.1; Thu, 18 Jan 2007 15:04:14 -0600
250 mail.9-5usa.org Hello localhost.localdomain [127.0.0.1], pleased to meet you221 2.0.0 mail.9-5usa.org closing connection

Please let me know if you need additional information. Thanks!

Kevin

Lenard
Posts: 2283
Joined: 2005/11/29 02:35:25
Location: Indiana

Re: Networking 101 - unable to connect to localhost

Post by Lenard » 2007/01/18 21:51:28

A fews things;

Since your not using IP6 turn it off:

/etc/modprobe.conf additional line entry; alias net-pf-10 off

/etc/sysconfig/network example file;

NETWORKING=yes
NETWORKING_IPV6=no
NOZEROCONF=yes ;(no more 196.254.0.0)

Since you have a new office with a new DSL service are they perhaps blocking you???? Many ISP now block such things now, you might want to check with them.

Also review your /etc/resolv.conf file, you might want to make some changes or delete it.

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

Re: Networking 101 - unable to connect to localhost

Post by kphill » 2007/01/18 22:34:56

OK, I made those changes as suggested. When I restarted the network I got this message: /etc/sysconfig/network: line 4: no: command not found

One question: should the Address after "no more" be the IP Address of the DSL or my LAN?

I called my ISP and they say they are not blocking anything on the new IP Address. (The IP Address that is showing up in the ifconfig results is the "new" one. I think I mentioned that when I telnet www.myserver.com 80 it returns that it is trying 66.12.13.186 which was my "old" IP Address). I don't know where I have not replaced the old address.

Kevin

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 02:50:26

Make sure you have corrected the "/etc/hosts" file and if *you* are running any other service like DNS (bind) or NIS (ypserv). If you have some outside group providing your external DNS, you will need to work with them (maybe whomever you registered your domain).

Just to verify that http is listening how you expect, run "netstat -tnp| grep http". This will show you what IP addresses http is listening on (if any). Then run almost the same command of "netstat -tp|grep http". This will show the *name* that the http is listening on.

billwest
Posts: 153
Joined: 2006/11/19 10:50:31
Location: Perth, Western Australia

Re: Networking 101 - unable to connect to localhost

Post by billwest » 2007/01/19 11:07:44

Can you ping 127.0.0.1 ?

Can you ping localhost ?



Check that /etc/hosts contains:

127.0.0.1 localhost.localdomain localhost



Bill.

Lenard
Posts: 2283
Joined: 2005/11/29 02:35:25
Location: Indiana

Re: Networking 101 - unable to connect to localhost

Post by Lenard » 2007/01/19 11:07:49

The example file for /etc/sysconfig/network is

NETWORKING=yes
NETWORKING_IPV6=no
NOZEROCONF=yes

The " ;(no more 196.254.0.0)" part was a comment be me informing that you should no longer see the zeroconf IP address in the route command you used. Sorry for any misunderstanding.

Post Reply

Return to “CentOS 4 - Networking Support”