@@ -5,9 +5,9 @@ function consul-install() {
5
5
6
6
arch=$( lscpu | grep " Architecture" | awk ' {print $NF}' )
7
7
if [[ $arch == x86_64* ]]; then
8
- ARCH=" amd64"
8
+ ARCH=" amd64"
9
9
elif [[ $arch == aarch64 ]]; then
10
- ARCH=" arm64"
10
+ ARCH=" arm64"
11
11
fi
12
12
echo -e ' \e[38;5;198m' " CPU is $ARCH "
13
13
@@ -123,33 +123,36 @@ EOF
123
123
consul kv put fabio/config/countdashtest1 " route add countdashtest fabio.service.consul:9999/countdashtest http://10.9.99.10:9022/ opts \" strip=/countdashtest\" "
124
124
consul kv put fabio/config/docsify " route add docsify docsify.service.consul:9999/ http://10.9.99.10:3333"
125
125
126
- echo -e ' \e[38;5;198m' " ++++ Adding Consul for DNS lookups"
127
- # https://learn.hashicorp.com/tutorials/consul/dns-forwarding#systemd-resolved-setup
128
- mkdir -p /etc/systemd/resolved.conf.d/
129
- cat << EOF | sudo tee /etc/systemd/resolved.conf.d/consul.conf
130
- [Resolve]
131
- DNS=127.0.0.1
132
- DNSSEC=false
133
- Domains=~consul
126
+ echo -e ' \e[38;5;198m' " ++++ Install DNSMasq"
127
+ sudo systemctl disable systemd-resolved
128
+ sudo systemctl stop systemd-resolved
129
+ sleep 10;
130
+ sudo apt-get install -y dnsmasq
131
+ echo -e ' \e[38;5;198m' " ++++ Adding DNSMasq config for Consul for DNS lookups"
132
+ # https://learn.hashicorp.com/tutorials/consul/dns-forwarding#dnsmasq-setup
133
+ cat << EOF | sudo tee /etc/dnsmasq.d/10-consul
134
+ # Enable forward lookup of the 'consul' domain:
135
+ server=/consul/10.9.99.10#8600
136
+
137
+ # Uncomment and modify as appropriate to enable reverse DNS lookups for
138
+ # common netblocks found in RFC 1918, 5735, and 6598:
139
+ #rev-server=0.0.0.0/8,127.0.0.1#8600
140
+ #rev-server=10.0.0.0/8,127.0.0.1#8600
141
+ #rev-server=100.64.0.0/10,127.0.0.1#8600
142
+ #rev-server=127.0.0.1/8,127.0.0.1#8600
143
+ #rev-server=169.254.0.0/16,127.0.0.1#8600
144
+ #rev-server=172.16.0.0/12,127.0.0.1#8600
145
+ #rev-server=192.168.0.0/16,127.0.0.1#8600
146
+ #rev-server=224.0.0.0/4,127.0.0.1#8600
147
+ #rev-server=240.0.0.0/4,127.0.0.1#8600
134
148
EOF
135
-
136
- iptables --table nat --append OUTPUT --destination localhost --protocol udp --match udp --dport 53 --jump REDIRECT --to-ports 8600
137
- iptables --table nat --append OUTPUT --destination localhost --protocol tcp --match tcp --dport 53 --jump REDIRECT --to-ports 8600
138
- iptables -vnL -t nat| grep 8600
139
-
140
- echo -e ' \e[38;5;198m' " ++++ Restart systemd-resolved"
141
- systemctl restart systemd-resolved
149
+ sudo systemctl restart dnsmasq
142
150
143
- echo -e ' \e[38;5;198m' " ++++ Validate the systemd-resolved configuration"
151
+ echo -e ' \e[38;5;198m' " ++++ Set /etc/resolv.conf configuration"
144
152
cat << EOF | sudo tee /etc/resolv.conf
145
- nameserver 127.0.0.1
153
+ nameserver 10.9.99.10
146
154
nameserver 8.8.8.8
147
155
EOF
148
- systemctl is-active systemd-resolved
149
- resolvectl domain
150
- resolvectl query consul.service.consul
151
- ls -l /etc/resolv.conf
152
- host consul.service.consul
153
156
154
157
echo -e ' \e[38;5;198m' " ++++ Consul http://localhost:8500"
155
158
echo -e ' \e[38;5;198m' " ++++ Consul Documentation http://localhost:3333/#/hashicorp/README?id=consul"
0 commit comments