;; ;; Copyright (c) 2021 Intel Corporation ;; ;; Licensed under the Apache License, Version 2.0 (the "License"); ;; you may not use this file except in compliance with the License. ;; You may obtain a copy of the License at ;; ;; http://www.apache.org/licenses/LICENSE-2.0 ;; ;; Unless required by applicable law or agreed to in writing, software ;; distributed under the License is distributed on an "AS IS" BASIS, ;; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ;; See the License for the specific language governing permissions and ;; limitations under the License. ;; [lua] dofile("parameters.lua") public_start_ip = string.match(dest_ip1,"%d+\.%d+\.%d+\.")..2 public_stop_ip = string.match(dest_ip1,"%d+\.%d+\.%d+\.")..20 cgnat_table = {} cgnat_table.dynamic = { {public_ip_range_start = ip(public_start_ip),public_ip_range_stop = ip(public_stop_ip), public_port = val_range(10,20000)}, } lpm4 = {} lpm4.next_hops = { {id = 0, port_id = 0, ip = ip("1.1.1.1"), mac = mac("00:00:00:00:00:01"), mpls = 0x212}, } lpm4.routes = {}; lpm4.routes[1] = { cidr = {ip = ip(0), depth = 1}, next_hop_id = 0, } [eal options] -n=4 ; force number of memory channels no-output=no ; disable DPDK debug output eal=--proc-type auto ${eal} [port 0] name=if0 mac=hardware vlan=yes vdev=internal_tap local ipv4=${local_ip1} [port 1] name=if1 mac=hardware vlan=yes vdev=external_tap local ipv4=${local_ip2} [defaults] mempool size=8K [global] name=${name} [core $mcore] mode=master [core $cores] name=nat task=0 mode=cgnat sub mode=l3 private=yes nat table=cgnat_table route table=lpm4 rx port=if0 tx ports from routing table=if1 task=1 mode=cgnat sub mode=l3 private=no nat table=cgnat_table route table=lpm4 rx port=if1 tx ports from routing table=if0