1833051 Members
2348 Online
110049 Solutions
New Discussion

Re: 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
#

















































Bill Hassell
Honored Contributor

Re: hostname

> i am pining from my pc to unix server

OK. All the information about nsswtch.conf and nslookup have nothing to do with your PC. These directions are only for pinging from your HP-UX server to another location. You need to contact your network or WINS/DNS administrator and ask that your HP-UX server's hostname be added. That way, your PC will then know the server's hostname. You can also edit the PC's hosts file but that may be bypassing a process in your company for maintaining all the host names.

I noticed in your HP-UX nsswitch.conf file that it is using NIS, a centralized server containing a lot of network information. Perhaps the administrator of the NIS server can help with WIND/DNS for your PC.


Bill Hassell, sysadmin
sachit patil
Regular Advisor
Solution

Re: hostname

Hi you have to add entry in hosts file of windows
ip address hostname


start -> search > hosts* > edit file and insert entry >save

After u can ping ur hostname.

Regards
sac
Sajjad Sahir
Honored Contributor

Re: hostname

through telnet from my system i can ping ip address but not hostname so I checked all these files why I can't ping the hostname
I am pinging from my windows o/s system


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
#
Bill Hassell
Honored Contributor

Re: hostname

As mentioned before, there is no problem with your HP-UX server. All those HP-UX files do not have anything to do with your PC. Your PC knows nothing about this hostname. Therefore, only the IP address will work. You have to configure your PC to translate the hostname into an IP address. The exact location of the hosts file depends on your version of Windows but for XP, the file is:

C:\WINDOWS\system32\drivers\hosts

Just add your hostname to that file, like this:

12.34.56.78 myhostname

This is strictly your PCs configuration. Nothing needs changing in the HP-UX system.


Bill Hassell, sysadmin
Dennis Handly
Acclaimed Contributor

Re: hostname

>Bill: The exact location of the hosts file depends on your version of Windows but for XP, the file is:
C:\WINDOWS\system32\drivers\hosts

On my XP it is:
C:\WINDOWS\system32\drivers\etc\hosts
(There are a bunch of other UNIX style networking files there too.)
Sajjad Sahir
Honored Contributor

Re: hostname

thank u bill Hassel I edited and got it

thank u once again? one more clarification

suppose more peoples are using from their own pc then we have to manually edit in all pcs?

sajjad
Dennis Handly
Acclaimed Contributor

Re: hostname

>then we have to manually edit in all PCs?

It was mentioned several times that if you can set up a DNS server with those FQDN/IP mappings, then everyone can access those machines.
Sajjad Sahir
Honored Contributor

Re: hostname

Dear Dennis

I have four unix servers I ddin't edit /etc/hosts files in windows

but i can ping hostname in 2 servers they are hp_da1 and hp_da2

but my problem is i can' tping hostname
in the other two

without editing anything in windows i can ping hostname of two servers and i can't ping hostname of two servers how to manage it
if i am editing in windows /etc/hosts file
every system i can ping wiht hostname no problem but in unix platform how i can manage these issue in my two servers
Dennis Handly
Acclaimed Contributor

Re: hostname

>but i can ping hostname in 2 servers they are hp_da1 and hp_da2

Are they on the same subnet and the other two aren't?
Were only two added to the DNS before?
TTr
Honored Contributor

Re: hostname

You need to get a basic understanding about what name resolution is and where it occurs and how to set up every host (windows or unix) to use that name resolution. I think I gave you the answer in the 5th reply above and Dennis above is telling you the same thing
-oo-
Sajjad Sahir
Honored Contributor

Re: hostname

Dear Dennis Handly
This is the information regarding two servers ok, please check it and let me know
hp_data1 server

This server I can ping with hostname(without entry in windows)

cat /etc/hosts


100.100.100.1 cache_fuson1
100.100.100.2 cache_fuson2
10.65.60.51 hp_data1 hp_data1.mosa.gov
10.65.60.52 hp_data2 hp_data2.mosa.gov
127.0.0.1 localhost loopback
10.10.10.1 heartbeat1
10.10.10.2 haertbeat2
10.65.60.100 main.mosa.gov
10.65.56.135 mail-serv.mosa.gov
10.65.60.60 mosa-sma01
nsswitch.conf

cat /etc/nsswitch.compat

passwd: compat
group: compat
hosts: nis [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



soceity1 server

This server I can't ping with hostname

cat /etc/hosts

10.65.65.11 society1
127.0.0.1 localhost loopback

cat /etc/nsswitch.conf

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


society1# cat /etc/resolv.conf
nameserver 10.65.60.100

u need any further information let me know? I will give complete description, but i need it very urgently
see i didn't configure any thing in case of first server in windows but i can ping with that one wiht hostname
but in second server it is not possible.

in window if we editing in /etc/hosts we will get it no problem. but i need it how to solve this issue form unix
file system it self.
Dennis Handly
Acclaimed Contributor

Re: hostname

>This is the information regarding two servers ok, please check it and let me know

I assume here is nothing on HP-UX that will solve this issue. You need to look to your DNS.

>society1# cat /etc/resolv.conf
nameserver 10.65.60.100

I assume you need look at this machine.

>i didn't configure any thing in case of first server in windows but i can ping with that one with hostname

Perhaps someone already added it to the DNS?

>but i need it how to solve this issue form unix file system it self.

I don't think it works this way?
Sajjad Sahir
Honored Contributor

Re: hostname


not pinging
cat /etc/nsswich.nisplus
passwd: files nisplus
group: files nisplus
hosts: nisplus [NOTFOUND=return] files
ipnodes: files
services: nisplus [NOTFOUND=return] files
networks: nisplus [NOTFOUND=return] files
protocols: nisplus [NOTFOUND=return] files
rpc: nisplus [NOTFOUND=return] files
publickey: nisplus
netgroup: nisplus [NOTFOUND=return] files
automount: files nisplus
aliases: files nisplus


This one pinging
cat /etc/nsswitch.nisplus
passwd: files nisplus
group: files nisplus
hosts: nisplus [NOTFOUND=return] files
services: nisplus [NOTFOUND=return] files
networks: nisplus [NOTFOUND=return] files
protocols: nisplus [NOTFOUND=return] files
rpc: nisplus [NOTFOUND=return] files
publickey: nisplus
netgroup: nisplus [NOTFOUND=return] files
automount: files nisplus
aliases: files nisplus

Sajjad Sahir
Honored Contributor

Re: hostname

Dear Denny
what are the files out put u need in both servers, I will give complete output
so please let me know.

Sajjad
Dennis Handly
Acclaimed Contributor

Re: hostname

Asking around indicates:
1) HP-UX systems on the same subnet know about each other automatically.
2) Windows boxes in the same workgroup know about each other.

3) If not one of above, you will have to edit the hosts file, or use a DNS.