androd-x86 on virtualbox with dual network adapters

659 просмотров
Перейти к первому непрочитанному сообщению

Vincent Li

не прочитано,
6 мар. 2015 г., 10:46:3106.03.2015
– andro...@googlegroups.com
Hi,
I'm trying to run lollipop-x86 on virtualbox with dual network adapters.

first adapter is host-only
second adapter is NAT

And I add necessary netcfg commands in the init.sh init function as:

netcfg eth0 up
netcfg eth0 dhcp
netcfg eth1 up
netcfg eth1 dhcp

and in init.x86.rc, I modified dhcpcd service from eth0 to eth1.

after android started,  ALT+F1 and run netcfg, it showed that

eth0 is 192.168.56.101
eth1 is 10.0.3.2

From host, tried to ping 192.168.56.101, the result was no response, not reachable.

I went back to android vbox again and "netcfg eth1 down"

then from host, tried to ping 192.168.56.101 again, this time it succeeded.

I think this is has something to do with route configuration.
But I am confused about how to fix it.
Any ideas?
Many thanks.



Antony Stone

не прочитано,
6 мар. 2015 г., 10:51:3106.03.2015
– andro...@googlegroups.com
On Friday 06 March 2015 at 16:46:31 (EU time), Vincent Li wrote:

> Hi,
> I'm trying to run lollipop-x86 on virtualbox with dual network adapters.
>
> first adapter is host-only
> second adapter is NAT

> eth0 is 192.168.56.101
> eth1 is 10.0.3.2
>
> From host, tried to ping 192.168.56.101, the result was no response, not
> reachable.
>
> I went back to android vbox again and "netcfg eth1 down"
>
> then from host, tried to ping 192.168.56.101 again, this time it succeeded.

What's the IP address of the host?

What does the routing table on the host show?

What does the routing table on the Android guest show:

a) when both interfaces are up?
b) when eth1 is down?

Finally, does it make any difference if you bring the interfaces up in the
other order - eth1 first and then eth0?


Regards,


Antony.

--
"I find the whole business of religion profoundly interesting. But it does
mystify me that otherwise intelligent people take it seriously."

- Douglas Adams

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

Will

не прочитано,
20 окт. 2015 г., 02:13:0120.10.2015
– Android-x86
Hi,
I'm trying to do something similar to Vincent Li. In vbox I configure the first network (eth0) in bridge mode and the second (eth1) host-only.
This configuration works fine using 2.2-r2, 4.2, 4.4-41 and 4.4-r3, etc: eth0 comes up with an ip address and uses the dns server to resolve names. 
I configure the host only like this:

# ifconfig eth1 192.168.56.2 netmask 255.255.255.0 up

and it works great - host and guest can ping each other on 192.168.56, adb works, etc. I don't need to make any firewall rules or other changes.

When I use same config on lollipop host and guest cannot ping each other. Here's eth0 (bridge)
# ip route
default via 192.168.2.3 dev eth0 metric 204
192.168.2.0/24 dev eth0 proto kernel scope link src 192.168.2.27 metric 204

# ifconfig eth1 192.168.56.2 netmask 255.255.255.0 up
# ip route
default via 192.168.2.3 dev eth0 metric 204
192.168.2.0/24 dev eth0 proto kernel scope link src 192.168.2.27 metric 204
192.168.56.0/24 dev eth1 proto kernel scope link src 192.168.56.2
#ip route get 192.168.56.1
192.168.56.1 via 192.168.2.3 dev eth0 src 192.168.2.27

Note that the route to 192.168.56.1 goes through the wrong interface - eth0 - instead of eth1, so host and guest can't ping each other on 192.168.56

If I switch the nics - make the first one host only and second bridge - neither interface gets an ip address by default at boot:

# ip route
#

The bridge doesn't get ip addr from dhcp. I can use the ifconfig command from above:

# ifconfig eth0 192.168.56.2 netmask 255.255.255.0 up
# ifconfig eth1 192.168.2.105 netmask 255.255.255.0 up

and then get this:

# ip route
192.168.2.0/24 dev eth1  proto kernel  scope link  src 192.168.2.105
192.168.56.0/24 dev eth0  proto kernel  scope link  src 192.168.56.2
# ip route get 192.168.56.1
192.168.56.1 dev eth0 src 192.168.56.2
# ip route get 192.168.2.10
192.168.2.10 dev eth1 src 192.168.2.105

and guest and host can ping each other.

When I make eth0 bridged it uses dhcp to acquire an ip address and dns server address. But when I make the local host eth0 and bridge eth1, eth1 does not get an ip address and dns server address.

I'd be grateful if someone could tell me how to configure things so that eth1 comes up configured with an ip address and dns server like it does as eth0.

Barring that, I'd like to know how to configure eth1 manually for dns. I added an entry to resolv.conf but it has no effect that I can see:
# cat /etc/resolv.conf
nameserver 192.168.2.10
# ip route get 192.168.2.10
192.168.2.10 dev eth1 src 192.168.2.105

I can ping all the machines on 192.168.2 using their ip addresses but dns isn't working. It's fine on earlier versions - 2.2, 4.2, 4.4, etc.

Will
Ответить всем
Отправить сообщение автору
Переслать
0 новых сообщений