Networking

You can set up communications between the host and guests, between guests, and between guests and the outside world.

When you design a network interface for a guest, you can use:

  • a virtio-net vdev connected to another virtio-net vdev, usually in another guest
  • a virtio-net vdev connected to a mods-vdevpeer-net.so driver instance running in the hypervisor host
  • a pass-through device

A virtio-net vdev offers peer-to-peer communication; for more information, see vdev virtio-net in the Virtual Device Reference chapter.

The mods-vdevpeer-net.so driver (a FreeBSD-compatible module) runs in the hypervisor host. It enables the io-sock service in the host to communicate with guests through appropriately configured vdevs in the qvm process instances that host the guests. For more information, see the mods-vdevpeer-net.so entry in the Utilities Reference.

MAC addresses in a hypervisor system

Note the following about assigning MAC addresses:

  • MAC addresses must be unique in any given Ethernet segment. There can be multiple Ethernet segments on a target board, and a target board may share a segment with some external entity.
  • If you don't specify MAC addresses, the vdev and mods-vdevpeer-net.so drivers generate them for you. Since these addresses are generated, they change each time you restart the networking manager (io-sock) or the VM.
  • When you assign MAC addresses, set the locally assigned bit (see IEEE 802.3-2015 Section 1, paragraph 3.2.3, item b).

Enabling peer-to-peer networking

To support connectivity between guests and the outside world, peer-to-peer networking must be enabled in the host, along with a network driver (e.g., em).

You can do this by starting io-sock in the host and then using vpctl to specify the peer interfaces you want to create.

You can add the io-sock startup instructions to the hypervisor host's startup scripts, or use the command line to start io-sock after the host has booted.

You can load the mods-vdevpeer-net.so driver when you start io-sock, using the -m vdevpeer-net option, or later, using mount. For example:
mount -T io-sock mods-vdevpeer-net.so

The following commands start both io-sock and the host drivers and create three interfaces:

io-sock -m pci -d em -m vdevpeer-net
ifconfig vp0 create
ifconfig vp1 create
ifconfig vp2 create

The following commands configure the interfaces to connect to the guest's virtio-net vdev:

vpctl vp0 peer=/dev/qvm/qnx8-guest1/p2p bind=/dev/vdevpeers/vp0
vpctl vp1 peer=/dev/qvm/qnx8-guest2/p2p bind=/dev/vdevpeers/vp1
vpctl vp2 peer=/dev/qvm/linux-guest/p2p bind=/dev/vdevpeers/vp2

You use the io-sock -d and -m options to start devs-* and mods-* drivers (see Starting io-sock and Driver Management in the QNX OS High-Performance Networking Stack (io-sock) User's Guide). In the example above, the em driver is required only if your system needs to connect to the outside world (see Guest-to-world in this chapter). If you only need to connect guests to each other, you can omit this driver.

Page updated: