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.