[CentOS] Could not connect to host box.domain.tld

Thu Jan 24 16:11:46 UTC 2008
Craig White <craig at tobyhouse.com>

On Thu, 2008-01-24 at 15:24 +0000, Anne Wilson wrote:
> On Thursday 24 Jan 2008, Alain Spineux wrote:
> > On Jan 24, 2008 12:53 PM, Anne Wilson <cannewilson at googlemail.com> wrote:
> > > I have used fetchmail/procmail/postfix/dovecot/kmail for some time on my
> > > mail server, and have set this up on three or four machines in the past. 
> > > I'm now setting up a new server and having problems.  I've reached the
> > > thinking-in-circles stage, so need a prompt.
> > >
> > > The box in question is called borg2.lydgate.lan, and resides at
> > > 192.168.0.40. I can ping both borg2.lydgate.lan and 192.168.0.40, yet
> > > kmail tells me that it cannot connect to it, either by name or ip. 
> > > /etc/hosts has correct lines for the box.  It has to be something pretty
> > > basic, but I can't think what, unless it is either an selinux problem or
> > > ipv6 problem.  I know that in FC6 I turned ipv6 off (I'd have to search
> > > to find how to do that again).
> >
> Thanks for replying.
> 
> > What about firewall rules ?
> > # iptables -L
> >
> I've not used iptables directly before, so perhaps you'd look over the current 
> status:
> 
> iptables
> Chain INPUT (policy ACCEPT)
> target     prot opt source               destination
> RH-Firewall-1-INPUT  all  --  anywhere             anywhere
> 
> Chain FORWARD (policy ACCEPT)
> target     prot opt source               destination
> RH-Firewall-1-INPUT  all  --  anywhere             anywhere
> 
> Chain OUTPUT (policy ACCEPT)
> target     prot opt source               destination
> 
> Chain RH-Firewall-1-INPUT (2 references)
> target     prot opt source               destination
> ACCEPT     all  --  anywhere             anywhere
> ACCEPT     icmp --  anywhere             anywhere            icmp any
> ACCEPT     esp  --  anywhere             anywhere
> ACCEPT     ah   --  anywhere             anywhere
> ACCEPT     udp  --  anywhere             224.0.0.251         udp dpt:mdns
> ACCEPT     udp  --  anywhere             anywhere            udp dpt:ipp
> ACCEPT     tcp  --  anywhere             anywhere            tcp dpt:ipp
> ACCEPT     all  --  anywhere             anywhere            state 
> RELATED,ESTABLISHED
> ACCEPT     tcp  --  anywhere             anywhere            state NEW tcp 
> dpt:smtp
> ACCEPT     tcp  --  anywhere             anywhere            state NEW tcp 
> dpt:nfs
> ACCEPT     tcp  --  anywhere             anywhere            state NEW tcp 
> dpt:ssh
> ACCEPT     udp  --  anywhere             anywhere            state NEW udp 
> dpt:netbios-ns
> ACCEPT     udp  --  anywhere             anywhere            state NEW udp 
> dpt:netbios-dgm
> ACCEPT     tcp  --  anywhere             anywhere            state NEW tcp 
> dpt:netbios-ssn
> ACCEPT     tcp  --  anywhere             anywhere            state NEW tcp 
> dpt:microsoft-ds
> REJECT     all  --  anywhere             anywhere            reject-with 
> icmp-host-prohibited
> 
> > Did you tries do login localy ?
> >
> > # telnet localhost 25
> > ...
> That's OK.
> 
> > # telnet localhost 110
> > ..
> > # telnet localhost 143
> > ..
> Both these produce ''Temporary failure in name resolution'. 
> >
> > Remotly ?
> >
> > # telnet 192.168.0.40 25
> > ...
> > # telnet 192.168.0.40 110
> > ...
> > # telnet 192.168.0.40 143
> > ...
> telnet: Unable to connect to remote host: No route to host
> 
> How can that be?  Pings work OK.
> 
> >
> > Did you in your logs ?
> 
> After the last postfix reload there is
> 
> postfix/smtpd[3284]: connect from localhost[127.0.0.1]
> postfix/smtpd[3284]: disconnect from localhost[127.0.0.1]
> 
> That looks a bit odd.  Apart from that, I can't see anything relevant.
----
the first 4 lines of /etc/hosts should look like this and apparently,
yours doesn't...

# head -n 4 /etc/hosts
# Do not remove the following line, or various programs
# that require network functionality will fail.
127.0.0.1       localhost.localdomain localhost
::1             localhost6.localdomain6 localhost6

Fix this first

Craig