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

Set DNS on boot/IP change #1

Open
bparmentier opened this issue Nov 24, 2014 · 17 comments
Open

Set DNS on boot/IP change #1

bparmentier opened this issue Nov 24, 2014 · 17 comments

Comments

@bparmentier
Copy link
Owner

Currently, DNS servers are overridden after each reboot/IP change/reconnection. We should find a method to make it persistent.
I tried adding the setprop commands in /system/etc/dhcpcd/dhcpcd-hooks/20-dns.conf but this script doesn't seem to be called.

@breversa
Copy link

breversa commented Dec 2, 2014

Alternatively, if DNSsetter could remember the DNS servers IPs instead of having to input them each and every time, that would be a start. :-)

Applying the changes would then only require the tap of one button. :-)

@mimi89999
Copy link

The "Set DNS on boot" feature would be useful.

@revuwa
Copy link

revuwa commented Sep 7, 2015

The app https://github.com/otakuchiyan/DNSman has the feature to survive a reboot and / or a (mobile data) IP change. Probably you could borrow some relevant code snippets, if you like.

@ZatsuneNoMokou
Copy link

@revuwa This app (DNSman) only work on wifi networks, because of some Android "security" things. I see that on the description of DNS man on F-Droid
But one thing that could be useful, is a widget / shortcut that could re-apply the last used DNS. That way, it could be much faster to do it than opening the app each time we need to re-change the DNS.

@revuwa
Copy link

revuwa commented Sep 12, 2015

@fullinterest Thanks, but how did you hit on that? I'm using DNSman for my 3G mobile data connection for some weeks now, without any problems.
I'm interested on where did you see the "[...] some Android 'security' things" part exactly?
IMHO the F-Droid description is mistakable, and for sure just took from the initializing thread owner: https://f-droid.org/forums/topic/dns-man/

AFAIK to use your own DNS server(s) on Wi-Fi, you could simply set it through the Wi-Fi connection settings and don't need an app for that. So mobile data should be the target in my eyes. But if you travel your connection interrupts very often and resets the DNS servers to the provider default ones. So IMHO, a widget or shortcut doesn't make sense to me. (Just in case you want to use the app for your Wi-Fi DNS instead; but like I said, this shouldn't be the use case, or am I wrong)?

@ZatsuneNoMokou
Copy link

I don't remember where I saw, but I remember that there's reason that they don't put a setting to change settings on mobile data, unlike wifi networks.

And don't know how it work, but currently, on my phone using f-droid 0.96, the description DNS man is "Change the used DNS server for specific wifi networks."

I just don't stay for long on WiFi network, so each time I switch on and off, the dns get changed again.

@bparmentier
Copy link
Owner Author

It should be possible to receive a broadcast intent each time there is a change in connectivity and execute the setprop commands.

I will try to implement this, but as this app doesn't seem to work anymore on my phone with the currently used method, I can't really test it.

@ZatsuneNoMokou
Copy link

Well, I did that in another way, I did a sh script, and I use SManager that allow to execute as root script on Net change events.

You know how the ndc method works?

@bparmentier
Copy link
Owner Author

So I guess that's what the app you mention does: it registers a broadcast receiver for android.net.conn.CONNECTIVITY_CHANGE and execute your script. The principle is the same.

I didn't have much success with the ndc method for now as it is not documented anywhere, but I listed the commands in the wiki, for each Android version.

@ZatsuneNoMokou
Copy link

And the setprop way will be removed in the future? Because you say it doesn't work on your phone

@bparmentier
Copy link
Owner Author

From what I read, DNS is managed by the netd daemon now (since Kit Kat, or around). You can interact with this daemon through the ndc command.

The property-based method does not seem to be used anymore (you could retrieve the dns values with getprop). But what is weird is that the net.dns[0-1] properties are still set when the connection change (I'm on Lollipop).

What Android version are you running ?

@ZatsuneNoMokou
Copy link

I'm running 4.4.4 version of android

@bparmentier
Copy link
Owner Author

And setprop is working for you?

@ZatsuneNoMokou
Copy link

Well, the setprop seem to be able to define the dns because getprop (and your app) show my custom dns, I dunno if there's a command on android to make sure of the dns used like dig on linux

@bparmentier
Copy link
Owner Author

Our discussion is going off the current issue. I answered you in #6.

I will first fix this issue for people for whom the application works, then I'll try to address the other issue.

@ZatsuneNoMokou
Copy link

Oh, sorry

@oblique
Copy link

oblique commented Mar 13, 2016

Any news about this feature?

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

No branches or pull requests

6 participants