Preface
I am hosting a web server and DNS server on the same box over a home network. The external IP is dynamic. To handle this, I use a paid service called no-ip.com to automatically update the IP of mydnsserver.com (let's say external IP is 11.22.33.444). I want to use mydnsserver.com to resolve mywebsite.com (and any other websites later on) so that all external connections to mywebsite.com will be handled by Apache.
Problem
The problem that I am having and can't find a solution to is that when I visit mywebsite.com on my phone (external connection), my browser resolves to localhost. I need the domain to resolve (both internal to the server and externally) to Apache running on mydnsserver.com so that the website will be rendered from my server. I want to do this without having to enter the IP address of the server for the A record.
Registrar Settings (Godaddy)
mywebsite.com nameserver settings
ns.mydnsserver.com
ns2.mydnsserver.com
mydnsserver.com nameserver settings
ns1.no-ip.com
ns2.no-ip.com
ns3.no-ip.com
ns4.no-ip.com
ns5.no-ip.com
Resolve Config
/etc/resolve.conf
domain mywebsite.com
search mywebsite.com
nameserver 127.0.0.1
Bind9 Config
/etc/bind/named.conf
include "/etc/bind/named.conf.options";
include "/etc/bind/named.conf.local";
include "/etc/bind/named.conf.default-zones";
/etc/bind/named.conf.options
options {
directory "/var/cache/bind";
dnssec-validation auto;
auth-nxdomain no;
listen-on-v6 { any; };
listen-on port 53 { any; };
};
/etc/bind/named.conf.default-zones
zone "." {
type hint;
file "/etc/bind/db.root";
};
zone "mywebsite.com" {
type master;
file "/etc/bind/zones/mywebsite.zone";
};
zone "localhost" {
type master;
file "/etc/bind/db.local";
};
zone "127.in-addr.arpa" {
type master;
file "/etc/bind/db.127";
};
zone "0.in-addr.arpa" {
type master;
file "/etc/bind/db.0";
};
zone "255.in-addr.arpa" {
type master;
file "/etc/bind/db.255";
};
/etc/bind/zones/mywebsite.zone
$TTL 1d
@ IN SOA mywebsite.com. root.mywebsite.com. (
2014112501 ; serial#
1h ; refresh, seconds
1h ; retry, seconds
1h ; expire, seconds
1h ) ; minimum, seconds
@ IN NS mywebsite.com.
@ IN A 127.0.0.1
@ IN MX 0 mail.mywebsite.com.
www IN A 127.0.0.1
nslookup
mywebsite.com
Server: 127.0.0.1
Address: 127.0.0.1#53
Name: mywebsite.com
Address: 127.0.0.1
mydnsserver.com
Server: 127.0.0.1
Address: 127.0.0.1#53
Non-authoritative answer:
Name: mydnsserver.com
Address: 11.22.33.444
Is what I am doing is not possible? Do I -have- to use the real IP address to resolve to? It looks like what it's doing is taking exactly what I enter into the Zone File, and setting any browser to exactly that.
Moving the zone file out of /etc/bind/zones and updating the named.conf.default to look for zones in the new location fixed the issue.