Created
February 20, 2013 18:04
-
-
Save ragzilla/4997587 to your computer and use it in GitHub Desktop.
Basic HA AnyCast DNS Resolver Configs
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
#! /bin/bash | |
IP=/sbin/ip | |
GREP=/bin/grep | |
DIG=/usr/bin/dig | |
LOOPSTATE=0 | |
DIGSTATE=0 | |
# figure out our current state | |
${IP} addr show dev lo scope global | ${GREP} 206.xx.232.240 >/dev/null # show addresses on loopback, check for a HA addr | |
if [[ $? == 0 ]]; then | |
LOOPSTATE=1 | |
fi | |
${DIG} -6 @localhost +noall +time=1 +tries=1 +retry=0 xx.com >/dev/null | |
if [[ $? == 0 ]]; then | |
DIGSTATE=1 | |
fi | |
if [[ ${DIGSTATE} == ${LOOPSTATE} ]]; then | |
exit 0 | |
fi | |
if [[ ${LOOPSTATE} == 0 ]]; then | |
# start advertising, we got a dig and we're not advertising | |
echo "Starting advertisements..." | |
${IP} -f inet addr add 206.xx.232.240/32 dev lo | |
${IP} -f inet addr add 209.xx.3.240/32 dev lo | |
${IP} -f inet6 addr add 2001:xx:d:61::1/128 dev lo | |
${IP} -f inet6 addr add 2001:xx:d:62::1/128 dev lo | |
elif [[ ${LOOPSTATE} == 1 ]]; then | |
# stop advertising, dig failed | |
echo "Stopping advertisements..." | |
${IP} -f inet addr del 206.xx.232.240/32 dev lo | |
${IP} -f inet addr del 209.xx.3.240/32 dev lo | |
${IP} -f inet6 addr del 2001:xx:d:61::1/128 dev lo | |
${IP} -f inet6 addr del 2001:xx:d:62::1/128 dev lo | |
fi |
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
interface eth0 | |
ipv6 ospf6 cost 1 | |
ipv6 ospf6 hello-interval 1 | |
ipv6 ospf6 dead-interval 4 | |
ipv6 ospf6 retransmit-interval 5 | |
ipv6 ospf6 priority 0 | |
ipv6 ospf6 transmit-delay 1 | |
ipv6 ospf6 instance-id 0 | |
! | |
interface eth1 | |
ipv6 ospf6 cost 1 | |
ipv6 ospf6 hello-interval 1 | |
ipv6 ospf6 dead-interval 4 | |
ipv6 ospf6 retransmit-interval 5 | |
ipv6 ospf6 priority 0 | |
ipv6 ospf6 transmit-delay 1 | |
ipv6 ospf6 instance-id 0 | |
! | |
interface lo | |
ipv6 ospf6 cost 1 | |
ipv6 ospf6 hello-interval 1 | |
ipv6 ospf6 dead-interval 4 | |
ipv6 ospf6 retransmit-interval 5 | |
ipv6 ospf6 priority 0 | |
ipv6 ospf6 transmit-delay 1 | |
ipv6 ospf6 instance-id 0 | |
! | |
router ospf6 | |
router-id 206.xx.253.59 | |
interface lo area 0.0.0.0 | |
interface eth0 area 0.0.0.0 | |
interface eth1 area 0.0.0.0 | |
! |
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
interface eth0 | |
ip ospf hello-interval 1 | |
ip ospf dead-interval 4 | |
ip ospf priority 0 | |
! | |
interface eth1 | |
ip ospf hello-interval 1 | |
ip ospf dead-interval 4 | |
ip ospf priority 0 | |
! | |
interface lo | |
! | |
router ospf | |
ospf router-id 206.xx.253.59 | |
network 206.xx.232.240/32 area 0.0.0.0 | |
network 206.xx.253.16/28 area 0.0.0.0 | |
network 206.xx.253.32/28 area 0.0.0.0 | |
network 206.xx.253.59/32 area 0.0.0.0 | |
network 209.xx.3.240/32 area 0.0.0.0 | |
! |
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
#! /usr/bin/launchtool -C | |
tag = supervise-dns | |
daemon = yes | |
user = root | |
silent restart time = 4 | |
silent restart status = 0 | |
command = /usr/local/sbin/advertise.sh | |
log child output = LOG_DAEMON,LOG_INFO | |
log launchtool output = LOG_DAEMON,LOG_INFO | |
log child errors = LOG_DAEMON,LOG_ERR | |
log launchtool errors = LOG_DAEMON,LOG_ERR |
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
server: | |
interface: 0.0.0.0 | |
interface: ::0 | |
interface-automatic: yes | |
outgoing-interface: 209.xx.253.59 | |
outgoing-interface: 2001:xx::1:61 | |
access-control: 2001:xx::/32 allow | |
access-control: 209.xx.0.0/17 allow | |
access-control: 206.xx.128.0/18 allow | |
access-control: 206.xx.224.0/19 allow | |
chroot: "" | |
hide-identity: no | |
hide-version: no | |
version: "xxdns0.1" | |
auto-trust-anchor-file: "/etc/unbound/root.key" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment