规范上是这么描述的:“GTP tunnels are used between two nodes communicating over a GTP based interface, to separate traffic into different communication flows. A GTP tunnel is identified in each node with a TEID, an IP address and a UDP port number. The receiving end side of a GTP tunnel locally assigns the TEID value the transmitting side has to use. The TEID values are exchanged between tunnel endpoints using GTP-C or S1-MME messages. ”
The UDP Destination Port number for GTPv2 Initial messages shall be 2123. It is the registered port number for GTP-C. The UDP Source Port for a GTPv2 Initial message is a locally allocated port number at the sending GTP entity.If GTPv2 and GTP' v2 modules are using the same IP address for sending messages, the implementation shall ensure that while some source port number is used by GTPv2 messages, the same source port number shall not be used by GTP' v2 messages. Otherwise, the IP interface may have difficulty to delivering a response message to the right protocol entity.
GTP-C的源端口没有严格限制,后续端口一样和不一样应该问题不大,是应用程序自动选的。GTPv1的GTP-C源和目的一般都是2123,但我见过有些厂家的设备源端口是随机的,这个在协议里面没有明确规定,似乎绝大多数厂家的源端口都用2123. GTP-C源端口不一点完全区分tunnel的,GTPv2有可能源端口也是2123.