Setting up subdomains in DNS


You have a webserver (or any server) on your local network, and Freesco is configured to forward port 80 (HTTP) to that server. You also have a domain name (say, that points to your public IP address.

When someone from the outside world punches into their browser, your webpage shows up. But if you type into your browser on your local network, nothing happens.


You need to configure Freesco's DNS server for your domain. The DNS configuration is stored in the file /mnt/router/etc/named.hst. Here's how to update it.

Brief version:

Login as root, edit /mnt/router/etc/named.hst, and add one entry per subdomain in the format:


Copy /mnt/router/etc/named.hst to /etc, restart your nameserver with /mnt/router/rc/rc_named restart and you're on your way. Don't forget to update your reverse DNS files as well (see this article for details).

Longer walkthrough for newbies:

Connect to your Freesco box via telnet (under Windows, just type telnet <your router's ip>) and login as root.


cd /mnt/router/etc
edit named.hst

Now, you need to enter any subdomains you want to use. For our example, we wanted to point to, to point to, and to point to, so we entered:


As you can see, the first part of each line is the subdomain you want to use (eg: using router translates to IN and A have special meaning - don't change or omit them. Last is the IP address of the machine the subdomain corresponds to. Don't forget the final <TAB> at the end of each line.

And note that where we say <TAB>, we mean that you should press the TAB key.

Next, press Alt+X to exit, and when the editor asks you to save, press Y to confirm.

Finally, you should restart your nameserver. Type:

cp /mnt/router/etc/named.hst /etc
/mnt/router/rc/rc_named restart

At this point, your new subdomains should be ready to go! Load up your browser and punch in (substitute your domain, of course) and your site should appear.

Note that your default domain (or “primary DNS suffix”) on all of the machines on your network should be, as well. On Windows XP, for example, you can change your primary DNS suffix under Start|Control Panel|System|Computer Name|Change|More….

Next, you should probably setup your nameserver for reverse DNS lookups as well - click here to see how.

made by Steve Blinch

freesco/howtos/setting_up_subdomains_in_dns.txt (167135 views) · Last modified: 2005/09/14 00:49 (external edit)
Recent changes RSS feed Creative Commons License Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki