You are not logged in.

#1 2013-04-18 14:55:20

tkbx
Member
Registered: 2013-04-06
Posts: 27

Internet in Virtualbox?

I just installed Arch to a virtualbox VM, and I don't have internet. When I boot arch to my physical machine, I can connect to the internet by removing and adding tg3 and broadcom with modprobe, but I don't imagine this will work under Virtualbox. Can I get internet working in the VM without an internet connection (and if so, how?) or will I need to chroot from the live image again? Can I simply modprobe a few things?

EDIT: Virtualbox is running under Windows 7, and I've already tried `modprobe vboxnetflt`

Last edited by tkbx (2013-04-18 15:27:00)

Offline

#2 2013-04-18 15:40:09

ewaller
Administrator
From: Pasadena, CA
Registered: 2009-07-13
Posts: 12,435

Re: Internet in Virtualbox?

It depends on how you set up VirtualBox.  Inside the VM, you will see virtualized hardware attached to a virtual network.  This virtual network can find its way to the real world through the VBox environment.

When you built your machine, if you set up NAT forwarding, then your Virtual machine can obtain a dynamic address on the virtual network from a virtual DHCP server inside VBox.  Then, VBox will provide NAT services to the outside world.  If, on the other hand, you selected a bridged network, then the VBox software creates a bridge between the Virtual Network and a real network.  In this case, the Virtual Machine will be talking to a gateway / DHCP server on the physical network.

Inside the VM, see what networks you have using ip link, then just try using sudo dhcpcd the_name_of_the_network_from_ip_link and see if that works.  If it does, then set up a netctl to start that as a service so you don't need to to it by hand each time.


Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
Like you, I have no idea what you are doing, but I am pretty sure it is wrong...Jasonwryan
----
How to Ask Questions the Smart Way

Offline

#3 2013-04-18 15:48:15

tkbx
Member
Registered: 2013-04-06
Posts: 27

Re: Internet in Virtualbox?

It was called "enp0s3", and "dhcpcd enp0s3" worked perfectly, but "netctl enable enp0s3" outputs:

Profile 'enp0s3' does not exist or is not readable

Why is this? I can't seem to find any info on that error online.

Offline

#4 2013-04-18 15:55:43

ewaller
Administrator
From: Pasadena, CA
Registered: 2009-07-13
Posts: 12,435

Re: Internet in Virtualbox?

Glad the network is working.

Sorry, my advice on netctl was a little misleading.  Check the netctl article in the wiki.

Reader's digest version: 

# cp /etc/netctl/examples/ethernet-dhcp /etc/netctl/
Then, edit that file (edit: /etc/netctl/ethernet-dhcp, that is) , change the description, change the network name to enp0s3.  Then use netctl to enable ethernet-dhcp.  If your VM has multiple interfaces (you probably have need for this) then pick a new profile name for each NIC.

Last edited by ewaller (2013-04-18 15:56:34)


Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
Like you, I have no idea what you are doing, but I am pretty sure it is wrong...Jasonwryan
----
How to Ask Questions the Smart Way

Offline

#5 2013-04-18 15:56:18

parazyd
Member
From: Amsterdam
Registered: 2012-10-14
Posts: 259
Website

Re: Internet in Virtualbox?

It doesn't matter.

You should enable this:

# systemctl enable dhcpcd@interface_name.service

/EDIT

That way, it will be connected each time you start the VM.

Last edited by parazyd (2013-04-18 15:56:42)

Offline

#6 2013-04-18 21:55:59

DSpider
Member
From: Romania
Registered: 2009-08-23
Posts: 2,273

Re: Internet in Virtualbox?

@parazyd: Exactly, yeah. Like it says in the Beginners' Guide:

https://wiki.archlinux.org/index.php/Be … he_network

You need to configure the network again, but this time for your newly installed environment. The procedure and prerequisites are very similar to the one described above, except we are going to make it persistent and automatically run at boot.

Don't change anything when creating a new Arch VM; leave the Network settings as "NAT" (which is the default setting) and your guest will be fine. It will piggyback on the host's internet settings.

tkbx wrote:

Can I get internet working in the VM without an internet connection (and if so, how?)

No. If the host doesn't have internet access, neither will the guest.


"How to Succeed with Linux"

I have made a personal commitment not to reply in topics that start with a lowercase letter. Proper grammar and punctuation is a sign of respect, and if you do not show any, you will NOT receive any help (at least not from me).

Offline

#7 2013-04-21 15:48:16

tkbx
Member
Registered: 2013-04-06
Posts: 27

Re: Internet in Virtualbox?

DSpider wrote:

@parazyd: Exactly, yeah. Like it says in the Beginners' Guide:

https://wiki.archlinux.org/index.php/Be … he_network

You need to configure the network again, but this time for your newly installed environment. The procedure and prerequisites are very similar to the one described above, except we are going to make it persistent and automatically run at boot.

Don't change anything when creating a new Arch VM; leave the Network settings as "NAT" (which is the default setting) and your guest will be fine. It will piggyback on the host's internet settings.

tkbx wrote:

Can I get internet working in the VM without an internet connection (and if so, how?)

No. If the host doesn't have internet access, neither will the guest.

I wasn't very clear. I was wondering if I could get internet working in the VM without a connection in the VM (if there were drivers that needed to be downloaded or something), but "systemctl dhcpcd@enp0s3.service" worked perfectly.

Offline

#8 2013-04-22 09:46:17

DSpider
Member
From: Romania
Registered: 2009-08-23
Posts: 2,273

Re: Internet in Virtualbox?

tkbx wrote:

I wasn't very clear. I was wondering if I could get internet working in the VM without a connection in the VM (if there were drivers that needed to be downloaded or something), but "systemctl dhcpcd@enp0s3.service" worked perfectly.

You mean:

# systemctl enable dhcpcd@enp0s3.service

Ok. Don't forget to mark the topic as solved (by editing the first post) so that other people (including yourself sometimes) may find useful.


"How to Succeed with Linux"

I have made a personal commitment not to reply in topics that start with a lowercase letter. Proper grammar and punctuation is a sign of respect, and if you do not show any, you will NOT receive any help (at least not from me).

Offline

Board footer

Powered by FluxBB