1

I am doing web development and host the local versions of sites on my machine. I have Linux Slackware 14.0 with BIND 9.9.1-P3. In my named.conf I have this:

zone "localhost" IN {
    type master;
    file "caching-example/localhost.zone";
    allow-update { none; };
};

In localhost.zone:

$TTL    86400
$ORIGIN localhost.
@           1D IN SOA   @ root (
                    56      ; serial (d. adams)
                    3H      ; refresh
                    15M     ; retry
                    1W      ; expiry
                    1D )        ; minimum

            1D IN NS    @
            1D IN A     127.0.0.1

Suppose, I have a domain, called dubai, that I want to reference to localhost. I tried to add a CNAME record for localhost into localhost.zone:

dubai   IN  CNAME   localhost.

But it didn't work. How can I add a CNAME for localhost, so I could host multiple sites on my machine?

user4035
  • 135
  • 1
  • 7

1 Answers1

1

The zone file you're working in is for the reverse lookup zone of 0.0.127.in-addr.arpa, you need to be working with a zone that can contain dubai. or localhost. to work with those records.

Seems like you really just want to be using your /etc/hosts file, not setting up a BIND service.

If you do want to use BIND, then you should create a forward lookup zone. To use those names you can make a zone ".", but that will break resolution of actual internet names for systems pointed to this DNS server. It'd probably be better to create something like zone "dev.localhost", with a zone file along these lines:

@ IN A 127.0.0.1
dubai IN CNAME @
Shane Madden
  • 112,982
  • 12
  • 174
  • 248