Virtual Routing and Forwarding with ACL and NAT policy support¶
Overview¶
Virtual Routing and Forwarding (VRF) enables you to create multiple isolated routing instances on a single BIG-IP Next CNF deployment. With VRF support for ACL and NAT policies, you can associate firewall (ACL) and CGNAT (NAT) policies with specific VRFs, allowing you to enforce per-tenant or per-network-segment security and address translation policies.
This page explains how to configure VRF-aware SecureContexts, VLANs, firewall policies, and NAT policies using Kubernetes Custom Resources (CRs).
Prerequisites¶
Before configuring VRF-aware policies, ensure you have:
A running BIG-IP Next CNF deployment on Kubernetes.
kubectlaccess to the cluster with permissions to create Custom Resources.The CNF CRD bundle installed, which includes the
VRF,F5BigNetVlan, andF5BigContextSecureCRDs.Familiarity with SecureContext, VLAN, Firewall Policy, and NAT Policy configuration in CNF.
Key Concepts¶
| CONCEPT | DESCRIPTION |
|---|---|
| VRF | An isolated routing instance that keeps network traffic separated from other VRFs. Each VRF maps to an internal Route Domain. |
| Route Domain | The internal CNF/TMM representation of a VRF. The default Route Domain (ID 0) is always present and acts as the parent of all other Route Domains. |
| SecureContext | A virtual server configuration that defines how traffic matching specific criteria is processed. Associating a SecureContext with a VRF makes it handle only traffic within that VRF. |
| Strict Isolation | When enabled on a VRF, traffic within the VRF is isolated from other VRFs. Traffic can still be forwarded to the default Route Domain (ID 0). |
| SNAT AUTOMAP | Source NAT mode that automatically maps the source address to an available self-IP. Required for forwarding SecureContexts associated with a non-default VRF. |
Configuration¶
Configuration Resources¶
CRDs are deployed on Kubernetes to define objects for VRF configuration:
VRF: Defines an isolated routing instance.
F5BigNetVlan: Defines a network VLAN. Use the
vrffield to associate a VLAN with a specific VRF.F5BigContextSecure: Defines a virtual server. Use the
vrffield to make it VRF-aware. When a SecureContext references a VRF:It handles only traffic arriving on VLANs associated with that VRF.
Any attached firewall (ACL) or NAT policies automatically operate within the context of that VRF.
Destination and source addresses are internally associated with the corresponding Route Domain.
Application Layer Gateway (ALG) Protocols: The following ALG CRDs also support the
vrffield, enabling VRF-aware traffic handling for these protocols. Thevrffield works identically to the SecureContextvrffield. When associated with a VRF, the ALG handler only processes protocol traffic within that VRF.
Configuration Example for Complete Multi-VRF Deployment¶
The following example demonstrates a deployment with two customer VRFs, each with their own VLAN, SecureContext, and firewall policy.
Copy the following example into the
vrf-customer-a.yamlandvrf-customer-b.yamlfile to create VRFs.apiVersion: "k8s.f5net.com/v1" kind: Vrf metadata: name: vrf-customer-a spec: strictIsolation: true --- apiVersion: "k8s.f5net.com/v1" kind: Vrf metadata: name: vrf-customer-b spec: strictIsolation: true
Copy the following example into the
vlan-customer-a.yamlandvlan-customer-b.yamlfiles to create VLANs.apiVersion: "k8s.f5net.com/v1" kind: F5BigNetVlan metadata: name: vlan-customer-a spec: name: "vlan-customer-a" interfaces: - "1.1" tag: 1006 selfip_v4s: - "101.101.101.201" - "101.101.101.202" prefixlen_v4: 24 vrf: vrf-customer-a --- apiVersion: "k8s.f5net.com/v1" kind: F5BigNetVlan metadata: name: vlan-customer-b spec: name: "vlan-customer-b" interfaces: - "1.2" tag: 1007 selfip_v4s: - "101.101.101.203" - "101.101.101.204" prefixlen_v4: 24 vrf: vrf-customer-b
Copy the following example into the
fw-policy-customer-a.yamlandfw-policy-customer-b.yamlfiles to create firewall policies.apiVersion: "k8s.f5net.com/v1" kind: FirewallPolicy metadata: name: fw-policy-customer-a spec: rules: - name: allow-http action: accept protocol: tcp destination: ports: - 80 - 443 - name: deny-all action: drop --- apiVersion: "k8s.f5net.com/v1" kind: FirewallPolicy metadata: name: fw-policy-customer-b spec: rules: - name: allow-all action: accept
Note
Firewall policies do not contain VRF-specific fields. VRF association is inherited from the SecureContext.
Copy the following example into the
sc-customer-a.yamlandsc-customer-b.yamlfiles to create SecureContexts.apiVersion: "k8s.f5net.com/v1" kind: F5BigContextSecure metadata: name: sc-customer-a spec: destinationAddress: "33.33.32.0/24" ipProtocol: "any" profile: "fastL4" firewallEnforcedPolicy: "fw-policy-customer-a" logProfile: "log-profile" vrf: "vrf-customer-a" vlans: vlanList: ["vlan-customer-a"] disableListedVlans: false --- apiVersion: "k8s.f5net.com/v1" kind: F5BigContextSecure metadata: name: sc-customer-b spec: destinationAddress: "33.33.32.0/24" ipProtocol: "any" profile: "fastL4" firewallEnforcedPolicy: "fw-policy-customer-b" logProfile: "log-profile" vrf: "vrf-customer-b" vlans: vlanList: ["vlan-customer-b"] disableListedVlans: false
Note
Both SecureContexts can use the same
destinationAddressbecause they operate in different VRFs. Traffic is isolated by VRF.Run the following command to apply the configuration.
kubectl apply -f vrf-customer-a.yaml kubectl apply -f vrf-customer-b.yaml kubectl apply -f vlan-customer-a.yaml kubectl apply -f vlan-customer-b.yaml kubectl apply -f fw-policy-customer-a.yaml kubectl apply -f fw-policy-customer-b.yaml kubectl apply -f sc-customer-a.yaml kubectl apply -f sc-customer-b.yaml
Verify the configuration.
# Verify VRFs are created kubectl get vrf # Verify VLANs are associated with VRFs kubectl get f5bignetvlan # Verify SecureContexts reference VRFs kubectl describe f5bigcontextsecure sc-customer-a kubectl describe f5bigcontextsecure sc-customer-b
Use Cases¶
Use Case 1: VRF-Aware Traffic Forwarding¶
Scenario: If you want to forward traffic for different customers through isolated VRFs without any firewall or NAT policies.
Configuration Steps:
Create a VRF (VRF) resource for each customer.
Create a F5BigNetVlan resource for each customer, referencing the appropriate VRF.
Create a F5BigContextSecure resource for each customer, referencing the appropriate VRF.
Enable SNAT AUTOMAP on each SecureContext.
Traffic Flow:
Traffic arriving on a customer’s VLAN is processed only by the SecureContext associated with the same VRF.
Traffic can be forwarded within the VRF or to the default Route Domain.
Use Case 2: VRF-Aware Firewall (ACL) Policy¶
Scenario: If you want to apply different firewall policies to different customers, each in their own VRF.
Configuration Steps:
Create VRF, VLAN, and SecureContext resources as described in Use Case 1.
Create a F5BigFwPolicy CR with the desired rules.
Reference the firewall policy in the SecureContext’s
firewallEnforcedPolicyfield.
Important Notes:
The firewall policy itself does not contain any VRF-specific configuration.
VRF association is implicit through the SecureContext.
ACL rules match traffic by IP address regardless of VRF. Isolation is enforced because the SecureContext only receives traffic from the associated VRF.
The same firewall policy can be referenced by SecureContexts in different VRFs.
Use Case 3: VRF-Aware NAT Policy¶
Scenario: If you want to apply CGNAT policies to traffic within specific VRFs.
Configuration Steps:
Create VRF, VLAN, and SecureContext resources as described in Use Case 1.
Create a F5BigNatPolicy CR with the desired translation rules.
Reference the NAT policy in the SecureContext.
Disable SNAT on the SecureContext (SNAT is not supported when a NAT policy is attached).
Important Notes:
NAT rules match traffic by IP address regardless of VRF.
Translated source IP addresses are always placed in the default Route Domain (ID 0).
Since only the destination Route Domain is used for selecting the egress VLAN, source NAT does not affect routing.
The NAT policy itself does not contain any VRF-specific configuration.
Use Case 4: Combined ACL and NAT Policies with VRF¶
Scenario: If you want both firewall filtering and NAT translation for traffic within a VRF.
Configuration Steps:
Create VRF, VLAN, and SecureContext resources as described in Use Case 1.
Create a F5BigFwPolicy CR and a F5BigNatPolicy CR.
Reference both policies in the SecureContext.
Disable SNAT on the SecureContext.
Note
The firewall policy is evaluated first, and only traffic permitted by the ACL is subject to NAT translation.