/etc/hosts for shared hosting server

I read the following guide on linode.com

https://linode.com/docs/getting-started/

Here is my /etc/hosts file

127.0.0.1       bandit
127.0.1.1       ubuntu.members.linode.com       ubuntu

# The following lines are desirable for IPv6 capable hosts
::1     localhost ip6-localhost ip6-loopback
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters

Open in new window



Should I list the ipaddress and the domain of every site that I am hosting for shared hosting?

Thanks
burnedfacelessAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

 
arnoldCommented:
It helps dealing with when the server or services restart to avoid running lookups and potentially running into issues if a site you host, has had its owner transfer the site at which point if you use site names in virtualhost entries, the app will try to bind to an ip not configured on your server.

Potentially you are using named based hosting so it will not have any impact.
Not sure whether your love node deals with sone other considerations.
0
 
nociSoftware EngineerCommented:
one caution though i see the 127.0.0.1 was changed to bandit..., please leave localhost on that line (as first name)...
it is expected by a lot of software that 127.0.0.1 maps to localhost and vice versa...
127.0.0.1       localhost bandit
127.0.1.1       ubuntu.members.linode.com       ubuntu

# The following lines are desirable for IPv6 capable hosts
::1     localhost ip6-localhost ip6-loopback
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters

Open in new window


would be perfectly acceptable.
0
 
burnedfacelessAuthor Commented:
Changed /etc/hosts

Arnold you're gonna have to break it down for me I haven't gotten to any major classes yet.

An ip not configured on the server - you mean like giving each site it's own ip (a virtual container)?

Does the server do lookups (DNS)?

I thought DNS just forwarded it to the server and the server took the domain to show the correct site.
0
 
nociSoftware EngineerCommented:
What arnold meant:

if DNS  changes (because the service leaves your shared hosting)  that when  restarting a local service that has a configured name
that the namelookup would endup with an address not on your server.

Example:
Your shared server: 5.5.5.5
server moving.example.org   used to be 5.5.5.5 and now became 50.50.50.50 (went to a competitor)...
Now if you had a config file with moving.example.org  it used to translate to your service mapping to the right interface (for binding),
and now will resolve to 50.50.50.50 which is somewhere else, giving errors dusring restart of named service with unable to bind to interface.

If /etc/hosts contained a line 5.5.5.5 moving.example.org  (And nss uses files before DNS, which is common) then whatever is in DNS the service will start with 5.5.5.5 ... (although traffic will never land as it goes (outside this server to 50.50.50.50..., a copy of data by name would also fail btw. from this server as it will try to connect to 5.5.5.5 in stead of 50.50.50.50.....
(Hope this helps).
0

Experts Exchange Solution brought to you by ConnectWise

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.