I am trying to set up a BIND configuration with an Apache webserver. What I am trying to achieve is to by using the URL www.exampler.net access the content that can be found on my Apache webserver's /var/www/html folder. I am doing this on one machine which has the IP address 192.168.1.4. When I dig www.exampler.net while my Wired connection is on, it will only find Google's nameservers, but why I turn off my Wired connection it will instantly find my ns1.exampler.net. Why is that? Furthermore by writing www.exampler.net into the browser it won't redirect me to my local website which can be found in /var/www/html but by writing 192.168.1.4 i it will.
/etc/bind/named.conf.local
zone "exampler.net"{
type master;
file "/etc/bind/zones/db.exampler.net";
};
/etc/bind/zones/db.exampler.net
;
; exampler.net = domain name
;
$TTL 604800
exampler.net. IN SOA ns1.exampler.net. admin.localhost. (
2 ; Serial
604800 ; Refresh
86400 ; Retry
2419200 ; Expire
604800 ) ; Negative Cache TTL
; name servers
exampler.net. IN NS ns1.exampler.net.
; ip addresses
ns1 IN A 192.168.1.4
www IN A 192.168.1.4
/etc/apache2/sites-available/000-default.conf
<VirtualHost *:80>
ServerName exampler.net:80
ServerAlias www.exampler.net
ServerAdmin webmaster@localhost
DocumentRoot /var/www/html
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
I am using Ubuntu 14.04.1. I want to do this only locally, so that the hosts on my LAN server can use the given domain name to access the website that can be found on my Apache/NS server. Thanks in advance!