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

DNSCaptivePortal example does not work for me #693

Closed
icodk opened this issue Apr 11, 2016 · 10 comments
Closed

DNSCaptivePortal example does not work for me #693

icodk opened this issue Apr 11, 2016 · 10 comments

Comments

@icodk
Copy link

icodk commented Apr 11, 2016

Compiled fine but does not work as expected.
Get response if explicitly write the IP address in the browser but this is missing the idea of Captive portal.
Looks like the onDefault function is not wired to anything.
What am I missing ?

@patrickjahns
Copy link
Member

It works on my side on a windows laptop aswell as android smartphone without any problem. No matter what domain I enter, I always see the correct page.

In order to be able to help with your issue, please describe your environment as close as possible and ideally a log with debug enabled.

@icodk
Copy link
Author

icodk commented Apr 11, 2016

Yes it works also for me on IPad. Initially tested only on Windows 10. Still I can't get it to work on windows 10. I disconnect my Windows PC from wired LAN then connected wifi to "SMING captive portal"
SSID .Then I opened a browser (Chrome), enter dr.dk in the address line, after a few moments Chrome says: There is no Internet connection and that's it.
BTW how does the onDefault function is being called ? I can see it is called when I test with IPad.
Thanks
Will be back tomorrow (can't sleep at work:-)

@patrickjahns
Copy link
Member

You are correct - server.setDefaultHandler(onIndex); points to onIndex instead of onDefault. But it shouldn`t matter when you try the basedomain without paths for lookup (as you ipad correctly handles it).

Some remarks:
Windows since some versions tests the internet connection by trying to connect to a certain domain and looking 'ncis.txt' - if it doesn`t find it - it assumes that there is no internet connection.
(Similar function in android with /generate_204)
This example is by no means meant to be a use it and everything you ever wish to achieve with a dns captive portal will be set for. It is a means to demonstrate how the implemented DNS server can be put to use

Further remarks:
Windows keeps a DNS cache - and the cache entries only expire/get removed when TTL is reached. Any webpage that is previously visited and the domain is still in cache will simply fail, since it won`t be able to connect to the previously resolved ip address.
Either try entering a non visited domain (even test.test works) - or clear your dns cache ( ipconfig /flushdns in a windows command shell)

@icodk
Copy link
Author

icodk commented Apr 12, 2016

Thanks for the head up. Will try to follow your advice.

@hreintke
Copy link
Contributor

@patrickjahns :
Is there a way to set the TTL in the captive portal so that applications have the possibility to force the remote DNS to refresh more frequently.

@patrickjahns
Copy link
Member

The dnsserver allows for changing the ttl. But only for the domains the
server resolved. I don't know if it is possible to clear the cache of
clients before any request is made.
On Apr 13, 2016 09:06, "hreintke" notifications@github.com wrote:

@patrickjahns https://github.com/patrickjahns :
Is there a way to set the TTL in the captive portal so that applications
have the possibility to force the remote DNS to refresh more frequently.


You are receiving this because you were mentioned.
Reply to this email directly or view it on GitHub
#693 (comment)

@hreintke
Copy link
Contributor

@patrickjahns :
Changing the ttl ot the resolved domains is what I mend.
We used lowing ttl for a period around updating large web applications and make sure that clients request the new page instead of the cached old.

It's up to the client (but also routers/proxys etc) to clear the cache regularly.

@patrickjahns
Copy link
Member

@icodk
any news/results?

@hreintke
I can lower it - what value do you recommend?

I will update the example then and maybe add some more notes in the source or a readme

@icodk
Copy link
Author

icodk commented Apr 29, 2016

@patrickjahns
Had other features to follow. Will return to in future iteration

@hreintke
Copy link
Contributor

@patrickjahns :
I think I mixed up diferent ttl's.
Closing the issue for now.

@hreintke hreintke removed the Review label May 23, 2016
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