6.8. UDP Tunnel networking

Oracle VM VirtualBox

6.8. UDP Tunnel networking

This networking mode allows to interconnect virtual machines running on different hosts.

Technically this is done by encapsulating Ethernet frames sent or received by the guest network card into UDP/IP datagrams, and sending them over any network available to the host.

UDP Tunnel mode has three parameters:

Source UDP port

The port on which the host listens. Datagrams arriving on this port from any source address will be forwarded to the receiving part of the guest network card.

Destination address

IP address of the target host of the transmitted data.

Destination UDP port

Port number to which the transmitted data is sent.

When interconnecting two virtual machines on two different hosts, their IP addresses must be swapped. On single host, source and destination UDP ports must be swapped.

In the following example host 1 uses the IP address 10.0.0.1 and host 2 uses IP address 10.0.0.2. Configuration via command-line:

        VBoxManage modifyvm "VM 01 on host 1" --nic<x> generic
        VBoxManage modifyvm "VM 01 on host 1" --nicgenericdrv<x> UDPTunnel
        VBoxManage modifyvm "VM 01 on host 1" --nicproperty<x> dest=10.0.0.2
        VBoxManage modifyvm "VM 01 on host 1" --nicproperty<x> sport=10001
        VBoxManage modifyvm "VM 01 on host 1" --nicproperty<x> dport=10002

and

        VBoxManage modifyvm "VM 02 on host 2" --nic<y> generic
        VBoxManage modifyvm "VM 02 on host 2" --nicgenericdrv<y> UDPTunnel
        VBoxManage modifyvm "VM 02 on host 2" --nicproperty<y> dest=10.0.0.1
        VBoxManage modifyvm "VM 02 on host 2" --nicproperty<y> sport=10002
        VBoxManage modifyvm "VM 02 on host 2" --nicproperty<y> dport=10001

Of course, you can always interconnect two virtual machines on the same host, by setting the destination address parameter to 127.0.0.1 on both. It will act similarly to "Internal network" in this case, however the host can see the network traffic which it could not in the normal Internal network case.

Note

On Unix-based hosts (e.g. Linux, Solaris, Mac OS X) it is not possible to bind to ports below 1024 from applications that are not run by root. As a result, if you try to configure such a source UDP port, the VM will refuse to start.