hostid(1) General Commands Manual hostid(1)NAME
hostid - Sets or displays the identifier of the local host
SYNOPSIS
/usr/sbin/hostid [hostname | hexadecimal_number | internet_address]
DESCRIPTION
The hostid command displays the 32-bit identifier of the host as a hexadecimal number in host standard byte order. The identifier must be
unique across all hosts and is commonly set to the Internet address of the specified host. The superuser can set the host ID by specifying
a hostname, internet_address, or hexadecimal_number argument. The identifier is stored in network standard byte order.
EXAMPLES
To display the identifier of the local host, enter: $ hostid
0xc009c803
The hostid command displays the identifier of the host as a hexadecimal number in host standard byte order. To set the identifier
of the local host to the local Internet address, enter: $ hostid 555.5.55.555
The hostid command converts the Internet address to its hexadecimal equivalent, and then sets the local host to this address.
Note that the sample Internet address in this example, 555.5.55.555, is not a valid Internet address and would cause hostid to
return an error.
SEE ALSO
Commands: hostname(1)
Functions: gethostid(2), sethostid(2)hostid(1)
Check Out this Related Man Page
GETHOSTID(3) Linux Programmer's Manual GETHOSTID(3)NAME
gethostid, sethostid - get or set the unique identifier of the current host
SYNOPSIS
#include <unistd.h>
long gethostid(void);
int sethostid(long hostid);
Feature Test Macro Requirements for glibc (see feature_test_macros(7)):
gethostid()
_BSD_SOURCE || _XOPEN_SOURCE >= 500 || _XOPEN_SOURCE && _XOPEN_SOURCE_EXTENDED
sethostid():
_BSD_SOURCE || (_XOPEN_SOURCE && _XOPEN_SOURCE < 500)
DESCRIPTION
gethostid() and sethostid() respectively get or set a unique 32-bit identifier for the current machine. The 32-bit identifier is intended
to be unique among all Unix systems in existence. This normally resembles the Internet address for the local machine, as returned by geth-
ostbyname(3), and thus usually never needs to be set.
The sethostid() call is restricted to the superuser.
RETURN VALUE
gethostid() returns the 32-bit identifier for the current host as set by sethostid().
On success, sethostid() returns 0; on error, -1 is returned, and errno is set to indicate the error.
ERRORS
sethostid() can fail with the following errors:
EACCES The caller did not have permission to write to the file used to store the host ID.
EPERM The calling process's effective user or group ID is not the same as its corresponding real ID.
CONFORMING TO
4.2BSD; these functions were dropped in 4.4BSD. SVr4 includes gethostid() but not sethostid(). POSIX.1-2001 specifies gethostid() but not
sethostid().
NOTES
In the glibc implementation, the hostid is stored in the file /etc/hostid. (In glibc versions before 2.2, the file /var/adm/hostid was
used.)
In the glibc implementation, if gethostid() cannot open the file containing the host ID, then it obtains the hostname using gethostname(2),
passes that hostname to gethostbyname_r(3) in order to obtain the host's IPv4 address, and returns a value obtained by bit-twiddling the
IPv4 address. (This value may not be unique.)
BUGS
It is impossible to ensure that the identifier is globally unique.
SEE ALSO hostid(1), gethostbyname(3)COLOPHON
This page is part of release 3.27 of the Linux man-pages project. A description of the project, and information about reporting bugs, can
be found at http://www.kernel.org/doc/man-pages/.
Linux 2010-09-20 GETHOSTID(3)
I running HPUX 11.0,
Netscape gives me an error "Unable to locate Server" when using a www.something.com address.
If I use an IP address I get past the router and onto the Internet.
My workstation can get to the Router @ 192.168.0.1 and also it's local APACHE server.
I have DHCP enabled... (8 Replies)
Hi,
i have a file with contents like below ( any number of entries can be there)
111
222
333
444
555
i need to make another file with single line like below:
111,222,333,444,555 (without ending , )
TIA
Prvn (8 Replies)
There's a piece in a C program I'm writing (Linux) that simply needs to take a host name and return an IP address (e.g., take 'mail.gnu.org' and return 199.232.76.166). I've gotten a successful status from getaddrinfo, but don't see any of the fields in the result structure that has what I'm... (7 Replies)
How do I deal with extracting a portion of a record when multiple field separators are involved.
Let's say I have:
Mike Harrington;(555) 555-5555:250:100:175
Christian Dobbins;(555) 555-2358:155:90:201
Susan Dalsass;(555) 555-6279:250:60:50
Archie McNichol;(555) 555-1348:250:100:175
Jody... (3 Replies)
I am trying to figure out how to scan a file like so:
1 ralphs office","555-555-5555","ralph@mail.com","www.ralph.com
2 margies office","555-555-5555","ralph@mail.com","www.ralph.com
3 kims office","555-555-5555","kims@mail.com","www.ralph.com
4 tims... (17 Replies)
Hello Everybody
I would like to know that I have configure the OS & other application on the SunFire V440 server
1) If suppose no hostid base software install in that v440 server & if some problem comes in the motherboard of that server. If I remove the harddisk ( on which Solaris & other... (4 Replies)
I have a file with columns which are separated by tabs and spaces like
111 333 444 555 7gg
333 555 678 778 6yy
I need to write a AWK commmand , to search for a pattern in column 1 eg "111" and replace the value in column 5 with say "7kk" , I tried the assignment... (4 Replies)
Hi,
How to format something like this:
John Roberts 324-141-984 Acct
Jack Williams 159-555-555 Acct
William Jackson 949-911-888 Acct
Mark J Walton 145-852-252 Acct
Fred P Milton 483-244-390 Acct
Bill P J Miller 404-050-223 Acct
into... (12 Replies)
I am trying to determine if there are several url/host names for an IP address. Is there a UNIX command to find ALL host names for an IP address?
Thank you in advance. (3 Replies)
Hi,
I've searched the UNIX forum looking for a simple procedure how to change\control my Solaris server hostid.
I did found few threads but all of them either have broken links to all kinds of scripts or not described simply for some UNIX beginers user like me.
Can anyone assist me?
I... (21 Replies)
I have a file.....
xxx 2345 455
abc 345 555
cdf 456 777
fff 555 888
Now my requirement is, Say if, i want to select only those records prior to the record fff 555 888...
how do i go about doing this in unix....
The fff would be hardcoded as it wud be fixed and everytime when i... (7 Replies)
There is no /etc/hostid file.
I know that there is no relationship between with MAC address and hostid. There are a lot of scripts on the net but how can I exactly do in my case. :rolleyes: (4 Replies)
Hello guys,
I would like to develop a script which takes a host name as argument and displays a message whether the host is on the local network or not. How can I accomplish that? Is there a file or command that I can use to list all host on the local network? :confused: (4 Replies)
Hi, i tried to do this script:
Generate a "unique" 6-digit hexadecimal identifier for your computer. Do not use the flawed hostid command. Hint: md5sum /etc/passwd, then select the first 6 digits of output.
Fom 0 to 9 and from a to f
#!/bin/bash
clear
echo ""
echo "--------------------"... (4 Replies)
I have a machine in my LAN that runs Ubuntu and I have full access in it.
There is another PC on the Internet that has a public IP eg 3.3.3.3 and it servers as https server and access to it is by username and password. On the remote PC all i have is access through https using username/passwd.
... (3 Replies)