I managed to setup bind on my local network in order to resolve domains to the local IP of my server instead of my public IP. However it only works on other clients in the network, but not from the server itself.
Here is my config :
/etc/bind/db.mydomain.be
$ORIGIN mydomain.be.
$TTL 3600
@ IN SOA ns1.local. me.ff. (
5 ; Serial
1h ; Refresh
30m ; Retry
7d ; Expire
15m ) ; Negative Cache TTL
;
@ IN NS ns1.local.
@ IN A 192.168.1.105
* IN A 192.168.1.105
/etc/bind/named.conf.options
options {
directory "/var/cache/bind";
recursion yes; # enables resursive queries
listen-on { 192.168.1.105; };
allow-recursion { localnets; };
allow-transfer { none; };
forwarders {
8.8.8.8;
8.8.4.4;
};
auth-nxdomain no; # conform to RFC1035
listen-on-v6 { any; };
dnssec-validation auto;
};
From a pc on my network : ping mydomain.be - > resolves as expected to my server 192.168.1.105
Same ping command on the server itself : ping mydomain.be - > resolves to my public ip address 141.135.154.217. I need it to resolve to it's onw IP 192.168.1.105
What am I missing ? It looks like "ping mydomain.be" from the server itself, just passes on to my DNS forwarders. Which in turn will respond with my public iP.