Initial commit

This commit is contained in:
Mikael Hansson 2022-07-15 12:23:09 +02:00
commit 8707c06d7a
8 changed files with 119 additions and 0 deletions

4
README.md Normal file
View File

@ -0,0 +1,4 @@
DNS, DDNS and DHCP on a Linux router
====================================
This is a complementary repository to my blog post on setting up a more advanced configuration in a simple Linux router, at [https://oxcrag.net/2022/02/12/dns-ddns-and-dhcp-on-a-linux-router/](https://oxcrag.net/2022/02/12/dns-ddns-and-dhcp-on-a-linux-router/).

33
etc/bind/dhcpd.conf Normal file
View File

@ -0,0 +1,33 @@
option domain-name "mydomain.com";
option domain-name-servers 10.199.200.1;
default-lease-time 600;
max-lease-time 7200;
ddns-update-style standard;
update-static-leases on;
authoritative;
key "rndc-key" {
algorithm hmac-sha256;
secret "<thesecret>";
};
allow unknown-clients;
use-host-decl-names on;
zone mydomain.com. {
primary 10.199.200.1;
key rndc-key;
}
zone 200.199.10.in-addr.arpa. {
primary 10.199.200.1;
key rndc-key;
}
subnet 10.199.200.0 netmask 255.255.255.0 {
range 10.199.200.100 10.199.200.254;
option subnet-mask 255.255.255.0;
option routers 10.199.200.1;
option domain-name "mydomain.com";
ddns-domainname "mydomain.com.";
ddns-rev-domainname "in-addr.arpa.";
}

13
etc/bind/named.conf.local Normal file
View File

@ -0,0 +1,13 @@
zone "mydomain.com" {
type master;
notify yes;
file "/var/lib/bind/db.mydomain.com";
allow-update { key rndc-key; };
};
zone "200.199.10.in-addr.arpa" IN {
type master;
notify yes;
file "/var/lib/bind/db.200.199.10.in-addr.arpa.rev";
allow-update { key rndc-key; };
};

38
etc/dhcp/dhcpd.conf Normal file
View File

@ -0,0 +1,38 @@
option domain-name "mydomain.com";
option domain-name-servers 10.199.200.1;
default-lease-time 600;
max-lease-time 7200;
ddns-update-style standard;
update-static-leases on;
authoritative;
key "rndc-key" {
algorithm hmac-sha256;
secret "<mysecret>";
};
allow unknown-clients;
use-host-decl-names on;
zone mydomain.com. {
primary 10.199.200.1;
key rndc-key;
}
zone 200.199.10.in-addr.arpa. {
primary 10.199.200.1;
key rndc-key;
}
subnet 10.199.200.0 netmask 255.255.255.0 {
range 10.199.200.100 10.199.200.254;
option subnet-mask 255.255.255.0;
option routers 10.199.200.1;
option domain-name "mydomain.com";
ddns-domainname "mydomain.com.";
ddns-rev-domainname "in-addr.arpa.";
}
host example {
hardware ethernet 52:54:00:de:ad:af;
fixed-address 10.199.200.27;
}

4
etc/resolv.conf Normal file
View File

@ -0,0 +1,4 @@
nameserver 10.199.200.1
nameserver 1.1.1.1
nameserver 1.0.0.1
search mydomain.com

View File

@ -0,0 +1,4 @@
[Resolve]
DNS=10.199.200.1,10.199.200.20
Domains=mydomain.com

View File

@ -0,0 +1,12 @@
$ORIGIN .
$TTL 3600 ; 1 hour
200.199.10.in-addr.arpa IN SOA gateway.mydomain.com. (
1000 ; serial
14400 ; refresh (4 hours)
3600 ; retry (1 hour)
604800 ; expire (1 week)
300 ; minimum (5 minutes)
)
NS gateway.mydomain.com.
$ORIGIN 200.199.10.in-addr.arpa.
1 PTR gateway.mydomain.com.

View File

@ -0,0 +1,11 @@
$ORIGIN .
$TTL 604800 ; 1 week
mydomain.com IN SOA gateway.mydomain.com. (
1000 ; serial
14400 ; refresh (4 hours)
3600 ; retry (1 hour)
604800 ; expire (1 week)
300 ; minimum (5 minutes)
)
NS gateway.mydomain.com.
gateway A 10.199.200.1