sivachinnayan / consul-cluster-setup

setup consul cluster setup
MIT License
0 stars 0 forks source link

DNS Forwarding to localbox #7

Open sivachinnayan opened 8 years ago

sivachinnayan commented 8 years ago

How to do DNS forwaring to LocalBox using Vagrant Setup.

  1. You would needs to port forward both UDP/TCP from vagrant to localhost

By Default port 8600 is defined for DNS query. and 8500 for REST - Consul

https://github.com/sivachinnayan/consul-cluster-setup/blob/master/Vagrantfile#L32-L40

UDP_PORTS_LIST={
  "8500" => 8500, # Some service
  "8600" => 8600 # VNC
}

TCP_PORTS_LIST={
  "8600" => 8600, # VNC
  "8500" => 8500 # Some service
}

https://github.com/sivachinnayan/consul-cluster-setup/blob/master/Vagrantfile#L55-L60


      UDP_PORTS_LIST.each do |guest, host|
          node1.vm.network "forwarded_port", guest: "#{guest}", host: "#{host}", protocol: "udp"
      end
      TCP_PORTS_LIST.each do |guest, host|
          node1.vm.network "forwarded_port", guest: "#{guest}", host: "#{host}", protocol: "tcp"
      end
siva@$ dig @127.0.0.1 -p 8600 agent-one.node.consul

; <<>> DiG 9.9.5-3ubuntu0.8-Ubuntu <<>> @127.0.0.1 -p 8600 agent-one.node.consul
; (1 server found)
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 39695
;; flags: qr aa rd; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 0
;; WARNING: recursion requested but not available

;; QUESTION SECTION:
;agent-one.node.consul.     IN  A

;; ANSWER SECTION:
agent-one.node.consul.  0   IN  A   172.20.20.10

;; Query time: 0 msec
;; SERVER: 127.0.0.1#8600(127.0.0.1)
;; WHEN: Fri Aug 26 10:46:15 IST 2016
;; MSG SIZE  rcvd: 76

siva@$ dig @127.0.0.1 -p 8600 agent-two.node.consul

; <<>> DiG 9.9.5-3ubuntu0.8-Ubuntu <<>> @127.0.0.1 -p 8600 agent-two.node.consul
; (1 server found)
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 11696
;; flags: qr aa rd; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 0
;; WARNING: recursion requested but not available

;; QUESTION SECTION:
;agent-two.node.consul.     IN  A

;; ANSWER SECTION:
agent-two.node.consul.  0   IN  A   172.20.20.11

;; Query time: 0 msec
;; SERVER: 127.0.0.1#8600(127.0.0.1)
;; WHEN: Fri Aug 26 10:46:30 IST 2016
;; MSG SIZE  rcvd: 76

siva@$ dig @127.0.0.1 -p 8600 agent-three.node.consul

; <<>> DiG 9.9.5-3ubuntu0.8-Ubuntu <<>> @127.0.0.1 -p 8600 agent-three.node.consul
; (1 server found)
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 42923
;; flags: qr aa rd; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 0
;; WARNING: recursion requested but not available

;; QUESTION SECTION:
;agent-three.node.consul.   IN  A

;; ANSWER SECTION:
agent-three.node.consul. 0  IN  A   172.20.20.12

;; Query time: 0 msec
;; SERVER: 127.0.0.1#8600(127.0.0.1)
;; WHEN: Fri Aug 26 10:46:35 IST 2016
;; MSG SIZE  rcvd: 80

siva@:~/$