9.7. Connecting a virtual machine to a Linux bridge network
By default, OpenShift Virtualization is installed with a single, internal pod network. You can connect a virtual machine (VM) to the physical network by using a Linux bridge.
To create a Linux bridge network and attach a VM to the network, perform the following steps:
- Prepare the node network by creating a Linux bridge node network configuration policy (NNCP).
- Define the secondary Linux bridge network by creating a network attachment definition (NAD).
- Attach the VM to the Linux bridge network.
OpenShift Virtualization does not support Linux bridge bonding modes 0, 5, and 6. For more information, see "Additional resources".
9.7.1. Create a Linux bridge node network configuration policy 링크 복사링크가 클립보드에 복사되었습니다!
You can configure a Linux bridge network for live migration or external access to virtual machines (VMs) by creating a NodeNetworkConfigurationPolicy (NNCP) manifest.
Prerequisites
- You have installed the Kubernetes NMState Operator.
Procedure
Configure the
NNCPmanifest. This example includes sample values that you must replace with your own information.apiVersion: nmstate.io/v1 kind: NodeNetworkConfigurationPolicy metadata: name: br1-eth1-policy spec: desiredState: interfaces: - name: br1 description: Linux bridge with eth1 as a port type: linux-bridge state: up ipv4: enabled: false bridge: options: stp: enabled: false port: - name: eth1-
metadata.name: Defines the name of the node network configuration policy. -
spec.desiredState.interfaces.name: Defines the name of the new Linux bridge. -
spec.desiredState.interfaces.description: Optional field that can be used to define a human-readable description for the bridge. -
spec.desiredState.interfaces.type: Defines the interface type. In this example, the type is a Linux bridge. -
spec.desiredState.interfaces.state: Defines the requested state for the interface after creation. -
spec.desiredState.interfaces.ipv4.enabled: Defines whether the ipv4 protocol is active. Setting this tofalsedisables IPv4 addressing on this bridge. -
spec.desiredState.interfaces.bridge.options.stp.enabled: Defines whether Spanning Tree Protocol (STP) is active. Setting this tofalsedisables STP on this bridge. spec.desiredState.interfaces.bridge.port.name: Defines the node NIC that the bridge is attached to.참고To create the NNCP manifest for a Linux bridge using Open Systems Adapter (OSA) with IBM Z®, you must disable VLAN filtering by the setting the
rx-vlan-filtertofalsein theNodeNetworkConfigurationPolicymanifest.Alternatively, if you have SSH access to the node, you can disable VLAN filtering by running the following command:
$ sudo ethtool -K <osa-interface-name> rx-vlan-filter off
-
Create the
NNCPmanifest:$ oc apply -f linux-bridge-nncp.yaml