1837035 Members
2917 Online
110111 Solutions
New Discussion

Re: Hostname problem

 
SOLVED
Go to solution
Alan Vargas
Regular Advisor

Hostname problem

Hello

I have a big problem with thist problem, when i type hostname command in a hp-ux server appear another ip address, this ip address does not belong to this server.

Thanks for your help
10 REPLIES 10
Victor Fridyev
Honored Contributor

Re: Hostname problem

Hi Alan,

Could you please show an output of the command.

Hostname usually gives name, not IP.
In any case, check the following files:
/etc/hosts, /etc/rc.config.d/netconf,
/etc/nsswitch.conf.
Also please check yor name resolution (DNS,NIS).

HTH
Entities are not to be multiplied beyond necessity - RTFM
Devender Khatana
Honored Contributor

Re: Hostname problem

Hi,

Agree with Victor that your question is a bit confusing. If you mean that by typing hostname it shows the name of a server whose IP is other than this server then you can check the hostname set in /etc/rc.config.d/netconf file & entry for the same name in /etc/hosts.

/etc/nssswitch.conf will let you know how the name resolution is taking place.

HTH,
Devender
Impossible itself mentions "I m possible"
D Block 2
Respected Contributor

Re: Hostname problem

can you clarify for us ? you type:

$ hostname

and you get back an IP address ?

can you type:

$ uname -a

does this return an IP address also ?

I don't believe this is true, for the hostname might truncate the length to 8 characters on the output..

what explan can you show us ?

thanks
Golf is a Good Walk Spoiled, Mark Twain.
Nguyen Anh Tien
Honored Contributor

Re: Hostname problem

you can set it by one of two way
1, issue this command
#hostname name_that_you_want
2, edit //etc/rc.config.d/netconf
HOSTNAME="server" #change it
OPERATING_SYSTEM=HP-UX
LOOPBACK_ADDRESS=127.0.0.1
save, exit and then issue two more commands
[server:/sbin/init.d] /sbin/init.d/net stop
[server:/sbin/init.d] /sbin/init.d/net start
HTH
tienna
HP is simple
D Block 2
Respected Contributor

Re: Hostname problem

Alan,
Nguyen Anh, did mention that you can set the 'hostname' by running the hostname command. so, my point was, maybe someone did this command:

# hostname

Golf is a Good Walk Spoiled, Mark Twain.
Alan Vargas
Regular Advisor

Re: Hostname problem

Thanks to all, but i found the problem, i have to reboot the system and it got the right ip address

Thank again
Alan Vargas
Regular Advisor

Re: Hostname problem

Hello

I have this problem with the HP-UX server, when i typed uname -a i got the right name of the server, but when i try with hostaname those name does not match, the name must be tgt20, and whe i try to list or install any aplication o patch i got this error:

-all:[P0]/>swlist
# Initializing...
# Contacting target "-all"...
ERROR: Could not contact host "-all". Make sure the hostname is
correct and an absolute pathname is specified (beginning with
"/").
ERROR: More information may be found in the daemon logfile on this
target (default location is -all:/var/adm/sw/swagentd.log).
-all:[P0]/>

Attached the other command:


-all:[P0]/>uname -a
HP-UX tgt20 B.11.11 U 9000/800 2964193283 unlimited-user license

-all:[P0]/>hostname
-all
-all:[P0]/>

I´d like to know how to fix this error without boot the server.


Thanks again
Patrick Wallek
Honored Contributor
Solution

Re: Hostname problem

Simply do:

# hostname tgt20


You really need to figure out how the hostname is getting reset. I would guess that someone that doesn't know what they are doing, is using the hostname command incorrectly.
Mel Burslan
Honored Contributor

Re: Hostname problem

what is the output to the 'hostname' command ?
that might tell you something.

also check if somebody messed up with the /sbin/init.d/hostname script. I have seen stranger things happen by some people with good intentions and bad knowledge, modifying the startup scripts.
________________________________
UNIX because I majored in cryptology...
Alan Vargas
Regular Advisor

Re: Hostname problem

It´s works .. thanks again gu