EMR has components running on internal ip's such as ip-172-23-53-101.ec2.internal. To resolve to the implied public/vpn IP's, setup dnsmasq
(You'll need to do something different on windows. Linux should have another installer.)
$ brew install dnsmasq
$ cp /usr/local/Cellar/dnsmasq/2.80/.bottle/etc/dnsmasq.conf /usr/local/etc/dnsmasq.conf
$ vim /usr/local/etc/dnsmasq.conf # add following to the end of the file
# AWS IPs see - http://stackoverflow.com/questions/28204678/dns-service-to-dynamically-resolve-subdomain-to-a-custom-ip-address
address=/ec2.internal/127.0.0.1
synth-domain=ec2.internal,0.0.0.0,255.255.255.255,ip-
$ sudo brew services start dnsmasq
If networksetup
is a utility on your version you can do something like the following:
$ networksetup -setdnsserver Wi-Fi 127.0.0.1 8.8.8.8 # or whatever dns server you had to begin with
Else, you'll need to modify your network settings in System Preferences -> Network
. For EACH connection, you'll have to:
- Click on the connection in question (LAN, Wi-FI, USB, etc.) to select it
- Click on the "Advanced..." button
- Click on the DNS tab
- If the DNS servers are greyed out, copy them into a text editor (i.e. if they're the default DNS servers as given by your ISP or whatever)
- Add
127.0.0.1
(your new localhost-based dnsmasq server) to your DNS servers list. I recommend adding it after a few other DNS servers because otherwise your local DNS if configured improperly can result in weird behavior on your machine - If at this point you don't have
8.8.4.4
and8.8.8.8
in your DNS list, I suggest adding them. They're google's DNS servers and they're quite reliable. Again, I put these above127.0.0.1
but you do you.
To see this working, open a new terminal window and type the following command (install dig if not present on your machine):
$ dig ip-172-23-53-101.ec2.internal
; <<>> DiG 9.8.3-P1 <<>> @127.0.0.1 ip-172-23-53-101.ec2.internal
; (1 server found)
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 28487
;; flags: qr aa rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 0
;; QUESTION SECTION:
;ip-172-23-53-101.ec2.internal. IN A
;; ANSWER SECTION:
ip-172-23-53-101.ec2.internal. 0 IN A 172.23.53.101
;; Query time: 0 msec
;; SERVER: 127.0.0.1#53(127.0.0.1)
;; WHEN: Mon Mar 13 19:25:03 2017
;; MSG SIZE rcvd: 63
I originally took this from ashee but modified it to work on modern OS X and changed a few things for clarity.