1753782 Members
7187 Online
108799 Solutions
New Discussion юеВ

hostname

 
SOLVED
Go to solution
Sajjad Sahir
Honored Contributor

hostname


I can ping ip address but not pinging hostname
25 REPLIES 25
Hasan  Atasoy
Honored Contributor

Re: hostname

hi saijad ;

if you cannot ping the server fromyour client ; then you cannot resolve the hostname,

1. register that hostname in dns
or,
2. write hostname ip to your client hosts table.

Hasan.
Sajjad Sahir
Honored Contributor

Re: hostname

hasan already hostanme is in hosttable

i checked it from windows o/s i am pinging
my server but i can ping only ip not hostname
i checked hosname in /etc/hosts file also
i checked /etc/nsswitch.conf file
entry is perfectly ok

but i am not getting what was the reason yet
it is very urgent to me
pleaseeeeeeeeeeee

Hasan  Atasoy
Honored Contributor

Re: hostname


are you trying to ping your unix server from your pc ? or vice versa ?



Hasan
Bill Hassell
Honored Contributor

Re: hostname

The hostname is just another way to refer to the IP address. In HP-UX, a hostname is run through the resolver routines in the C library. There are several ways to obtain the translation. /etc/hosts is the simplest but there are two optional files that tell the resolver how to work. The first is /etc/resolv.conf. If it exists and had 1 to 3 IP addresses for working DNS servers, then the resolver will look at the second optional file called /etc/nsswitch.conf. If this file does not exist (there are several templates but only nsswitch.conf counts) then /etc/hosts is ignored. If your hostname is not in the DNS server, then no IP address is returned and ping has no address to use.

The hosts: line in the nsswitch.conf should read:

hosts: files [NOTFOUND=continue UNAVAIL=continue] dns

That way, if the new hostname is put into /etc/hosts, will be resolved. User the nsquery command to see how a hostname is resolved:

nsquery hosts somehostname


Bill Hassell, sysadmin
TTr
Honored Contributor

Re: hostname

> i checked it from windows o/s i am pinging
> my server but i can ping only ip not hostname

> i checked hosname in /etc/hosts file also
> i checked /etc/nsswitch.conf file
> entry is perfectly ok

The windows PC can not resolve the hostname of your UNIX server. You need to put the hostname/IP of the UNIX server in the name resolution service that your PC is using.

Your PC could be using a DNS server or a WINS server for name resolution.

On the PC open a CMD window (DOS window) and run the command "ipconfig /all" and look at the lines for "DNS servers" "Primary WINS server" "secondary WINS Server"

If any of those are defined, you have to put the UNIX hostname/IP in those servers so that your PC can resolve the UNIX hostname.
Sajjad Sahir
Honored Contributor

Re: hostname

hasan yes

i am pining from my pc to unix server
Tim Nelson
Honored Contributor

Re: hostname

If you are pinging from PC then you need to check or have a DNS entry on the DNS server that your PC is configured to query.

ipconfig/all from cmd prompt will tell you where your DNS server is. Ask the admin of that server to add your FQDN to that server.

Safarali
Valued Contributor

Re: hostname

sajjad,
what is the output of the nslookup
nslookup hostname

you need to put /etc/resolv.conf file on your system please provide the output of
/etc/resolv.conf and /etc/nsswitch.conf

Regards
Safar
Sajjad Sahir
Honored Contributor

Re: hostname

this is the output of resolv.conf file and the nsswitch.conf file

and nslooup ip output is also u can see below

# cat /etc/resolv.conf
nameserver 10.65.60.100

# nslookup 10.65.65.11
Using /etc/hosts on: society1

looking up FILES
Name: society1
Address: 10.65.65.11

# cat /etc/nsswitch.conf
#
# /etc/nsswitch.hp_defaults:
#
# @(#)B11.23_LR
#
# An example file that could be copied over to /etc/nsswitch.conf; it
# uses NIS (YP) in conjunction with files.
#

passwd: compat
group: compat
hosts: files [NOTFOUND=return] nis [NOTFOUND=return]
ipnodes: dns [NOTFOUND=return] files
networks: nis [NOTFOUND=return] files
protocols: nis [NOTFOUND=return] files
rpc: nis [NOTFOUND=return] files
publickey: nis [NOTFOUND=return] files
netgroup: nis [NOTFOUND=return] files
automount: files nis
aliases: files nis
services: nis [NOTFOUND=return] files
#