Editing /etc/hosts

Discussion in 'Server Operation' started by n!x, Oct 23, 2005.

  1. n!x

    n!x New Member

    I'm trying to set up a mail server using this guide.

    But i'm a bit confused about the /etc/hosts. Here's what's confusing me:

                        (1)                         (2)                     (3) 
                     server1.example.com            server1
    (1) The first thing is my LAN IP address which is on my server.

    (2) The next thing is confusing. Let's say i'm hosting this domain on my Ubuntu box www.123.com and my mailaddress should look something [email protected].
    What should the "server1.example.com" look like in my case?

    (3) This make a bit sense to me (alias, wright?)

    Thanks - hope not that this is a too stupid question

  2. falko

    falko Super Moderator ISPConfig Developer

    This has nothing to do with the domains you want to host on your server. You can still use server1.example.com or server1.123.com or h6535.anyotherdomain.com.
  3. themachine

    themachine ISPConfig Developer ISPConfig Developer

    The /etc/hosts file simply maps IPs to hostnames. If you look in your '/etc/nsswitch.conf' file, you'll see lines similar to:

    hosts: files dns
    ip_nodes: files dns
    networks: dns
    ...etc. So, looking at that example... if you ping a host it will look for the hostname in /etc/hosts first, and if it doesn't find anything it will query dns.

    To answer your question, 'server1.example.com' and 'server1' are both hostnames that point to You could list as many names as you like this way. So I could 'ping server1' and it will ping or I could 'ping server1.example.com' and it will also ping

Share This Page