// Module included in the following assemblies:
//
// * networking/k8s_nmstate/k8s-nmstate-updating-node-network-config.adoc

:_mod-docs-content-type: REFERENCE
[id="virt-example-host-vrf_{context}"]
= Example: Network interface with a VRF instance node network configuration policy

[role="_abstract"]
You can associate a Virtual Routing and Forwarding (VRF) instance with a network interface by applying a `NodeNetworkConfigurationPolicy` custom resource (CR).

By associating a VRF instance with a network interface, you can support traffic isolation, independent routing decisions, and the logical separation of network resources.

[WARNING]
====
When configuring Virtual Route Forwarding (VRF), you must change the VRF value to a table ID lower than `1000` because a value higher than `1000` is reserved for {product-title}.
====

In a bare-metal environment, you can announce load balancer services through interfaces belonging to a VRF instance by using MetalLB. For more information, see the _Additional resources_ section.

The following YAML file is an example of associating a VRF instance to a network interface.
It includes samples values that you must replace with your own information.

[source,yaml]
----
apiVersion: nmstate.io/v1
kind: NodeNetworkConfigurationPolicy
metadata:
  name: vrfpolicy
spec:
  nodeSelector:
    vrf: "true"
  maxUnavailable: 3
  desiredState:
    interfaces:
      - name: ens4vrf
        type: vrf
        state: up
        vrf:
          port:
            - ens4
          route-table-id: 2
----

* `metadata.name` defines the name of the policy.
* `spec.nodeSelector.vrf` defines a node selector. This example applies the policy to all nodes with the label `vrf:true`.
* `spec.desiredState.interfaces.name` defines the name of the interface.
* `spec.desiredState.interfaces.type` defines the type of interface. This example creates a VRF instance.
* `spec.desiredState.interfaces.vrf.port` defines the node interface to which the VRF attaches.
* `spec.desiredState.interfaces.vrf.route-table-id` defines the route table ID for the VRF.
