Navigation
Guide That Contains This Content
[+] Expand All
[-] Collapse All

    Example: Configuring Port Forwarding with Twice NAT

    The following example configures port forwarding with twice-napt-44 as the translation type. The example also has stateful firewall and multiple port maps configured.

    [edit services]
    user@host# show 
    service-set in {
        syslog {
            host local {
                services any;
            }
        }
        stateful-firewall-rules r;
        nat-rules r;
        interface-service {
            service-interface sp-10/0/0.0;
        }
    }
    stateful-firewall {
        rule r {
            match-direction input;
            term t {
                from {
                    destination-port {
                        range low 1 high 57000;
                    }
                }
                then {
                    reject;
                }
            }
        }
    }
    nat {
        pool x {
            address 12.0.0.2/32;
        }
        rule r {
            match-direction input;
            term t {
                from {
                    destination-address {
                        14.0.0.2/32;
                    }
                    destination-port {
                        range low 10 high 20000;
                    }
                }
                then {
                    port-forwarding-mappings y;
    		 					 translated {
                        destination-pool x;
                        translation-type {
                            twice-napt-44;
                        }
                    }
                }
            }
        }
        port-forwarding y {
            destined-port 45;
            translated-port 23;
            destined-port 55;
            translated-port 33;
            destined-port 65;
            translated-port 43;
    		 }
    }
    adaptive-services-pics {
        traceoptions {
            file sp-trace;
            flag all;
        }
    }
    
    • Stateful firewall has precedence over port forwarding. In this example, for instance, no traffic destined to any port between 1 and 57000 will be translated.
    • Up to 32 port maps can be configured.

    Published: 2013-08-29