I have a small local network, with the following devices: a Belkin n150 router (older generation), a Dell laptop running Ubuntu 14.04 LTS (GNU-Linux 3.13.0-24-generic x86_64) as my server, and another HP laptop to test access.
My IP addresses look like this:
- router: 192.168.2.1
- server: 192.168.2.3
- laptop: 192.168.2.2
I have successfully setup LAMP and have one small page (/var/www/html/index.html) with one picture.
I can access this from my HP laptop by entering 192.168.2.3 into Firefox or Chrome.
I attempted to setup DNS using BIND9, following this tutorial. I followed the tutorial verbatim and then spent time looking at other videos and forums as well, but after several hours of trying, it still isn't working.
How do you redirect a domain name (ie. ) to access the website on a local server (192.168.2.3)?
43 Answers
BIND is a DNS server. (The ND means "Name daemon", which is a Unix-ish way of saying "name server".)
You can have BIND tell any device, including the laptop (and including the server), that mynet.home has an "A record" of 192.168.2.3
You seem to have understood all of that (vaguely, at least). Then you'll want to make sure that your computers (the laptop, and the server) send DNS queries to 192.168.2.3
One way to do that is to specify which system to query. e.g.:
nslookup mynet.home 192.168.2.3
A better way is to make the default location for DNS queries to be the server. Rotunduh's comment describes that. The most traditional way for Unix-ish systems is to adjust /etc/resolv.conf and include lines like:
nameserver 192.168.2.3search mynet.home
Then you can simply use: nslookup mynet.home
You should also be able to ping (unless ping is unsupported, such as if a firewall blocks standard ping traffic). e.g., ping mynet.home
You should then be able to reach your webserver at
Your web server might not show you the desired web pages until the web server is configured to recognize "mynet.home" as a domain name that it responds to.
So there's a few steps in the process:
- set up DNS server (e.g. BIND)
- set up network configuration to specify where DNS queries go to
- set up web server to support the domain
That's not including testing, or handling any difficulties like firewalls blocking traffic. So I submit this answer as a brief overview, with the expectations that one or more of these steps may be complex enough that you may have additional struggles/questions while setting all this up. Hopefully this roadmap gives you enough guidance to know what direction you're trying to head. (If you have additional specific questions, please make some new questions.)
(Of course, I'm not trying to suggest anything other than following the standard recommended process: check for documentation, online tutorials, etc., and then ask away if things remain unclear.)
Note: I'm not trying to disagree with other answers, which say things like using /etc/hosts and/or adjusting a router's configuration. I'm not trying to say that other approaches, referenced by other answers, won't work. There are multiple possible designs that can work. In fact, I would even say that those other approaches might be the fastest way (in the short term). However, using BIND, as you suggest, is more similar to professional setups like what is common on public Internet servers. And using BIND ought to work fine. You seemed to be asking about that approach, so that is what my guide is trying to describe.
I was curious too and found this over on stackexchange:
Goes through Win/Mac/Linux and with a good step by step.
2I have a home network not unlike yours, though my HTTP and FTP servers are on Windows.
It seems that you have got the HTTP server working, since you can access it within your intranet, so there are now three things to do:-
- In your router settings, set port forwarding so that accesses to port 80 (http) from the internet are mapped through to your HTTP server machine (192.168.2.3) - you should make this a fixed address within your intranet, and not simply use DHCP without tying the subnet address to the machine's MAC address.
- Either buy a fixed IP address from your ISP, or open an account with a dynamic DNS server and install their daemon on a machine in your intranet, preferably the HTTP server itself, though sometimes the router itself can do this for you - this will give your router a quasi-fixed internet address along the lines of http://youraccount.dynamicIPserver.org.
- Through your domain registrar, set to be forwarded either to your fixed IP or to http://youraccount.dynamicIPserver.org.
Notes:-
- You can use an internet proxy to test that your web-site is now publicly available.
- If your router's internet address does change, it may be a couple of minutes before the dynamic IP server registers the fact, and your site will be off-air for that time.
- There are a number of free and subscription dynamic IP servers available.
Finally, I hope it goes without saying that your HTTP server must have up-to-date firewall and antivirus protection, because you have now opened up a huge vulnerability.
6