DESK-MX9-L/General/DVDK VirtualBox Network Configuration

From DAVE Developer's Wiki
Jump to: navigation, search
Info Box
VirtualMachine.png Applies to DVDK


200px-Emblem-important.svg.png

This page refers to a specific DESK version in the History table.


History
Issue Date Notes
2024/10/29 Lubuntu 20.04 used on

DESK-MX9-L 5.x.x DESK-MX8M-L 4.x.x DESK-MX6-L 4.x.x DESK-MX6UL-L 4.x.x


200px-Emblem-important.svg.png

Different versions of the MVM may use different graphical interfaces (GNOME Unity, LXDE etc.). Hence, the screenshots on this page may not look the same across all of the MVM versions or releases. However, the concepts described here have a general validity.


VirtualBox Network Configuration[edit | edit source]

VirtualBox networking supports different configurations. For a in-depth discussion regarding virtual networking see VirtualBox official documentation here.

For developing purpose, we are interested in two configuration:

  • NAT, which is the default provided with DVDK
  • Bridged Networking

VirtualBox Network adapters[edit | edit source]

For a typical development network environment, two network adapters can be used: the first one for accessing the Internet through the host network interface (configured as NAT), the second one for providing a static IP address network interface through a bridged network interface.

Network Address Translation (NAT)[edit | edit source]

Network Address Translation is a tecnique used in IP networking that modify IP packet header, by changing IP address, while the routing device processes the packet.

Only the IP address of the routing device (in case of a Virtual Machine, the host ack at router for the guest) is seen from outside. Usually the routed device (in our case, the guest machine) has an IP address that belongs to a completely different IP subnet.

NAT make easy to use a virtual machine because:

  • it does not require to configure guest network parameters (the router act as DHCP server and give all the needed information to the guest)
  • it guarantees that the VM can be executed in any network environment without breaking the existing network.

However it's really hard to configure NAT to let the VM to act as a server (e.g. as NFS or TFTP server), for this reason the developer usually choose a bridged configuration, with proper IP parameter assignments.

Bridged configuration[edit | edit source]

Bridge Networking configure host's physical network interface and guest's virtual network interface as if they are connected with a Ethernet Switch.

In this way:

  • guest (DVDK Virtual Machine) has it's own IP address, usually on the same subnet of the host
  • guest is directly accessible (apart from firewall rules that may be configured on the host) from any device on the same subnet

It's easy to enable a second change Virtual Box network adapter for adding a Bridged adapter and let the Virtual Machine to use a second network interface for local IP static usage.

Network adaptes configuration[edit | edit source]

For setting the network adapters in the Virtual Machine:

  • open VirtualBox Manager application and from the main window, select your VM and choose Settings from the toolbar
DVDK Virtual Machine
  • select the Network item: by default, the network adapter enabled in the DVDK Virtual Machine is the Adapter 1 configured in NAT, see the Network Settings in the picture here below:
Network Adapter 1 - NAT

An advanced setup is to add another network adapter to be used as Bridged Adapter, while keeping the first network interface with NAT. For example, it is possible to work on a laptop connected to Internet via Wi-Fi while developing using the bridged network adapter on Ethernet. In this case the Virtual Machine will be able to access the public network using the NATed interface (via host WiFi) while serving TFTP/NFS file to the Embedded Linux system.

For enabling a second network Bridged Adapter:

  • choose Network Adapter 2 item, enable it and from the Attached To: dropdown choose Bridged Adapter
Network Adapter2 as Bridged adapter
  • Now the Name dropdown should be enabled. If you have more than one network interface, choose the right one to connect the bridge too
Bridged Adapter - Name

Network Configuration[edit | edit source]

Once the graphical interface is ready, a mouse over the Network icon in the status bar shows the two Adapter configuration

  • Adapter 1: NAT with an assigned virtual IP address
  • Adapter 1: Bridged Adapter without an IP address
Adapter 1 - Adapter 2

For assigning a static IP address, it is possible to start the network manager and configure the ethernet connection:

Advanced Network Configuration

In the Network Connections panel, select the second wired connection

Wired connection 2

and fill the required fields (Method and Addresses) for the IPv4 Settings tab:

IPv4 Settings

and hit Save button.

After some seconds, the new configuration is added and a mouse over the network icon should tell you that the connection with your network is established:

Adapter 2 - IP static