dns
Domain name service
Check mail record with dig
1 dig mx bitarus.allowed.org
Check mail record with dig directly in name server
1 dig mx bitarus.allowed.org @ns.bitarus.allowed.org
Check reverse dns
1 dig -x 54.68.9.58
Ask for Reverse DNS for EC2 Elastic IP address
Dynamic DNS Raspberry pi
1 # change apparmor in ubuntu
2 apt install apparmor-utils
3 sudo aa-complain /usr/sbin/named
4 service bind9 restart
5
6 cd /tmp # bind server
7 dnssec-keygen -a HMAC-SHA512 -b 512 -n USER rpi.dyn.bitarus.allowed.org.
8
9 # secret contains the Key: value
10 # vim /etc/bind/keys.conf
11 key rpi.dyn.bitarus.allowed.org. {
12 algorithm HMAC-SHA512;
13 secret "???????";
14 };
15
16 # vim /etc/bind/named.conf
17 include "/etc/bind/keys.conf";
18 zone "bitarus.mooo.com" IN {
19 type master;
20 file "/etc/bind/bitarus.mooo.com.hosts";
21 allow-update { key "rpi.dyn.bitarus.allowed.org."; };
22 };
23
24 #vim /etc/bind/bitarus.mooo.com.hosts
25 $ORIGIN .
26 $TTL 604800 ; 1 week
27 bitarus.mooo.com IN SOA bitarus.mooo.com. root.bitarus.mooo.com. (
28 6 ; serial
29 604800 ; refresh (1 week)
30 86400 ; retry (1 day)
31 2419200 ; expire (4 weeks)
32 604800 ; minimum (1 week)
33 )
34 NS bitarus.mooo.com.
35 A 54.68.9.58
36 MX 5 mail.bitarus.mooo.com.
37 $ORIGIN bitarus.mooo.com.
38 labs A 54.68.9.58
39
40 sudo chgrp bind /etc/bind
41 sudo chmod g+w /etc/bind
42 sudo chown -R bind:bind /etc/bind
43 service bind9 restart
44
45 # In raspberry pi
46 cd /tmp
47 scp user@bitarus.allowed.org:/tmp/K*dyn* .
48 mkdir ~/rpiDdns
49 mv Kr* ~/rpiDdns/
50 cd ~/rpiDdns/
51 chmod 0400 Krp*
52 sudo apt update
53
54 #vim nsupdate-rpi.sh
55 logger "Running nsupdate-rpi.sh"
56 EXT_IP=$(wget -qO- http://ifconfig.co/ip)
57 KEY="/home/pi/rpiDdns/Krpi.dyn.bitarus.allowed.org.+165+55648.private"
58 echo "Key: $KEY"
59
60 cat <<EOF | nsupdate -k "$KEY"
61 server bitarus.allowed.org
62 zone bitarus.mooo.com
63 update delete rpi.bitarus.mooo.com. A
64 update add rpi.bitarus.mooo.com. 600 A $EXT_IP
65 show
66 send
67 EOF
68
69 chmod 755 nsupdate-rpi.sh
70 crontab -e
71 */10 * * * * /home/pi/scripts/nsupdate-rpi.sh