Configuring filter-based GRE tunneling

Traffic matching an IP filter can be tunneled with GRE using the following mechanisms:

The gre-tunnel-template defines the parameters to create the GRE header used to encapsulate matching IP traffic:

The following is an example configuration for an IPv4 based GRE tunnel template and then an IPv6 based GRE tunnel template:

Example: MD-CLI

*[pr:/configure filter]
A:admin@cses-V27# info
    ip-filter "1" {
        entry 1 {
            pbr-down-action-override forward
            action {
            }
        }
    }
    ip-filter "2" {
        entry 1 {
            action {
                forward {
                    gre-tunnel "greTunnel_ipv6"
                }
            }
        }
    }
    gre-tunnel-template "greTunnel_ipv4" {
        description "10.20.1.5"
        ipv4 {
            source-address 10.20.1.3
            destination-address 9.9.9.9 { }
            destination-address 10.20.1.5 { }
            destination-address 13.13.13.13 { }
        }
    }
    gre-tunnel-template "greTunnel_ipv6" {
        ipv6 {
            source-address 3ffe::a14:100
            gre-key if-index
            destination-address 3ffe::a01:102 { }
        }
    }

Example: classic CLI

*A:admin@cses-V27>config>filter>ip-filter$ default-action 
        gre-tunnel-template "greTunnel_ipv4" create 
            description "10.20.1.5" 
            ipv4 
                source-address 10.20.1.3 
                destination-address 9.9.9.9 
                destination-address 10.20.1.5 
                destination-address 13.13.13.13 
            exit 
        exit 
        ip-filter 1 name "1" create 
            entry 1 create 
                action 
                exit 
                pbr-down-action-override forward 
            exit  
            entry 2 create 
                action 
                    forward gre-tunnel "greTunnel_ipv4" 
                exit 
            exit  
        exit 
*A:admin@cses-V27>config>filter# info
        gre-tunnel-template "greTunnel_ipv6" create
            ipv6
                gre-key if-index .    (optional)
                source-address 3ffe::a14:100
                destination-address 3ffe::a01:102
            exit
        exit
        ip-filter 2 name "2" create
            entry 1 create
                action
                    forward gre-tunnel "greTunnel_ipv6"
                exit
            exit
        exit