# Configuring GTP Flow

<figure><img src="https://content.gitbook.com/content/Uy210FjW8Gkz8ykjDZrg/blobs/LJujXMQZEvFgGtNqQDTV/Screenshot%202022-09-30%20at%2012.08.43%20PM.png" alt=""><figcaption><p>GTP</p></figcaption></figure>

### Enable GTP Parsing

#### Reference

<table data-header-hidden><thead><tr><th></th><th></th><th data-hidden></th></tr></thead><tbody><tr><td>Command</td><td>gtp<br>no gtp</td><td></td></tr><tr><td>Description</td><td>Global GTP Parsing</td><td></td></tr><tr><td>Parameters</td><td>None</td><td></td></tr><tr><td>Mode</td><td>EXEC</td><td></td></tr></tbody></table>

#### Example

```
//enabling GTP
pbnoscli(config)# gtp 

//disabling GTP
pbnoscli(config)# no gtp  
```

### GTP Rule Match For Inner Headers

Using the following commands, you can configure a rule with GTP packet qualifiers to monitor the packets.

{% hint style="info" %}
* Before configuring rules, network and tool ports must be configured.&#x20;
* GTP must be enabled in config mode.
{% endhint %}

{% hint style="danger" %}
GTP and UDF can not be configured together on a device
{% endhint %}

#### Reference

<table data-header-hidden><thead><tr><th></th><th></th><th data-hidden></th></tr></thead><tbody><tr><td>Command</td><td><p>rule &#x3C;ruleid> ( permit ) [description &#x3C;cstring>] [gtp &#x3C;gtpexpression> ] [counters (enable | disable)]</p><p>no rule &#x3C;ruleid></p></td><td></td></tr><tr><td>Description</td><td>Rule Configuration</td><td></td></tr><tr><td>Parameters</td><td><p><strong>ruleid:</strong> It should be in the range 1 to 6000 <strong>description</strong>: max 50 characters. </p><p><strong>gtp</strong> Example qualifiers: teid - Tunnel ID, match-all-ipv4 - Match all inner IPv4, match-all-ipv6 - Match all inner IPv6 ,inner-sip - Inner IP Source Address, inner-dip - Inner IP Destination Address, inner-protocol - Inner Header Protocol, inner_l4srcport - Inner Header UDP Source Port, inner_l4destport - Inner Header UDP Destination Port</p></td><td></td></tr><tr><td>Mode</td><td>FLOW</td><td></td></tr></tbody></table>

#### Example

```
pbnoscli# configure terminal 
pbnoscli(config)# flow flow01
pbnoscli(config-flow-flow01)# network-ports Ethernet1/1
pbnoscli(config-flow-flow01)# tool-ports Ethernet4/1
pbnoscli(config-flow-flow01)# rule 1 permit gtp "teid 0x11112222 inner-sip 10.10.10.10/24 inner-dip 20.20.20.20/24 inner_protocol tcp inner_l4srcport 2152 inner_l4destport 2153" counters enable
pbnoscli(config-flow-flow01)# rule 2 permit gtp "teid 0x11112222 inner-sip 1001:11::1 inner-smask ffff:: inner-dip 2002:22::2 inner-dmask f::f inner_protocol tcp inner_l4srcport 2152 inner_l4destport 2153" counters enable
pbnoscli(config-flow-flow01)#
```

To verify flow, use the following command:

```
pbnoscli# show flow summary 
Flow-Name       Rule-Id        Status      Counter-Value
=========================================================
flow01          2             Active          3574             
flow01          1             Active          1123               
pbnoscli# 

pbnoscli# show flow all
===================================
Flow : flow01 (CLI)
===================================
Status       : enable          
Network-Port : Ethernet1/1     
Tool-Port    : Ethernet4/1     

Rule : 1               
++++++++++++++++++++++++++++++++++
TEID                     : 0x11112222      
Inner Source IP          : 10.10.10.10     
Inner Source Mask        : 255.255.255.0   
Inner Destination IP     : 20.20.20.20     
Inner Destination Mask   : 255.255.255.0   
Inner Protocol           : tcp             
Inner Source l4port      : 2152            
Inner Destination l4port : 2153            
Action                   : permit          
Counters                 : enable          

Rule : 2               
++++++++++++++++++++++++++++++++++
Inner Source IP          : 1001:11::1      
Inner Source Mask        : ffff::          
Inner Destination IP     : 2002:22::2      
Inner Destination Mask   : f::f            
Inner Protocol           : tcp             
Inner Source l4port      : 2152            
Inner Destination l4port : 2153            
Action                   : permit          
pbnoscli# 
```

```
pbnoscli# show running-config
configure terminal
gtp
interface ethernet Ethernet120
forward-error-correction rs
type network
!
interface ethernet Ethernet124
forward-error-correction rs
type tool
!
interface mgmt
ip address 10.4.4.52/24 gateway 10.4.4.1
!
flow flow01
network-ports Ethernet1/1
tool-ports Ethernet4/1
rule 1 permit gtp "teid 0x11112222 inner-sip 10.10.10.10/24 inner-dip 20.20.20.20/24 inner_protocol tcp inner_l4srcport 2152 inner_l4destport 2153" counters enable
rule 2 permit gtp ""teid 0x11112222 inner-sip 1001:11::1 inner-smask ffff:: inner-dip 2002:22::2 inner-dmask f::f inner_protocol tcp inner_l4srcport 2152 inner_l4destport 2153"
!
pbnoscli#
```
