How to configure DNS settings in Android x86?

6,271 views
Skip to first unread message

Igor Forca

unread,
Oct 24, 2014, 7:37:22 AM10/24/14
to andro...@googlegroups.com
Hi,
I have downloaded android-x86-4.4-RC2.iso from http://sourceforge.net/projects/android-x86/files/Release%204.4/android-x86-4.4-RC2.iso/download and installed it as virtual machine on VMware ESX. Now I am having trouble to configure network settings on Android. I would like to configure wired network settings. In our company we use static IP addresses (so no dhcp) and also DNS settings has to be configured manually.

I opened a new empty file in Vim editor and typed in the following commands:
ifconfig eth0 <Android_IP_address> netmask 255.255.255.0
route add default gw <gateway_IP_address> dev eth0
setprop net.dns1 <DNS_server_IP_address>

I made file executable and executed the file and I tried the following:
1. Inside Android: ping <Android_IP_address> Works fine.
2. Inside Android: ping
<gateway_IP_address> Works fine.
3.
Inside Android: ping <DNS_server_IP_address> Works fine.
4. Inside Android: ping <my_PC_IP_address> Works fine.
5. Inside Android: ping <my_www_server_IP address> Works fine.
6. Inside Android: ping <my_www_server_domain_name> and I get error:
ping: unknown host <my_www_server_domain_name>
7. Inside Android web browser Browser application typed in
<my_www_server_IP address> Works fine.
8.
Inside Android web browser Browser application typed in <my_www_server_domain_name> and I am getting error:
Webpage not available. The web page at <my_www_server_domain_name> might be temporarily down or it may have moved permanently to new web address.

Note: From my PC I can do all of the above tests successfully (including pinging Android virtual machine) successfully. So I assume problem is on Android virtual machine.

It looks like the setting:
setprop net.dns1 <DNS_server_IP_address>
does not work or something. Beside above command I also tried:
setprop net.eth0.dns1 <DNS_server_IP_address>
and
setprop net.dns1 8.8.8.8
and
setprop net.eth0.dns1 8.8.8.8

Note: On adding 8.8.8.8 Googles DNS server I have used: ping www.google.com and get the same unknown host error.

I have searched the web for this problem, but I just can't find any solution for this problem. Any help is appreciated.

It looks to me that DNS settings are not recognized.

I also added above commands to /etc/init.sh file to get settings automatically set after reboot, but checking the settings with command: ip a  and none of the settings is excepted.

So having two problems:
1. How to configure DNS settings in Android x86?
2. How to store them in away when Android x86 is booted settings are automatically applied?

Thanks

Igor Forca

unread,
Oct 27, 2014, 7:08:41 AM10/27/14
to andro...@googlegroups.com
I now installed Android 4.4 r1 released on august 2014 from http://sourceforge.net/projects/android-x86/files/Release%204.4/android-x86-4.4-r1.iso/download and the problem is exactly the same.

Chih-Wei Huang

unread,
Oct 27, 2014, 8:15:19 AM10/27/14
to Android-x86
If you are using vm, just configure the network of your vm
to be NAT. Then dhcp will work.


--
Chih-Wei
Android-x86 project
http://www.android-x86.org

Antony Stone

unread,
Oct 27, 2014, 8:19:23 AM10/27/14
to andro...@googlegroups.com
On Monday 27 October 2014 at 13:15:08 (EU time), Chih-Wei Huang wrote:

> 2014-10-27 19:08 GMT+08:00 Igor Forca <igo...@gmail.com>:
> > I now installed Android 4.4 r1 released on august 2014 from
> > http://sourceforge.net/projects/android-x86/files/Release%204.4/android-x
> > 86-4.4-r1.iso/download and the problem is exactly the same.
>
> If you are using vm, just configure the network of your vm
> to be NAT. Then dhcp will work.

The original question stated:

"I would like to configure wired network settings. In our company we use static
IP addresses (so no dhcp) and also DNS settings has to be configured manually."

It does not seem as though the VM settings are the problem (because IP
communications are working) - it's DNS resolution on Android-x86 which isn't
working.

Hope that helps to clarify.


Antony.

--
In Heaven, the beer is Belgian, the chefs are Italian, the supermarkets are
British, the mechanics are German, the lovers are French, the entertainment is
American, and everything is organised by the Swiss.

In Hell, the beer is American, the chefs are British, the supermarkets are
German, the mechanics are French, the lovers are Swiss, the entertainment is
Belgian, and everything is organised by the Italians.

Please reply to the list;
please *don't* CC me.

Chih-Wei Huang

unread,
Oct 27, 2014, 8:23:32 AM10/27/14
to Android-x86
2014-10-27 20:18 GMT+08:00 Antony Stone <Antony...@android.open.source.it>:
> On Monday 27 October 2014 at 13:15:08 (EU time), Chih-Wei Huang wrote:
>
>> 2014-10-27 19:08 GMT+08:00 Igor Forca <igo...@gmail.com>:
>> > I now installed Android 4.4 r1 released on august 2014 from
>> > http://sourceforge.net/projects/android-x86/files/Release%204.4/android-x
>> > 86-4.4-r1.iso/download and the problem is exactly the same.
>>
>> If you are using vm, just configure the network of your vm
>> to be NAT. Then dhcp will work.
>
> The original question stated:
>
> "I would like to configure wired network settings. In our company we use static
> IP addresses (so no dhcp) and also DNS settings has to be configured manually."
>
> It does not seem as though the VM settings are the problem (because IP
> communications are working) - it's DNS resolution on Android-x86 which isn't
> working.

By configuring vm network to be NAT,
that means the host works as a NAT router
and DHCP server.
It's nothing to do with if the host uses DHCP or static ip.

Igor Forca

unread,
Oct 27, 2014, 1:52:43 PM10/27/14
to andro...@googlegroups.com
@Chih-Wei Huang, in my humble opinion NATnetwork can only be set in WMware Workstation, but we are using server professional virtualization WMware ESX where there is no build-in NAT network. I am not a virtualization administrator and I for sure know they will not gonna accept any kind of virtual network 'hacking'.

Is there any other way to solve my DNS settings problem inside Android virtual machine without hacking virtual network outside of virtual machine?

Nilesh Akhade

unread,
Mar 10, 2015, 8:45:08 PM3/10/15
to andro...@googlegroups.com
I too facing same problem. Moreover I tested typing IP address of google.com into Android browser. Its fine. But after I click search.. Webpage Not Available. Its clear that its problem in dns.
Somebody please help. # setprop net.eth0.dns1 8.8.8.8

Chih-Wei Huang

unread,
Mar 11, 2015, 10:11:49 PM3/11/15
to Android-x86
2015-03-10 22:03 GMT+08:00 Nilesh Akhade <akhaden...@gmail.com>:
>
> I too facing same problem. Moreover I tested typing IP address of google.com into Android browser. Its fine. But after I click search.. Webpage Not Available. Its clear that its problem in dns.
> Somebody please help. # setprop net.eth0.dns1 8.8.8.8

Should be

setprop net.dns1 8.8.8.8

Could you ping 8.8.8.8 successfully?
Have you tried other dns server provided by your ISP?

Generally speaking you don't need to set the dns.
It should be configured automatically unless
your DHCP is broken.

Ivan Ignatyev

unread,
Apr 20, 2015, 9:12:58 PM4/20/15
to andro...@googlegroups.com
I also have that broken. Android 4.4 r2 just downloaded. I'm running it from live-usb on the real hardware in the real network with working dhcp.
so outputs:
#ping 8.8.8.8
Ping 8.8.8.8 (8.8.8.8) 56(84) bytes of data:
64 bytes from 8.8.8.8 : icmp seq=1 ttl=56 time=62.9ms
....
#getprop |grep dns
[dhcp.eth0.dns1] : 192.168.220.7
[dhcp.eth0.dns2] : 192.168.220.5
[dhcp.eth0.dns3] : 192.168.220.53
[dhcp.eth0.dns4] : []
[net.change] :[net.dns1]
[net.dns1] : 8.8.8.8
[net.eth0.dns1] : 192.168.220.7
#nslookup google.com 8.8.8.8
Server : 8.8.8.8
Address 1: 8.8.8.8
nslookup: can't resolve 'google.com'

As you see, I tried setprop net.dns1 8.8.8.8 and setprop net.eth0.dns1 8.8.8.8 Also my dhcp dnses seem working. Still I cannot resolve any name.
Any other info needed?
Any ideas how to fix it?

On Thursday, March 12, 2015 at 5:11:49 AM UTC+3, Chih-Wei Huang wrote:

Mexus

unread,
Apr 21, 2015, 5:51:27 AM4/21/15
to andro...@googlegroups.com
Hello,

this worked for me

ndc resolver flushif \\this was not required but you can try if it wont work
ndc resolver flushdefaultif   \\this was not required but you can try if it wont work
ndc resolver setifdns eth0 "" 8.8.8.8  8.8.8.4
ndc resolver setdefaultif eth0

cheers

Jim Campanell

unread,
Apr 27, 2015, 7:14:10 PM4/27/15
to andro...@googlegroups.com
Also having these issues on an Intel NUC device.  Funny thing, the pre-compiled iso for this version seems to work for me.  It's when I do my own build that I have issues.  Ultimately, I HAVE to use my own build as I'm going to be making customizations to SystemUI.  I don't suppose there are any tricks used to produce these released builds (he said hopefully, not really expecting that to be the case)?

The ndc commands don't work for me.  All of them return:

    Error connecting (no such file or directory)

Further searches online led me here:

http://android.stackexchange.com/questions/62081/how-to-change-mobile-connectionss-dns-on-android-kitkat

Basically, they're saying 4.3+ doesn't use the setprop method of setting dns anymore.  We're supposed to be using these ndc calls.  (One answer specified an iptables solution, but that didn't work for me either.)  But my issue appears to be that I don't have the requisite /dev/socket/netd device file.  Which implies something else isn't running, maybe?

Thanks for any clues...
Reply all
Reply to author
Forward
Message has been deleted
0 new messages