6 Virtual networking Instead, when host-only networking is used, VirtualBox creates a new software interface on the host which then appears next to your existing network interfaces. In other words, whereas with bridged networking an existing physical interface is used to attach virtual machines to, with host-only networking a new “loopback” interface is created on the host. And whereas with internal networking, the traffic between the virtual machines cannot be seen, the traffic on the “loopback” interface on the host can be intercepted. Host-only networking is particularly useful for preconfigured virtual appliances, where multi- ple virtual machines are shipped together and designed to cooperate. For example, one virtual machine may contain a web server and a second one a database, and since they are intended to talk to each other, the appliance can instruct VirtualBox to set up a host-only network for the two. A second (bridged) network would then connect the web server to the outside world to serve data to, but the outside world cannot connect to the database. To change a virtual machine’s virtual network interface to “host only” mode: either go to the “Network” page in the virtual machine’s settings notebook in the graphical user interface and select “Host-only networking”, or on the command line, type VBoxManage modifyvm "VM name" --nicx hostonly see chapter 8.7, VBoxManage modifyvm, page 109 for details. For host-only networking, like with internal networking, you may find the DHCP server useful that is built into VirtualBox. This can be enabled to then manage the IP addresses in the host-only network since otherwise you would need to configure all IP addresses statically. In the VirtualBox graphical user interface, you can configure all these items in the global settings via “File” - “Settings” - “Network”, which lists all host-only networks which are presently in use. Click on the network name and then on the “Edit” button to the right, and you can modify the adapter and DHCP settings. Alternatively, you can use VBoxManage dhcpserver on the command line please see chap- ter 8.33, VBoxManage dhcpserver, page 132 for details. 89
Previous Page Next Page