Let’s start both machines right now and login (for OSBoxes’ images, username is usually “osboxes” and password is “osboxes.org”).
You can easily verify that the virtual instances can access the outside world, for example by typing .
fit=300,211&ssl=1" data-large-file="https://i1com/ Box-host-network-manager.jpg? fit=687,484&ssl=1" class="size-full wp-image-1410" src="https://i1com/ Box-host-network-manager.jpg? resize=687,484&ssl=1" alt="Virtual Box's host network manager showing a new host-only adapter" width="687" height="484" srcset="https://i1com/ Box-host-network-manager.jpg?
w=687&ssl=1 687w, https://i1com/ Box-host-network-manager.jpg? resize=300,211&ssl=1 300w" sizes="(max-width: 687px) 100vw, 687px" data-recalc-dims="1" /, make sure the Adapter 1 is attached to NAT.
To configure that, simply go back to the instance’s network settings, access the Advanced options of the NAT adapter and click on “Port-Forwarding“.
Then create a new rule which you can name “ssh”, set the Host Port to 4001 and the Guest Port to 22. An example of port-forwarding configuration " data-medium-file="https://i1com/ Box-port-forwarding-rules.jpg?Normally Virtual Box will automatically fill the adapter’s name with the “vboxnet0” network we created here above.A screenshot of a Virtual Box’s network settings where a host-only adapter is attached " data-medium-file="https://i0com/ Box-virtual-machine-adapter2-settings.jpg?Port-forwarding easily enables you to access a virtual instance through a specific port.Say for example that your Ansible script needs to access port 22 of your machine in order to work on that Ubuntu Server.This is because only one interface is configured in Ubuntu Server: the one from Adapter 1, which is the NAT adapter.We still need to configure the second network interface to point at our”vboxnet0″ host-only network adapter.A virtual network in the cloud " data-medium-file="https://i0com/ fit=1024,576&ssl=1" / Professional developers know they must test their code before releasing it. But then why not also testing your deployment scripts before using them in production?Ideally, you would test the deployment on a controlled environment.And we’ll probably need to ensure they can access the Internet, to install packages as request by the scripts.So let’s see how you can setup and configure a network of Virtual Box instances, with static IP addresses and Internet access.