Last active
November 16, 2021 18:45
-
-
Save liamcmitchell/4387071 to your computer and use it in GitHub Desktop.
Minimum configuration for a local DNS server to handle the top level domain [dev]
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Install bind. | |
sudo apt-get install bind9 | |
# Add DNS servers to forward unknown queries to. | |
# These could be your router, ISP or other public DNS servers. | |
# /etc/bind/named.conf.options | |
forwarders { | |
8.8.8.8; | |
}; | |
# Add zone to | |
# /etc/bind/named.conf.local | |
zone "dev" { | |
type master; | |
file "/etc/bind/db.dev"; | |
}; | |
# Create zone file | |
# /etc/bind/db.dev | |
$TTL 1h ; default expiration time of all resource records without their o | |
@ IN SOA ns email ( | |
201212120 ; serial number of this zone file | |
1d ; slave refresh (1 day) | |
2h ; slave retry time in case of a problem (2 hours) | |
4w ; slave expiration time (4 weeks) | |
1h ; maximum caching time in case of failed lookups (1 hour) | |
) | |
NS ns ; ns.dev | |
@ A 127.0.0.1 ; dev | |
*.dev. A 127.0.0.1 ; xxx.dev | |
# Restart bind. | |
sudo service bind9 restart | |
# Configure OS to use local DNS server. | |
# On Ubuntu with network configured using dhcp | |
# /etc/dhcp/dhclient.conf | |
prepend domain-name-servers 127.0.0.1; | |
# And restart networking. | |
sudo /etc/init.d/networking restart |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment