Push dhcp-options for Android.
Posted: Thu Oct 27, 2011 1:54 pm
As I am playing with the device, I came to this problem when using "redirect-gateway". Whanting the internet from Android to go thru the tunnel, and mostly, the Android has to use our internal DNS to resolve internally used domains, that are not publically registered. It's a frustration that "dhcp-option DNS" and "dhpc-option WINS" are valid only for windows clients, but for unix clients is needed to create a script. Now I came across to issues. First, what commands are used to set the DNS in Android system, as resolv.conf is not used. The second, is much problematic. Normally Android gets the DNS from the internet provider (3G). As this DNS does not know about our privat domains, the users will not be able to access our internal services thru VPN using provider's DNS servers. Another thing is that provider's DNS is accesible only from Android IP, not thru the tunnel and internet. I can set the google's DNS, but it does not about our privat domain too. I can't even set statically our internal DNS, as when VPN is not accesible, users will not be able to access internet. So, the only resolvation is to use scripts do dinamically set Android DNS to our internal DNS when VPN connection is established, and unset this DNS leaving them to provider's DNS.
Now, suppose I create such script (don't know how for now), for setting DNS on connection, and unsetting on disconnect. The recomended on internet setting is writing to resolv.conf (or other Androids file). Suppose after a succeseful connection, the DNS is set in the file, but the user extracts the battery. So the disconnect script is not invoked. Then the battery is placed back and phone turned on, without connecting to VPN. In such case, user will not have an accesible resolver.
For such a issue it will be a good to set the DNS IP not in Androids configuration file, but some how only in running environment. So on restart the DNS will be the original, like in Windows.
I can set a static DNS in resolv.conf (or other file) to be used, where it is specified in order: our internal DNS, google DNS. Provider's DNS will not be used, as it might change it's IP. If VPN is established, our DNS will be accesible. If VPN is not established, Android will try our DNS, then will try google's DNS. But if the VPN is established, when system is using google's DNS, using of our DNS will not be returned, even it's accesible. Well if I redirect the traffic thru tunnel, I can block access to google's DNS from Android thru tunnel, and the system will return to our DNS. A bad workaround.
To summarize, what is the command to set DNS IP on Android (and Linux) to be only temporar (as in dhcp mode)? And will be implemented "dhcp-option" in future versions?
Now, suppose I create such script (don't know how for now), for setting DNS on connection, and unsetting on disconnect. The recomended on internet setting is writing to resolv.conf (or other Androids file). Suppose after a succeseful connection, the DNS is set in the file, but the user extracts the battery. So the disconnect script is not invoked. Then the battery is placed back and phone turned on, without connecting to VPN. In such case, user will not have an accesible resolver.
For such a issue it will be a good to set the DNS IP not in Androids configuration file, but some how only in running environment. So on restart the DNS will be the original, like in Windows.
I can set a static DNS in resolv.conf (or other file) to be used, where it is specified in order: our internal DNS, google DNS. Provider's DNS will not be used, as it might change it's IP. If VPN is established, our DNS will be accesible. If VPN is not established, Android will try our DNS, then will try google's DNS. But if the VPN is established, when system is using google's DNS, using of our DNS will not be returned, even it's accesible. Well if I redirect the traffic thru tunnel, I can block access to google's DNS from Android thru tunnel, and the system will return to our DNS. A bad workaround.
To summarize, what is the command to set DNS IP on Android (and Linux) to be only temporar (as in dhcp mode)? And will be implemented "dhcp-option" in future versions?