LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (http://www.linuxquestions.org/questions/linux-server-73/)
-   -   How to make hostname resolvable? (http://www.linuxquestions.org/questions/linux-server-73/how-to-make-hostname-resolvable-745072/)

jim.thornton 08-04-2009 11:58 AM

How to make hostname resolvable?
 
I have a new install of CentOS 5.3 as a VM in Virtualbox on a Vista machine.

I've installed ispCP Omega which is a pretty nice panel, however, I'm having some issues getting things working. The first is Postfix. I'm getting the following error in my /var/log/maillog file:

Code:

s1 postfix/smtp[10152]: fatal: unknown service: smtp/tcp
Postfix's FAQ says that this is a result of the chrooted environment and if you comment it out, that it will not do this. However, I want the chrooted environment and would like help figuring this out.

When I installed the system, I installed postfix via YUM. I haven't changed much in it [the config file] except for the hostname. I have set the hostname on my machine and when I go to the browser on my HOST machine I type in www.cancrm.com it resolves to my server. In order for this to happen, I previously added an entry to \windows\system32\drivers\etc\hosts to do so.

I added the same line to my /etc/hosts file and when I go to lynx www.cancrm.com points to my panel login too (however only admin.cancrm.com is suppose to do that -- but that is for another problem).

Now... I was looking at the Wiki on ispCP's site but unfortunately the support there is still limited due to the fact that it is a fairly new project still. However, I did file this:

Code:

Check if the server hostname is resolvable forward and reverse:

Prompt$> host your-servername.example.com
your-servername.example.com has address 192.0.2.100

Prompt$> host 192.0.2.100
100.2.0.192.in-addr.arpa. domain name pointer your-servername.example.com.

When I follow these instructions I get the following message:

Code:

# host www.cancrm.com
Host www.cancrm.com not found: 2(SERVFAIL)

# host s1.cancrm.com
Host s1.cancrm.com not found: 2(SERVFAIL)

# host cancrm.com
Host cancrm.com not found: 2(SERVFAIL)

# host 192.168.1.98
Host 98.1.168.192.in-addr.arpa not found: 3(NXDOMAIN)

So, Step one I failed, BUT it doesn't offer suggestions for fixing the problem.

Can anyone here help please?

jschiwal 08-05-2009 09:40 PM

Check the /etc/resolv.conf and /etc/nsswitch.conf files in your VM as well. They determine how names are resolved.

You can test name resolution with:
getent hosts <hostname>

It should return both local hostnames from /etc/hosts, as well as fqdn domain names from the name server.

jim.thornton 08-05-2009 09:52 PM

Thank you but when you say check the resolv.conf and nsswitch.conf files, what am I checking for?

jim.thornton 08-06-2009 07:23 AM

Resolv.conf:
Code:

nameserver 206.248.154.22
nameserver 206.248.154.170

** These are the names servers of my ISP provider.

nsswitch.conf:
Code:

#
# /etc/nsswitch.conf
#
# An example Name Service Switch config file. This file should be
# sorted with the most-used services at the beginning.
#
# The entry '[NOTFOUND=return]' means that the search for an
# entry should stop if the search in the previous entry turned
# up nothing. Note that if the search failed due to some other reason
# (like no NIS server responding) then the search continues with the
# next entry.
#
# Legal entries are:
#
#      nisplus or nis+        Use NIS+ (NIS version 3)
#      nis or yp              Use NIS (NIS version 2), also called YP
#      dns                    Use DNS (Domain Name Service)
#      files                  Use the local files
#      db                      Use the local database (.db) files
#      compat                  Use NIS on compat mode
#      hesiod                  Use Hesiod for user lookups
#      [NOTFOUND=return]      Stop searching if not found so far
#

# To use db, put the "db" in front of "files" for entries you want to be
# looked up first in the databases
#
# Example:
#passwd:    db files nisplus nis
#shadow:    db files nisplus nis
#group:    db files nisplus nis

passwd:    files
shadow:    files
group:      files

#hosts:    db files nisplus nis dns
hosts:      files dns

# Example - obey only what nisplus tells us...
#services:  nisplus [NOTFOUND=return] files
#networks:  nisplus [NOTFOUND=return] files
#protocols:  nisplus [NOTFOUND=return] files
#rpc:        nisplus [NOTFOUND=return] files
#ethers:    nisplus [NOTFOUND=return] files
#netmasks:  nisplus [NOTFOUND=return] files

bootparams: nisplus [NOTFOUND=return] files

ethers:    files
netmasks:  files
networks:  files
protocols:  files
rpc:        files
services:  files

netgroup:  nisplus

publickey:  nisplus

automount:  files nisplus
aliases:    files nisplus

I don't know what I'm looking for.

chitambira 08-06-2009 09:49 AM

This is a dns issue, your server is not in the dns, you need to set up your dns environment right.

jim.thornton 08-06-2009 10:35 AM

Let me explain further and then maybe someone can give me some detailed procedures to follow.

I have recently installed ispCP into my server. If I go to my Host machine, I can go to the browser and connect to my webserver via the IP or the domain that I put in the Hosts file (in the host). Once connected to the webserver, it doesn't matter if I go to admin.domain.com, www.domain.com or s1.domain.com. Either way it is showing up with the control panel and not the appropriate location.

In addition to this, Postfix is not sending out emails for some reason. It is returnning with the following maillog entries:

Code:

Aug  6 07:29:18 s1 postfix/pickup[10691]: 005B2D0413: uid=2000 from=<webmaster@admin.mydomain.com>
Aug  6 07:29:18 s1 postfix/cleanup[11814]: 005B2D0413: message-id=<20090806112918.005B2D0413@mail.mydomain.com>
Aug  6 07:29:18 s1 postfix/qmgr[2316]: 005B2D0413: from=<webmaster@admin.mydomain.com>, size=764, nrcpt=1 (queue active)
Aug  6 07:29:18 s1 postfix/smtp[11816]: fatal: unknown service: smtp/tcp
Aug  6 07:29:19 s1 postfix/master[2312]: warning: process /usr/libexec/postfix/smtp pid 11816 exit status 1
Aug  6 07:29:19 s1 postfix/master[2312]: warning: /usr/libexec/postfix/smtp: bad command startup -- throttling
Aug  6 07:29:19 s1 postfix/qmgr[2316]: warning: premature end-of-input on private/smtp socket while reading input attribute name
Aug  6 07:29:19 s1 postfix/qmgr[2316]: warning: private/smtp socket: malformed response
Aug  6 07:29:19 s1 postfix/qmgr[2316]: warning: transport smtp failure -- see a previous warning/fatal/panic logfile record for the problem description
Aug  6 07:29:19 s1 postfix/qmgr[2316]: 005B2D0413: to=<jim@myotherdomain.com>, relay=none, delay=1.1, delays=0.08/1/0/0, dsn=4.3.0, status=deferred (unknown mail transport error)
Aug  6 07:29:34 s1 postfix/pickup[10691]: E3DB4D0415: uid=2000 from=<webmaster@admin.mydomain.com>
Aug  6 07:29:34 s1 postfix/cleanup[11814]: E3DB4D0415: message-id=<20090806112934.E3DB4D0415@mail.mydomain.com>
Aug  6 07:29:34 s1 postfix/qmgr[2316]: E3DB4D0415: from=<webmaster@admin.mydomain.com>, size=747, nrcpt=1 (queue active)
Aug  6 07:29:34 s1 postfix/qmgr[2316]: E3DB4D0415: to=<jim@myotherdomain.com>, relay=none, delay=0.07, delays=0.06/0.01/0/0, dsn=4.3.0, status=deferred (unknown mail transport error)
Aug  6 07:30:19 s1 postfix/pickup[10691]: B2B0BD0414: uid=2000 from=<webmaster@admin.mydomain.com>
Aug  6 07:30:19 s1 postfix/cleanup[11814]: B2B0BD0414: message-id=<20090806113019.B2B0BD0414@mail.mydomain.com>
Aug  6 07:30:19 s1 postfix/qmgr[2316]: B2B0BD0414: from=<webmaster@admin.mydomain.com>, size=599, nrcpt=1 (queue active)
Aug  6 07:30:19 s1 postfix/smtp[11915]: fatal: unknown service: smtp/tcp
Aug  6 07:30:19 s1 postfix/pickup[10691]: C28BFD0417: uid=2000 from=<webmaster@admin.mydomain.com>
Aug  6 07:30:19 s1 postfix/cleanup[11814]: C28BFD0417: message-id=<20090806113019.C28BFD0417@mail.mydomain.com>
Aug  6 07:30:19 s1 postfix/qmgr[2316]: C28BFD0417: from=<webmaster@admin.mydomain.com>, size=827, nrcpt=1 (queue active)
Aug  6 07:30:19 s1 postfix/smtp[11916]: fatal: unknown service: smtp/tcp
Aug  6 07:30:20 s1 postfix/qmgr[2316]: warning: premature end-of-input on private/smtp socket while reading input attribute name
Aug  6 07:30:20 s1 postfix/qmgr[2316]: warning: private/smtp socket: malformed response
Aug  6 07:30:20 s1 postfix/qmgr[2316]: warning: transport smtp failure -- see a previous warning/fatal/panic logfile record for the problem description
Aug  6 07:30:20 s1 postfix/master[2312]: warning: process /usr/libexec/postfix/smtp pid 11915 exit status 1
Aug  6 07:30:20 s1 postfix/master[2312]: warning: /usr/libexec/postfix/smtp: bad command startup -- throttling
Aug  6 07:30:20 s1 postfix/qmgr[2316]: B2B0BD0414: to=<jim@myotherdomain.com>, relay=none, delay=1.1, delays=0.05/1/0/0, dsn=4.3.0, status=deferred (unknown mail transport error)
Aug  6 07:30:20 s1 postfix/qmgr[2316]: warning: premature end-of-input on private/smtp socket while reading input attribute name
Aug  6 07:30:20 s1 postfix/qmgr[2316]: warning: private/smtp socket: malformed response
Aug  6 07:30:20 s1 postfix/qmgr[2316]: warning: transport smtp failure -- see a previous warning/fatal/panic logfile record for the problem description
Aug  6 07:30:20 s1 postfix/master[2312]: warning: process /usr/libexec/postfix/smtp pid 11916 exit status 1
Aug  6 07:30:20 s1 postfix/qmgr[2316]: C28BFD0417: to=<jim@myotherdomain.com>, relay=none, delay=1, delays=0.02/1/0/0, dsn=4.3.0, status=deferred (unknown mail transport error)

I thought that the two problems combined were a result of my hostname not resolving. But I typed # telnet s1.domain.com 25 and it logged in, so I don't know what is going on.

jschiwal 08-10-2009 01:30 AM

Here is what my /etc/nsswitch.conf file looks like:
Code:

# passwd: files nis
# shadow: files nis
# group:  files nis

passwd: compat
group:  compat

hosts:          files mdns4_minimal [NOTFOUND=return] dns
networks:      files dns

services:      files
protocols:      files

rpc:            files
ethers:        files
netmasks:      files
netgroup:      files nis
publickey:      files

bootparams:    files
automount:      files nis
aliases:        files

The hosts: entry is what is used to resolve domain names. files is the /etc/hosts file. services: files indicates to use the /etc/service file. Add an entry for services: in /etc/nsswitch.conf; check that the /etc/services file exists, and then try:
getent services smtp


All times are GMT -5. The time now is 09:45 PM.