I have a single IP ( and I would like to use /etc/hosts to associate multiple domains with that IP. Currently my hosts file looks like this: nerto.it  nerto

I would like eventlog.it and eventlog.in to also be resolved to I tried making my hosts file look like this, but it didn't work the way I expected: nerto.it  nerto eventlog.it  nerto eventlog.in  nerto

What it the proper setting to have in my /etc/hosts file so that nerto, nerto.it, eventlog.it, and eventlog.in all resolve locally to

  • 3
    that syntax is correct though – Mike Jul 19 '11 at 12:47
  • Upvote because this came up on the first page in Google - June 2018 – SDsolar Jun 7 '18 at 4:18
  • Please explain how it didn't work to your expectations. That looks correct. What went wrong? – SDsolar Jun 7 '18 at 4:20

I don't understand why you have more than 1 line in the file for this IP. Assuming the 4 hostnames you want to access the IP via are nerto, nerto.it, eventlog.in, and eventlog.it, this should work: nerto.it eventlog.in eventlog.it nerto
  • Is it possible todo the opposite? To add the same domain to multiple IP addresses in the hosts file. – Bert Jan 11 '18 at 15:36

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.