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

Forward intranet requests to router? #643

Closed
colindean opened this issue Aug 31, 2016 · 18 comments
Closed

Forward intranet requests to router? #643

colindean opened this issue Aug 31, 2016 · 18 comments
Labels
Feature Request General Feature Requests

Comments

@colindean
Copy link

colindean commented Aug 31, 2016

I have an internal naming scheme, like mylaptop.myhome.myname.com and mynas.myhome.myname.com. myname.com resolves publicly, but only my router resolves myhome.myname.com and only internally.

Expected Behaviour:

When I visit mynas.myhome.myname.com, I expect it to resolve and load.

Actual Behaviour:

My internal domain no longer resolves. The pihole seems to do the external lookup.

Steps to reproduce this issue:

Fresh, ootb configuration, with my router sending the pihole and the router as DNS servers in that order.

The central question

Can I do one of:

  1. Configure my router to tell clients to ask it for DNS first and for internal domains only?
  2. Somehow have the router point to the pihole for DNS? I think this is doable and I'm going to try that this evening.
  3. Have the pihole forward requests to the router when it fails a lookup?

I'm using an ASUS RT-N66U running a recent build of Merlin firmware, if that matters. I'm not afraid to tinker!

Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

@PromoFaux
Copy link
Member

I'm not afraid to tinker!

Then we'll begin..!

This SHOULD be an easy fix actually, but i might be wrong. You can try adding the host names to /etc/hosts on the pihole machine. e.g:

192.168.1.1    mylaptop    mylaptop.myhome.myname.com
192.168.1.2    mynas    mynas.myhome.myname.com

followed by a sudo service dnsmasq restart and seeing if your client devices resolve then...

@diginc
Copy link
Contributor

diginc commented Aug 31, 2016

If your router is still searching & resolving hostnames on your domain/network (1) then you may be able to forward the entire subdomain (2) onto your router from your pihole. Saving you the step of having to add each DNS entry manually for new PCs or DHCP IP changes.

(1)

# If this works against your router
$ host pc.myhome.myname.com 192.168.1.1

(2)

# Add a file like this
$ cat /etc/dnsmasq.d/forward_internal_domain_to_router.conf
server=/myhome.myname.com/192.168.1.1

# And then after a dnsmasq restart this
$ host pc.myhome.myname.com pi.hole
# should work forward/delegate the request to the router, 

note: $ are commands issued, # are comments, no prefix = return value

@PromoFaux
Copy link
Member

Of course! I was just looking up the server=/x.y.z/1.2.3.4 for soemthing else. Should have clicked then!

@colindean
Copy link
Author

colindean commented Aug 31, 2016 via email

@colindean
Copy link
Author

It looks like in this particular instance, pi.hole is getting blocked, too?

screen shot 2016-09-04 at 12 16 45

@AzureMarker
Copy link
Contributor

That's normal behavior. We can only tell if a domain is blocked if the resolved ip is the Pi-hole's. We could manually exclude that domain from the blocked ones.

@colindean
Copy link
Author

What's interesting is that http://pi.hole/admin resolves at the command line but not in my browser. Maybe my browser's DNS cache is stale?

@AzureMarker
Copy link
Contributor

AzureMarker commented Sep 4, 2016

Command line and browser on the same computer? If so, check out how to clear browser cache. Chrome has it at chrome://net-internals/#dns

@colindean
Copy link
Author

screen shot 2016-09-04 at 18 23 05

It apparently expired while I was away. I didn't even need to flush manually. Working fine now!

@AzureMarker
Copy link
Contributor

Is this issue fixed now?

@colindean
Copy link
Author

Yeah, but I think maybe a feature request has come out of it: the ability to add that forwarding line through the command line or the web interface. That, and it documented, would have prevented this thread from occurring, for the most part.

@AzureMarker
Copy link
Contributor

Ok. You can make an issue on the admin repo, flag as feature request, and link to this issue.

@AzureMarker
Copy link
Contributor

Also, maybe I'll flag this one as a feature request too, since I have a feeling that the command line should be the one to actually contain the functionality. The web interface could be just a front for the command line, like whitelisting and blacklisting.

@trulleberg
Copy link

Not sure if this is the right place, maybe we it should also be possible to forward local requests to the local router?
like:
server=/fritz.box/178.168.192.in-addr.arpa/192.168.178.1

this should make sure that all requests for my local domain and reverse (ip to dns) lookups in my subnet are send to the local router.

@AzureMarker
Copy link
Contributor

Set your router as an upstream DNS server, if it is smart enough to support that. Otherwise, try using Pi-hole's DHCP instead of the router's. Then hostnames are automatically available to Pi-hole (and set new ones in /etc/hosts).

@trulleberg
Copy link

trulleberg commented Jan 7, 2017

Hey,
I did configure my router as upstream DNS, but lookups for private IPs failed!

I think the "bogos-priv" prevents requests from private IPs to be sent to upstream DNS Servers.
So as workaround I removed the bogus-priv from /etc/dnsmasq.d/01-pihole.conf, restarted dnsmasq and it works.

@DL6ER
Copy link
Member

DL6ER commented Jan 7, 2017

Well ...

screenshot at 2017-01-07 10-41-47

You may have to apply this bug fix to have it actually passed to dnsmasq (will be fixed in the next release):
https://github.com/pi-hole/pi-hole/pull/1099/files

@DL6ER DL6ER closed this as completed Jan 16, 2017
@DL6ER
Copy link
Member

DL6ER commented Jan 16, 2017

Fully implemented in admin interface v2.3

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

No branches or pull requests

6 participants