Skip to content

vr_nat4

Ruben S. Montero edited this page Feb 5, 2024 · 8 revisions

NAT4

You can enable this feature to provide the VMs behind the Virtual Router with Internet access. This feature enables MASQUERADE in the POSTROUTING iptables chain.

Figure 1, depicts the typical LAN topology:

             Public Network
      ┌───────────────────────
      │
   ┌──┴─┐
┌──┤eth0├──┐
│  └────┘  │
│  Virtual │
│          │
│  Router  │
│  ┌────┐  │
└──┤eth1├──┘
   └─┬──┘
     │   private network (e.g. 192.168.0.0/24)
     └────┬───────────┬────────────┬──────────
          │           │            │
       ┌──┴──┐     ┌──┴──┐      ┌──┴──┐
       │     │     │     │      │     │
       │ VM1 │     │ VM1 │      │ VM1 │
       │     │     │     │      │     │
       └─────┘     └─────┘      └─────┘

Virtual Router Configuration

The following attributes control the basic configuration for NAT'ing:

  • ONEAPP_VNF_NAT4_ENABLED to activate the module
  • ONEAPP_VNF_NAT4_INTERFACES_OUT defines the public interface

For example, for the example above simply add:

CONTEXT = [
  ...
  ONEAPP_VNF_NAT4_ENABLED        = "YES",
  ONEAPP_VNF_NAT4_INTERFACES_OUT = "eth0",
  ...
]

Gives:

$ iptables -t nat -vnL NAT4
Chain NAT4 (1 references)
 pkts bytes target     prot opt in     out     source               destination
12345 6789K MASQUERADE  0    --  *      eth0    0.0.0.0/0            0.0.0.0/0

Context Configuration Attributes

Parameter Default Description
ONEAPP_VNF_NAT4_ENABLED NO Enable/Disable NAT feature (YES/NO)
ONEAPP_VNF_NAT4_INTERFACES_OUT no NICs Mandatory: Outgoing NICs for NAT (<[!]ethX> ...)
Clone this wiki locally