# Configuring OpenShift Virtualization to use external networks
Adapted from [Configuring OpenShift Virtualization to use external networks](https://www.redhat.com/en/blog/access-external-networks-with-openshift-virtualization) by Matthew Secaur
TODO - insert image here
TODO - provide a brief description of a `localnet`, `bridge`/`vSwitch` and `mapping`
## Create the Open vSwitch `localnet` mappings
### Step 1 - Create the bridge-mapping
```yaml=
---
apiVersion: nmstate.io/v1
kind: NodeNetworkConfigurationPolicy
metadata:
name: br-ex-network-mappings
spec:
# nodeSelector:
# node-role.kubernetes.io/worker: ''
desiredState:
ovn:
bridge-mappings:
- localnet: labnet
bridge: br-ex
state: present
- localnet: airgap
bridge: br-ex
state: present
```
### Step 2 - Create the NetworkAttachmentDefinitions
Two examples provided
```yaml=
---
apiVersion: k8s.cni.cncf.io/v1
kind: NetworkAttachmentDefinition
metadata:
namespace: default
name: labnet
spec:
config: '{
"netAttachDefName":"default/labnet",
"name":"labnet",
"topology":"localnet",
"type":"ovn-k8s-cni-overlay",
"cniVersion":"0.4.0"
}'
```
```yaml=
---
apiVersion: k8s.cni.cncf.io/v1
kind: NetworkAttachmentDefinition
metadata:
namespace: default
name: airgap-vlan999
spec:
config: '{
"netAttachDefName":"default/airgap-vlan999",
"name":"airgap",
"vlanID": 999,
"topology":"localnet",
"type":"ovn-k8s-cni-overlay",
"cniVersion":"0.4.0"
}'
```
## Future direction, UserDefined Networks
[User defined networks in Red Hat OpenShift Virtualization](https://www.redhat.com/en/blog/user-defined-networks-red-hat-openshift-virtualization)
[Enhancing the Kubernetes pod network with user-defined networks](https://www.redhat.com/en/blog/enhancing-kubernetes-pod-network-user-defined-networks)
[Getting Started with User-Defined Networks](https://www.youtube.com/watch?v=Q3-yl-ahILE)
[Getting Started with Cluster User Defined Networks in Red Hat OpenShift Container Platform](https://www.youtube.com/watch?v=Xh6JvqSPM8c)
[Introduction to UserDefinedNetwork(UDN)](https://www.youtube.com/watch?v=CBMpTdNGsWg)