-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathddns_update.sh
More file actions
42 lines (33 loc) · 842 Bytes
/
ddns_update.sh
File metadata and controls
42 lines (33 loc) · 842 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#!/bin/bash
# Purpose : DDNS Update
# Author : Rahul Patil<http://www.linuxian.com>
# Date : Fri Jan 17 22:54:38 IST 2014
# configure fqdn in /etc/hosts before using this script
fqdn=test.linuxian.loc
ipaddr=10.20.10.111
key_pass='KAYPASS'
dns_server='aws-monitor-dns.linuxian.loc'
zone='linuxian.loc'
rev_zone='150.21.10.in-addr.arpa'
forward_zone_update() {
echo "
server $dns_server
zone $zone
key rndc-key $key_pass
update add ${fqdn}. 8600 IN A ${ipaddr}
send" | nsupdate
}
reverse_zone_update() {
echo "
server $dns_server
zone $rev_zone
key rndc-key $key_pass
update add "${ipaddr##*.}"."${rev_zone}" 8600 IN PTR ${fqdn}.
send" | nsupdate
}
forward_zone_update
reverse_zone_update
rndc freeze ${zone}
rndc freeze ${rev_zone}
rndc thaw ${zone}
rndc thaw ${rev_zone}