- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - OpenVMS
- >
- gethostname() returns undisered name
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Forums
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-02-2003 03:03 AM
тАО10-02-2003 03:03 AM
I have a machine with 2 network interfaces.
10.10.x.x and 10.5.x.x, when I activate the gethostname() function the return name is the name associated with the 10.5 network.
how can I change it to 10.10 network?
attached is a sample program, you can compile and run it to simulate problem.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-02-2003 04:25 AM
тАО10-02-2003 04:25 AM
Re: gethostname() returns undisered name
if you do a tcpip show int, which address is listed first? That should be the one gethostname reports on.
Greetings, Martin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-02-2003 09:29 AM
тАО10-02-2003 09:29 AM
Re: gethostname() returns undisered name
this is the output of tcpip show int:
73::users:[amit] tcpip show int
Packets
Interface IP_Addr Network mask Receive Send MTU
IE0 10.10.14.20 255.255.0.0 171934150 191212288 1500
LO0 127.0.0.1 255.0.0.0 35385744 35385744 4096
WE0 10.5.14.33 255.255.0.0 0 115 1500
what amazes me, is that the first interface listed is 10.10.14.20 that should return "cell73" in response to gethostname()
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-02-2003 10:39 AM
тАО10-02-2003 10:39 AM
Re: gethostname() returns undisered name
I think the key is that the interfaces are of different type. I've checked with a three interface system of ours (also various types IE0, WE1, WF0) and found a similar behaviour than reported by you. On systems with all WEx devices my observation is that the first one is picked.
As a pure guess: All the systems I looked at picked the alphabetically first configured IP interface to determine the hostname.
Greetings, Martin
P.S. That might not be very helpful in your case since switching interfaces might not be an option.
P.P.S. If you are really desparate you might want to redefine the tcpip$inet_hostaddr logical and see if this changes the translation. This is untested by me and might have sideeffects you do not like!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-02-2003 12:56 PM
тАО10-02-2003 12:56 PM
SolutionSee:
$ TCPIP SHOW CONFIGURATION COMMUNICATION
You can change these with:
$ TCPIP SET CONFIGURATION COMMUNICATION -
/LOCAL_HOST=name/DOMAIN=name
At runtime, gethostname translates the system executive logical names TCPIP$INET_NODE and TCPIP$INET_DOMAIN. (note group, process and job values are ignored). In practice changing these logical names will change the result of gethostname, but may cause other unpredictable side effects - this is NOT recommended.
Depending on what you're really trying to achieve, perhaps you should be using gethostbyaddr() using the 10.5 network address?
To get more general, you could use ioctl() to find the IP addresses associated with all interfaces on the host, then gethostbyaddr() to find out all possible host names?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-02-2003 01:53 PM
тАО10-02-2003 01:53 PM
Re: gethostname() returns undisered name
since this is a production system, i'll post a reply next wednsday or thursday and tell you how did it go.