Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DNS works one my machine, not on a coworkers #132

Closed
MrMMorris opened this issue Feb 8, 2016 · 10 comments
Closed

DNS works one my machine, not on a coworkers #132

MrMMorris opened this issue Feb 8, 2016 · 10 comments

Comments

@MrMMorris
Copy link

So I am trying to get some other developers set up with dinghy, but have ran into a snag.

I can get all the way to when I want to hit my web container using the dinghy dns (blah_web_1.docker). This resolves on my machine, but not my coworkers.

After some digging, the only difference I see is that his dnsmasq process seems a bit different than mine:

Me:
/usr/local/sbin/dnsmasq --no-daemon --listen-address=127.0.0.1 --port=19322 --bind-interfaces --no-resolv --address=/.docker/192.168.99.100

Him:
/usr/local/opt/dnsmasq/sbin/dnsmasq --keep-in-foreground -C /usr/local/etc/dnsmasq.conf

The contents of that conf file are:

address=/.dev/127.0.0.1
listen-address=127.0.0.1
port=35353

I assumed this was something he had set up for something else, so I killed that process and halted/up'd dinghy, but it results in the same process and same issue. He says he doesn't recall using dnsmasq for anything else so maybe dinghy is doing something weird.

Any ideas how to get it to working order? we have the same dinghy versions, but maybe a reinstall?

@MrMMorris MrMMorris changed the title DNS not works one my machine, not on a colleges DNS not works one my machine, not on a coworkers Feb 8, 2016
@MrMMorris MrMMorris changed the title DNS not works one my machine, not on a coworkers DNS works one my machine, not on a coworkers Feb 8, 2016
@codekitchen
Copy link
Owner

Hm a grep of dinghy's code doesn't even find the string --keep-in-foreground, I don't know how that could be coming from dinghy. Check the parent process maybe?

@MrMMorris
Copy link
Author

the ppid is 1 (launchd) on both machines. Can't find anything in launchctl list | grep $pid

@codekitchen
Copy link
Owner

Maybe I should add PIDs to dinghy status output. For now, if brew is installed at /usr/local and you're on the latest dingy release, you can see the dnsmasq PID at /usr/local/Cellar/dinghy/4.2.0/local/var/dinghy-DNS.pid and any logging at /usr/local/Cellar/dinghy/4.2.0/local/var/dinghy-DNS.output

It's got to be something else running that daemon though, it wouldn't make any sense for dinghy to start it up with these parameters. You can see dinghy's launch param code at https://github.com/codekitchen/dinghy/blob/master/cli/dinghy/dnsmasq.rb#L56

@MrMMorris
Copy link
Author

alright, so I found the cause of the dnsmasq weirdness. There was some launchd plist from homebrew that was starting the weird dnsmasq process. Did launchctl unload ~/Library/LaunchAgents/homebrew.mxcl.dnsmasq.plist and it went away. Restarted dinghy and now the dnsmasq process looks the same as mine but it STILL isn't resolving.....

Do we have to reload/reboot/reinstall something? DOCKER_HOST matches the dnsmasq IP and everything seems be exactly the same as my setup now.

Maybe a reinstall is in order?

@codekitchen
Copy link
Owner

Hm, verify that the resolver configuration has been installed:

$ cat /etc/resolver/docker
# Generated by dinghy
nameserver 127.0.0.1
port 19322

If that's there then I'm not sure, not something I've run into before. You could try a reinstall but I'm not optimistic that'll help. Have you rebooted the OSX host?

You can test the dnsmasq daemon with:

$ dig @127.0.0.1 -p 19322 test.docker
...
test.docker.        0   IN  A   192.168.99.101
...

@MrMMorris
Copy link
Author

The resolver looks good.

$ dig @127.0.0.1 -p 19322 test.docker

; <<>> DiG 9.8.3-P1 <<>> @127.0.0.1 -p 19322 test.docker
; (1 server found)
;; global options: +cmd
;; connection timed out; no servers could be reached

@codekitchen
Copy link
Owner

Looks like dinghy's dnsmasq is still either not running or not responding on the expected ip/port.

You said that it looks the same as yours now, which means /usr/local/sbin/dnsmasq --no-daemon --listen-address=127.0.0.1 --port=19322 --bind-interfaces --no-resolv --address=/.docker/192.168.99.100 right? I'm not sure what we're missing then.

@mrmachine
Copy link

My dnsmasq appears to be running with the same command as above, and I can test it directly with the dig command above, but when I just try to browse to foo.docker, it doesn't work. When I just do dig foo.docker or host foo.docker, it doesn't work. Is there something else I am supposed to do to configure OS X to actually use the /etc/resolver/docker config?

~ ❯❯❯ cat /etc/resolver/docker
# Generated by dinghy
nameserver 127.0.0.1
port 19322
~ ❯❯❯ dig @127.0.0.1 -p 19322 test.docker

; <<>> DiG 9.8.3-P1 <<>> @127.0.0.1 -p 19322 test.docker
; (1 server found)
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 51657
;; flags: qr aa rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 0

;; QUESTION SECTION:
;test.docker.           IN  A

;; ANSWER SECTION:
test.docker.        0   IN  A   172.16.144.137

;; Query time: 2 msec
;; SERVER: 127.0.0.1#19322(127.0.0.1)
;; WHEN: Mon Feb 29 20:08:00 2016
;; MSG SIZE  rcvd: 45

~ ❯❯❯ dig test.docker

; <<>> DiG 9.8.3-P1 <<>> test.docker
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NXDOMAIN, id: 63706
;; flags: qr rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 1, ADDITIONAL: 0

;; QUESTION SECTION:
;test.docker.           IN  A

;; AUTHORITY SECTION:
.           60  IN  SOA a.root-servers.net. nstld.verisign-grs.com. 2016022900 1800 900 604800 86400

;; Query time: 111 msec
;; SERVER: 192.168.79.1#53(192.168.79.1)
;; WHEN: Mon Feb 29 20:08:07 2016
;; MSG SIZE  rcvd: 104

~ ❯❯❯ host test.docker
Host test.docker not found: 3(NXDOMAIN)

@MrMMorris
Copy link
Author

@mrmachine Sorry, I didn't post my solution to this...

It may be different for you, but basically what I ended up doing was:

a) uninstalling dnsmasq (it was installed with homebrew)
b) tracking down and deleting any confs (/usr/local/etc/dnsmasq.conf, anything left in /usr/local/Cellar/dnsmasq/), plists (/Library/LaunchDaemons, /Library/LaunchAgents) etc. related to dnsmasq
c) stopping any running dnsmasq process before reinstalling dnsmasq and restarting dinghy

@codekitchen
Copy link
Owner

@mrmachine it's expected that dig test.docker and host test.docker won't work, OSX has its own separate resolver mechanism that a lot of unix utilities such as dig and host aren't aware of. Anything that uses the system resolver like curl or any UI apps (safari, chrome) should be able to resolve the host though. Is there a specific app that isn't finding it, or does it seem to affect everything?

It'd be best to move this discussion to a separate issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants