You are not logged in.
I'm building an Arch based portable web development environment in VirtualBox and I can't get NAT and Host-only network interfaces to cooperate.
My configuration is as follows:
[root@devbox ~]# cat /etc/network.d/main
CONNECTION='ethernet'
DESCRIPTION='A basic dhcp ethernet connection using iproute'
INTERFACE='eth0'
IP='dhcp
[root@devbox ~]# cat /etc/network.d/vbox
CONNECTION='ethernet'
DESCRIPTION='VirtualBox Host-only network'
INTERFACE='eth1'
IP='static'
ADDR='10.10.0.3'
GATEWAY='10.10.0.1'
DNS=('10.10.0.1')
In VirtualBox I have 2 active network adapters:
*Adapter1 = NAT
*Adapter2 = Host-only adapter (vboxnet0: IPv4 Address: 10.10.0.1, mask: 255.255.255.0, DHCP off)
Since I use netcfg I've disabled the default network daemon in rc.conf.
So, when I start the 'main' profile, the network comes up and works flawlessly.
But when I start the 'vbox' profile, the internet isn't reachable anymore - can't ping google.com, unknown host
ifconfig shows eth0 and eth1 active, as expected.
If I stop the 'vbox' profile, eth0 works again.
The 'vbox' profile is necessary for ssh-ing into the VM from the host. When 'vbox' is active, ssh-ing into the VM works as expected but is unusable because the outside isn't reachable.
Any ideas?
Last edited by andrej (2012-04-01 09:12:12)
Offline
Check what happens to the routing table after you've enabled both interfaces ("ip route"). Could be that you're just going to have to set up some static routes (10.10.0.0/24 over eth1, all the rest over eth0 if I understand your explanation correctly).
Burninate!
Offline
Thanks Gcool
ip route gives me this:
[root@devbox ~]# ip route
default via 10.10.0.1 dev eth1
default via 10.0.2.2 dev eth0 metric 202
10.0.2.0/24 dev eth0 proto kernel scope link src 10.0.2.15 metric 202
10.10.0.0/24 dev eth1 proto kernel scope link src 10.10.0.3
I've never messed with routing before. Could you tell me how to set this up, please?
Offline
default via 10.10.0.1 dev eth1
That's the culprit. You basically have 2 default gateway routes.
If you only need that eth1 interface to connect to your VM from your host, try removing the "GATEWAY='10.10.0.1'" section from /etc/network.d/vbox. That should stop the creation of the unnecessary default gateway route.
Burninate!
Offline
Thanks man, I owe you a beer
Also had to remove the DNS from /etc/network.d/vbox
Offline