HPE GreenLake Administration
- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: Resolution of localhost
Operating System - HP-UX
1838661
Members
10612
Online
110128
Solutions
Forums
Categories
Company
Local Language
back
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
back
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
Blogs
Information
Community
Resources
Community Language
Language
Forums
Blogs
Go to solution
Topic Options
- 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
03-11-2003 12:40 AM
03-11-2003 12:40 AM
Hi,
The /etc/nsswitch.conf entry reads as follows:
hosts: files nis nisplus
If I do a ping localhost, it first looks in to the local /etc/hosts and if it is not available it then uses the nis source and if not nisplus source.
My doubt over here is
1) Can I make an assumption that irrespective
of whatever is the source, "localhost" will
always resolve to 127.0.0.1?
Or
2) For certain sources, it will be resolved to be 127.0.0.1 and for something else it
will be resolved to the localhost's IP?
Please clarify.
Thanks,
Sanjay
The /etc/nsswitch.conf entry reads as follows:
hosts: files nis nisplus
If I do a ping localhost, it first looks in to the local /etc/hosts and if it is not available it then uses the nis source and if not nisplus source.
My doubt over here is
1) Can I make an assumption that irrespective
of whatever is the source, "localhost" will
always resolve to 127.0.0.1?
Or
2) For certain sources, it will be resolved to be 127.0.0.1 and for something else it
will be resolved to the localhost's IP?
Please clarify.
Thanks,
Sanjay
Dying is the last thing that I will do.
Solved! Go to Solution.
2 REPLIES 2
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-11-2003 12:44 AM
03-11-2003 12:44 AM
Solution
As long as you have files first in your nsswitch.conf file and you have an entry in /etc/hosts for localhost pointing to 127.0.0.1 then yes, it will always resolve to 127.0.0.1.
But if you use other sources first in /etc/hosts, or someone removes or changes the localhost entry in /etc/hosts then localhost could resolve to something other than 127.0.0.1. This happened to us once, we had dns then files in our nsswitch.conf file and someone accidentally put an entry into our dns for localhost pointing to something other than 127.0.0.1 ! - talk about cause us problems! now the dns guys leave a permanent entry in the dns for localhost pointing to 127.0.0.1 just to be safe, or we could put files first in our dns search order.
But if you use other sources first in /etc/hosts, or someone removes or changes the localhost entry in /etc/hosts then localhost could resolve to something other than 127.0.0.1. This happened to us once, we had dns then files in our nsswitch.conf file and someone accidentally put an entry into our dns for localhost pointing to something other than 127.0.0.1 ! - talk about cause us problems! now the dns guys leave a permanent entry in the dns for localhost pointing to 127.0.0.1 just to be safe, or we could put files first in our dns search order.
Im from Palmerston North, New Zealand, but somehow ended up in London...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-11-2003 04:25 AM
03-11-2003 04:25 AM
Re: Resolution of localhost
localhost (and loopback) are fairly important to basic networking in HP-UX which is why they should never be changed in /etc/hosts, and that /etc/hosts always be searched first. There is a big speed advantage to using files then nis or dns as the resolution order in nsswitch.conf, perhaps 100:1 or more. This is because the hosts file is essentially memory resident and thus instantly available.
This makes a huge difference when using typical network backup programs (like Omniback, etc) where gethostbyname is issued for every file. Rather than ask the NIS or DNS server for this info, use /etc/hosts. Just put the few machines that are part of backup operations into /etec/hosts. Note that maintenance of individual /etc/hosts can be simplified by putting only a few key production machines into the file. IP addresses for these systems probably won't change every few weeks.
Bill Hassell, sysadmin
This makes a huge difference when using typical network backup programs (like Omniback, etc) where gethostbyname is issued for every file. Rather than ask the NIS or DNS server for this info, use /etc/hosts. Just put the few machines that are part of backup operations into /etec/hosts. Note that maintenance of individual /etc/hosts can be simplified by putting only a few key production machines into the file. IP addresses for these systems probably won't change every few weeks.
Bill Hassell, sysadmin
The opinions expressed above are the personal opinions of the authors, not of Hewlett Packard Enterprise. By using this site, you accept the Terms of Use and Rules of Participation.
Company
Events and news
Customer resources
© Copyright 2025 Hewlett Packard Enterprise Development LP