1

I have a router and a laptop. On my laptop I have installed WAMP which includes Apache. I have configured Apache to grant access over intranet. Using IP address I can access the server from any other PC/mobile devices on my intranet. I don't want to use IP address but some easy to remember name like http://free.goodies to open the web page that I created.

NOTE: The WiFi router will not have internet access it will be a pure Intranet network and laptop has windows OS in it.

Is it possible to do and if yes how to do it?

1
  • If its just the Windows machine, add the appropriate line to the hosts file. If its the whole LAN which needs access, you may want to modify / set up DNS resolution in the router - if/how this is done will be dependent on the router.
    – davidgo
    Commented Aug 10, 2017 at 4:50

1 Answer 1

1

I don't want to use IP address but some easy to remember name like http://free.goodies to open the web page that I created.

It is possible to do this by hosting your own DNS server.

Be aware that while whatever computer you choose to use as a DNS server can be used for other things, it will need to be switched ON with the proper service running in order to resolve custom domain names.


Note: The steps outlined below are for Windows 7 but Windows 10 should be an almost identical process. Also, while these steps may seem a bit tedious, once you have BIND set up correctly you'll rarely need to fiddle with it.


Installing BIND

First you will need to download the DNS server software. We will be using a stable, ESV copy of ISC BIND. For Windows, as of the last update to this question, that version is 9.16.29. For native Windows support, currently you should avoid any non-9.16.x copies, including e.g. 9.18.x or 9.19.x. You should also avoid any unstable or early deployment versions.


As of this writing (June 2022), 9.16.x is the last branch of BIND with native Windows support. The latest native Windows release should currently be BIND9.16.29.x64.zip - win 64-bit. This should be listed under 9.16.29 Current-Stable, ESV BIND 9.16 with support from May 2022 to Q1 2024.


  • Click on the blue Bind 9 link to expand the download options for ISC BIND.

  • Click "Download".

  • Once prompted, select the e.g Windows 64-bit version (the blue description text is a link ex. BIND9.16.29.x64.zip - win 64-bit).

When finished downloading, extract the .zip file and look for a file called BINDInstall.exe. You must "Run this program as an administrator" (Properties → Compatibility) since it needs elevated privileges to install the "ISC BIND" service.

  • Set the "Target Directory" (where you would like BIND installed). This can be any directory you like.

  • Set the service account as "NT AUTHORITY\LocalService" (no quotes). Do not used "named" as the service account.

  • Leave the password fields blank.

  • Make sure "Automatic Startup" is checked. This will ensure that BIND starts when the server starts.

  • "Keep Config Files After Uninstall" may be checked automatically. This is fine. The two remaining boxes should be unchecked ("Tools Only" and "Start Bind After Install").

  • Click "Install". This should register the "ISC BIND" service with Windows and create two new directories ("bin" and "etc") under the "Target Directory".

BIND 9 Installation Example

Note that if you used a forward / slash (i.e. NT AUTHORITY/LocalService) rather than the proper backslash \ (i.e. NT AUTHORITY\LocalService), BINDInstall will throw an error stating the password fields cannot be blank. You must use a backslash.

If you are separately prompted to install Visual C++ redistributables after initially clicking "Install", you should do so. However, if the Visual C++ redistributables installer says "Repair" rather than "Install", you already have the proper files and can click "Cancel".

After installing, you should double check that the "ISC BIND" service was created successfully under Start Menu → Administrative Tools → Services (alternately, Start Menu → Search/Run → services.msc).

If the service was not installed successfully ("ISC BIND" doesn't appear in the "Services" window), re-run BINDInstall.exe and choose "Uninstall". You should not have to modify any values when uninstalling.

Repeat the installation steps above (starting at the first item, "Target Directory") until the service registers successfully.

BIND 9 Service Installation Success Example


Setting Up BIND

You should not attempt to start BIND yet since we have a bit of configuration to do.

Under your installation directory (e.g. C:\ISC BIND 9), you should have two folders as mentioned previously ("bin" and "etc"). Under this same directory, manually create a third folder called "zones".

When done, enter the "bin" folder. From a command prompt in that same folder (Shift + Right-Click → Open command window here), run the following two commands:

rndc-confgen -a
rndc-confgen > ..\etc\rndc.conf

RNDC Confgen Example

Moving back to the "etc" folder, there should be two new files — "rndc.key" and "rndc.conf". Ignoring these for a moment, create a new file in "etc" called "named.conf" with something like the following:

ex. C:\ISC BIND 9\etc\named.conf

# Anything with a hash (#) is a comment.

# Our basic options -- where do we find our zone files?
# This should be changed to correspond with the path to
# your zones folder.

options {
    directory "C:\ISC BIND 9\zones";
    allow-transfer { none; };

# Tack down the edges a little regarding security.

#   allow-recursion {192.168.1.0/24;}; // change IPs as required

    allow-recursion {"localnets";};

# The option below sets up DNS forwarding to outside servers.
# In this case, we route through BIND which then passes certain 
# requests to Google DNS. This is unnecessary for intranets. 

    # forwarders { 8.8.8.8; 8.8.4.4; };

};

# Local domains

zone "free.goodies" IN {
    type master;
    file "free.goodies.txt";
    allow-transfer { none; };
};

Note: For the section above, you can just copy and paste. But make sure to put the correct "zones" folder path as mentioned. Uncomment the forwarders line if you wish to use it for resolving non-local requests.

Keeping "named.conf" open, now open "rndc.conf" as well. Copy the entire commented-out (#) section at the bottom of the file and paste into the bottom of "named.conf". Make sure to uncomment everything you just pasted into "named.conf" except "# End of named.conf".

ex. C:\ISC BIND 9\etc\named.conf (cont.)

# This section needs the correct "secret". You will have to substitute 
# the proper rndc.conf section you generated earlier.

# Use with the following in named.conf, adjusting the allow list as needed:
key "rndc-key" {
    algorithm hmac-sha256;
    secret "kJE0HwbbEg/J2SegGyJree533aRnCzD4Psi2vQ0NXtI=";
};

controls {
    inet 127.0.0.1 port 953
        allow { 127.0.0.1; } keys { "rndc-key"; };
};

# End of named.conf

As of February 2020, the current-stable, non-ESV version of BIND (BIND 9.14.10) now uses a more secure rndc-key algorithm in the form of hmac-sha256, as shown above.

While this shouldn't be an concern for new installations, when upgrading from older versions of BIND (where you simply transfer your configurations from one installation to another), a configuration may be using the older, less secure hmac-md5 algorithm:

# Use with the following in named.conf, adjusting the allow list as needed:
    key "rndc-key" {
        algorithm hmac-md5;
        secret "2diZ8TosQlmJc15Nw3+ISh==";
};

If this is the case, the BIND service will likely be unable to start. You should regenerate your "rndc.key" and "rndc.conf" files (above) and replace the appropriate portions in your old "named.conf" file.


Create A Local Domain

Now that we have our basic BIND configuration done ("named.conf"), we can create a record detailing the connection between "free.goodies" and the WAMP server itself.

In your "zones" folder, create an new file called "free.goodies.txt" (or whatever you put in your "named.conf" file) and make it look like the following:

; Enables use of e.g. http://free.goodies/
; Anything with a semi-colon is a comment

$TTL 3600               ; Default TTL
@   IN SOA  ns.free.goodies.    candyman.free.goodies. (
        2017081001  ; serial
        10800       ; Refresh period
        3600        ; Retry interval
        604800      ; Expire time
        86400 )     ; Negative caching TTL

@      NS   ns.free.goodies.

ns                  IN A        10.0.0.10       ; This entry is necessary - Use the IP of the BIND server

free.goodies.       IN A        10.0.0.10       ; A Record for the WAMP server - we're assuming its on the same server as BIND
cool                IN A        10.0.0.10       ; A Record for a subdomain on the same machine e.g. cool.free.goodies

Note: for the section above, you can just copy and paste again if you like. But make sure to put the correct IP addresses.

If you ever want to make changes to this file, remember...

  • non-subdomain entries require a trailing period "."
  • You need to update the serial (make it larger e.g. increment by 1).
  • E.g. candyman.free.goodies can be anything you wish (it's an email address with a "." for "@").
  • Your entry for the primary domain e.g. free.goodies. needs to match a "named.conf" zone entry e.g. zone "free.goodies" IN {.
  • You have to restart your server to see any changes (this also applies to changes to "named.conf")

Starting BIND

You can now start BIND in the Services window. Find the "ISC BIND" service under Start Menu → Administrative Tools → Services (or, again, Start Menu → Search/Run → services.msc) and click "Start".

If there are no errors, the BIND service should start. If it does not start, there is an error in your configuration file ("named.conf") or your local domain zone file ("free.goodies.txt").

BIND 9 Service Example

Server Firewall

For network access, make sure that ports 53 and 953 (both TCP and UDP) are open on your DNS server firewall for inbound and outbound traffic. These are the standard DNS ports.

Setting Up Your Router

The final step in process of setting up your custom domain is to configure your router. The specific steps will vary from router to router but you want to look for settings that allow you to specify what DNS server(s) your router will use.

If you ever want this server publicly available, you will want to make sure the router is correctly forwarding ports 53 and 953 as well.

BIND Router Settings


Success! (Maybe)

Once the ISC BIND service is started and your router is properly configured, you should be able to navigate to e.g. http://free.goodies/ in your browser and get your WAMP server page.

If you can't...

  • Double check your router settings.

  • Double check your "named.conf" and e.g. "free.goodies.txt" zone file.

  • Make sure your WAMP server is configured correctly (i.e. it is set up to handle http://free.goodies/ and that there are no WAMP server or BIND server firewall issues).

  • In Chrome-based browsers (Chrome, Firefox, Opera, etc.), make sure to use a "/" at the end of your local domain address. Due to built-in features, http://free.goodies will likely cause an error where as http://free.goodies/ will not.

  • Double check that BIND is running. BIND can also, on (extremely) rare occasions, become unresponsive. In either case, you can use the "Services" window to stop and start BIND as needed.

Note that since you (likely) enabled RNDC management in your configuration (at least if you followed all the steps), you can use e.g.:

@echo off
"C:\ISC BIND 9\bin\rndc" reload
pause 

in a batch file (.bat) to quickly reload your server while it's running. This is much simpler than stopping and starting BIND via the "Services" window if you have to make configuration changes to "named.conf" or your zone file.


Setting Up A Virtual Host In WAMP

Per this article, these are the step you roughly need to take to setup a Virtual Host in WAMP to handle free.goodies:

  1. Open httpd.conf under C:\wamp\bin\Apache#.#.#\conf\httpd.conf. You may wish to make a copy of this for a backup before making any alterations.

  2. Uncomment the following lines (remove the # in front of them):

    LoadModule vhost_alias_module modules/mod_vhost_alias.so
    

    and

    Include conf/extra/httpd-vhosts.conf
    
  3. Save httpd.conf.

  4. Now open httpd-vhosts.conf under C:\wamp\bin\Apache#.#.#\conf\httpd.conf\extra. Again, you may wish to make a copy of this for a backup before making any alterations.

  5. At the end of httpd-vhosts.conf, add the following:

        # Virtual host entry for the free.goodies local domain.
        # Anything beginning with a # are comments.
    
        <VirtualHost *:80>
    
            ServerName free.goodies
            #ServerAlias www.free.goodies
    
            # DocumentRoot should correspond to wherever the HTML files
            # for your free.goodies site are located. This is an example.
    
            DocumentRoot "C:/wamp/www/free-goodies"
    
            #ErrorLog "logs/free.goodies-error.log"
            #CustomLog "logs/free.goodies-access.log" common
    
            # If you have any problems with "Forbidden", try uncommenting
            # the following. You may have to alter the directory to match
            # your DocumentRoot above.
    
            #<Directory "/">
                #AllowOverride None
                #Options None
                #Require all granted
            #</Directory>
    
       </VirtualHost> 
    
  6. Save httpd-vhosts.conf. You can copy and paste the above directly into httpd-vhosts.conf but make sure to substitute the correct paths for your WAMP installation.

  7. Restart all services. Assuming nothing is wrong with your alterations, WAMP should restart normally and serve any requests for http://free.goodies from the appropriate directory.

10
  • ISC bind is not accepting empty password fields. Commented Aug 12, 2017 at 16:56
  • I set ISC Bind up its working now but only on my system for other devices in my WiFi the link doesn't load, it says "free.goodie's server DNS address not found." Commented Aug 12, 2017 at 17:46
  • You should 1) Check that the router is using your server for DNS 2) Make sure any firewall on the server isn't blocking port 53 or 953 (TCP or UDP) and 3) make sure to add a trailing / (e.g free.goodies/) on every request (not just locally). Commented Aug 12, 2017 at 18:05
  • How to setup wamp to handle free.goodies ? Commented Aug 12, 2017 at 18:31
  • It seems 953 port is not listening only 53 is listening Commented Aug 12, 2017 at 19:46

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .