Krysti.Engineer Official Chat
You are viewing an inferior version of the site because your browser does not support WebP. Do upgrade to something like Chrome or Firefox. Loading websites like this causes them to require a fallback set of images and they are almost always lower quality and larger in size.

Use BIND/DNS To Define Your Home Network

.. or how I named my network after Sailor Scouts. You could set this up on something as small as an old model 2 Raspberry Pi, really any SBC should EASILY handle this function.
BIND9 Logo
2022-07-24T:00:00:00+00:00 July 24 2022 00:00:00

nano -w /etc/bind/named.conf
# This should be included, but make sure.
include "/etc/bind/named.conf.local";


nano -w /etc/bind/named.conf.local
zone "sailorscouts" {
        type master;
        file "/etc/bind/zones/sailorscouts.db";
};

zone "0.168.192.in-addr.arpa" {
        type master;
        file "/etc/bind/zones/rev.0.168.192.in-addr.arpa";
};


nano -w /etc/bind/zones/sailorscouts.db
$TTL 1h
sailorscouts.  IN      SOA     jupiter.sailorscouts.    krysti@jupiter.sailorscouts (
                                                        2009010910 ;serial
                                                        3600 ;refresh
                                                        3600 ;retry
                                                        3600 ;expire
                                                        3600 ;minimum TTL
)

sailorscouts. IN  NS      jupiter.sailorscouts.
sailorscouts. IN  MX      10      mail.sailorscouts.
sailorscouts. IN  MX      20      mail.sailorscouts.

; Computers
@       	IN  A   192.168.0.10 # sailorscouts
moon		IN	A	192.168.0.1  # moon.sailorscouts
luna     	IN  A   192.168.0.11 # luna.sailorscouts, etc
saturn		IN	A	192.168.0.12
mercury		IN	A	192.168.0.13
mars		IN	A	192.168.0.14
neptune		IN	A	192.168.0.15
jupiter		IN	A	192.168.0.16

db			IN	CNAME	moon
www			IN	CNAME	saturn
cdn			IN	CNAME	mercury
ns			IN	CNAME	jupiter


nano -w /etc/bind/zones/rev.0.168.192.in-addr.arpa
$TTL 1h
@ IN SOA jupiter.sailorscouts. krysti@jupiter.sailorscouts. (
                                                        2008112111 ;serial
                                                        3600 ;refresh
                                                        3600 ;retry
                                                        3600 ;expire
                                                        3600 ;minimum TTL
)

                IN      NS      jupiter.sailorscouts.
1               IN      PTR     moon.sailorscouts.
11              IN      PTR     luna.sailorscouts.
12              IN      PTR     saturn.sailorscouts.
13              IN      PTR     mercury.sailorscouts.
14              IN      PTR     mars.sailorscouts.
15              IN      PTR     neptune.sailorscouts.
16              IN      PTR     jupiter.sailorscouts.

How this is setup on my network is that the JUPITER server is our nameserver (192.168.0.16). It will be referenced as such in the SOA and NS records. From there you have "A" records and "PTR" records to sort through. You technically don't *need* PTR records but if you have some sort of internal network things setup those addresses will RESOLVE such as "jupiter.sailorscouts" would be a valid reverseable (RDNS) hostname on this network. We have some CNAME's (aliases) to clearly define what the FUNCTION of a handful of servers will be such as jupiter.sailorscouts has the alias ns.sailorscouts and both locations will access the same server. A big key takeaway here is make sure that named.conf.local is included in the named.conf or these records will never load proper.

These hosts will NOT reverse on the Internet as they do not have that type of authority to use private IP addresses to reversable DNS hostnames beyond your private network. To configure RDNS for Internet addresses you might own (on VPSes perhaps) that you use the admin panel provided with the services you bought and this will enable the required PTR record (the ISP sets this up) needed to allow you to reverse hostnames from a real DNS (not your home) server. You can try out something like Afraid.Org to setup hostnames for IPs you have on the Internet. They have free hostnames you can assign without owning a domain of your own. If you host servers on Linode, which I recommend and is a great (non-sponsored) service. You can edit RDNS in your "Network" tab on your Linode server panel.
Linode select edit RDNS
Linode edit RDNS

nano -w /etc/resolv.conf.head
search sailorscouts


nano -w /etc/resolv.conf
nameserver 192.168.0.16
nameserver 8.8.8.8 # These will be your ISP DNS servers probably
nameserver 4.4.4.4


nano -w /etc/dhcpcd.conf
static domain_name_servers=192.168.0.16

Be sure your DNS server is first on the resolv.conf list. It will allow your private DNS to resolve before it hits the Internet to check for the address where it technically doesn't exist outside of your network. This setup should fly on Void Linux and other non-systemd setups with not much than a few more tweaks.

nano -w /etc/systemd/resolved.conf
[Resolve]
DNS=192.168.0.16
FallbackDNS=8.8.8.8
Domains=sailorscouts


service systemd-resolved restart

You can integrate similarly with systemd using 'systemd-resolve' command to set this up. Edit your '/etc/systemd/resolved.conf' and change the DNS variable as well as the Domains variable. The domain in this example is 'sailorscouts'

Contact Krysti

@itskrystibitch Twitter Photo
GitHub:
@itskrystibitch
IRC:
Official Chat
Direct.Me:
@Krysti
Ko-fi:
@Krysti
Photos:
Virtual Krysti
E-Mail / Notify of errors:
coder [@] krysti.engineer
Please be patient contacting me, I don't really check much of social media or anything. If you use the IRC be sure to stick around because that's how IRC works, silly. :P