Skip to content

Instantly share code, notes, and snippets.

@russellb
Created December 9, 2016 01:43
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save russellb/a62e1bd7e02b6ee5992779aa05bc3ada to your computer and use it in GitHub Desktop.
Save russellb/a62e1bd7e02b6ee5992779aa05bc3ada to your computer and use it in GitHub Desktop.
You can attach VMs to a virtual network implemented as an overlay using tunnels, or you can attach VMs directly to a physical network.
As an example, let's say you want to attach a VM directly to VLAN 100 that is attached to the hypervisor.
On the OVN side, the configuration would look like:
# Create a logical switch and one port on that switch
ovn-nbctl ls-add sw0
ovn-nbctl lsp-add sw0 sw0-p0
# Create a special "localnet" port that indicates direct connectivity to a VLAN
# on a network called "physnet1"
ovn-nbctl lsp-add sw0 sw0-physnet1 \
-- lsp-set-addresses sw0-physnet1 unknown \
-- lsp-set-type sw0-physnet1 localnet \
-- lsp-set-options sw0-physnet1 network_name=physnet1 \
-- set Logical_Switch_Port sw0-physnet1 tag=100
On the hypervisor where the VM will reside, you must configure OVN so that it knows how to reach a network called "physnet1". You do this by configuring a mapping between a network name (physnet1) and an OVS bridge that you have configure which provides connectivity to that network. In the simplest case, this would be an OVS bridge that you have added a physical network interface to. It could also be a bonded interface, for example.
Let's say you created an OVS bridge called "br-eth1", where you added a physical device (eth1) to an OVS bridge. You would configure the OVN mapping with:
ovs-vsctl set open . external-ids:ovn-bridge-mappings=physnet1:br-eth1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment