0

can two hosts share the same IP Address without a conflict. This is how my /etc/hosts looks like :-

$ cat /etc/hosts
127.0.0.1   localhost
127.0.1.1   debian
127.0.1.1       mini

Now as can be seen both mini and debian share the same IP Address.

Now debian is my hostname.

$ hostname
debian

while mini is a virtual host for an apache site.

/etc/apache2/sites-available$ head minidebconfindia.conf 
<VirtualHost mini:80>
ServerAdmin webmaster@localhost

This is in Apache 2.4. I am just not sure whether this is good or not. A friend of mine has the same setup (with a different hostname) on Apache 2.2 and that works without issue.

Looking forward to know if this is valid or should I be doing any changes ?

3

This fully valid and correctly. Also you can write names in one string with space delimiter:

127.0.1.1   debian  mini  mini.local

The both variants is fully valid.

1

can two hosts share the same IP Address without a conflict Short answer: No.

Now as can be seen both mini and debian share the same IP Address. No, it's the other way round: Both names resolve to the same IP and that is OK.

The IP 127.... are loopback Adresses, only available on your machine, read up here.
Note that these IPs are not accessible from outside your computer.

After some deeper research, describe your issue with apache in a new question.

  • 127.0.0.0/8 is loopback; private addresses by RFC 1918 are 10.0.0.0/8, 172.16.0.0/16 and 192.168.0.0/16. – countermode Sep 10 '14 at 10:38
  • OMFG, corrected - should get more coffee before posting! Thank you @countermode – Jan Sep 10 '14 at 11:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.