3

Lately, for the purpose of smoke-testing the Perl 5 core distribution, I have been using VirtualBox to install VMs of various versions of FreeBSD on a Linux x86_64 host.

In my first attempt at doing so, I followed the (very good) instructions provided by the FreeBSD Foundation on installing that in a virtual box. I downloaded FreeBSD-10.3-RELEASE-amd64-disc1.iso and use it for the basis of creating a VBox. I don't recall the exact steps I took to guarantee that the VM had network access, but I do know that I have been able to use customary network programs (ping, scp, sftp, curl, git, ...) successfully.

Today I needed to install a more recent version of FreeBSD, FreeBSD-12.0-CURRENT. This version does not have a .iso file yet, so I worked from FreeBSD-12.0-CURRENT-amd64.vmdk.xz. After de-compressing that file I used the instructions here to create a new VM, I successfully booted FreeBSD-12.0-CURRENT, but it quickly became apparent that I did not have Internet access. 'ping' failed to find google.com.

Following the instructions here as root I called ifconfig, called dhclient em0, then noted that I now had internet access. I was then able to call pkg install pkg and proceed from there to install other packages. I added a non-root user, logged out as root and logged in as that user, and noted that that user had Internet access as well.

I then powered down the VM. When I rebooted, I discovered that I no longer had network access. As root, I once again called dhclient em0 and got Internet access for both users.

So what I want to learn is how to retain the effect of dhclient em0 permanently -- i.e., across shutdowns and reboots of the VM.

0

1 Answer 1

4

I guess that adding ifconfig_em0="DHCP" to /etc/rc.conf should suit your needs.

This way the em0 interface will try to automatically connect to the network.

See the 29.3.3.1.2 Basic Settings chapter in the FreeBSD handbook for more information.

0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .