How to build and use GTPing to generate GTP traffic for testing without eNB, SPGW etc. This work was done as part of the preparation of SRv6 mobile user plane POC at SRv6 Consortium, Data plane Study Group, which is a group of people interested in SRv6.
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
GTPing, How To
1. How to GTPing
SRv6 Consortium, Data plane Study Group
Kentaro Ebisawa | Twitter: @ebiken
How to GTPing | SRv6 Consortium, Data plane Study Group | 2018/11/27 (rev 0) 1
2. “GTPing” is an Open Source (GPL) tool written by Thomas Habets.
Just like ping(8), you can send GTP request and receive response.
Use this tool to generate GTP packet
when you don’t have an environment to generate “real” GTP traffic.
(ex: eNB, SPGW)
How to GTPing | SRv6 Consortium, Data plane Study Group | 2018/11/27 (rev 0) 2
What and When to use GTPing?
https://github.com/ThomasHabets/gtping
3. How to GTPing | SRv6 Consortium, Data plane Study Group | 2018/11/27 (rev 0) 3
cheat sheet
Client Server
(1) Start Server
$ sudo python gsnsim.py
“gsnsim.py” is located at gtping/test/gsnsim.py
(2) Run GTPing
$ gtping -c <count> <dst IP> -t <TEID>
$ gtping -c 4 172.20.0.2 -t 100
=> GTP Echo request
GTP Echo response <= (UDP port 2123)
4. How to GTPing | SRv6 Consortium, Data plane Study Group | 2018/11/27 (rev 0) 4
Building GTPing
> Clone source code
$ git clone https://github.com/ThomasHabets/gtping.git
$ cd gtping
> configure; make; sudo make install
~/gtping$ ./configure
~/gtping$ make
~/gtping$ sudo make install
> Confirm gtping is installed
~/gtping$ which gtping
/usr/local/bin/gtping
> Locate gsnsim.py
~/gtping$ cd test
~/gtping/test$ ls
gsnsim.py
> Modify gsnsim.py to use IPv4
> Change AF_INET6 to AF_INET in `def main():`
def main():
- fd = socket.socket(socket.AF_INET6, socket.SOCK_DGRAM)
+ fd = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
fd.bind( ('', 2123) )
try:
{
Build gtping binary Modify gsnsim.py to use IPv4 (instead fo IPv6)
5. • OS: Ubuntu 16.04.3 LTS (Linux)
How to GTPing | SRv6 Consortium, Data plane Study Group | 2018/11/27 (rev 0) 5
Setup environment using netns and Run GTPing
# following netns setup must run as root.
sudo -s
# Create veth pair
ip link add veth1 type veth peer name veth2
# Create netns and connect host1 and host2 via veth pair
ip netns add host1
ip netns add host2
ip link set veth1 netns host1
ip link set veth2 netns host2
# Link up loopback and veth
ip netns exec host1 ip link set veth1 up
ip netns exec host1 ifconfig lo up
ip netns exec host2 ip link set veth2 up
ip netns exec host2 ifconfig lo up
# Set IP address
ip netns exec host1 ip addr add 172.20.0.1/24 dev veth1
ip netns exec host2 ip addr add 172.20.0.2/24 dev veth2
host1
(veth1)
host2
(veth2)
=> GTP Echo Request
GTP Echo response <=
# Confirm you can ping between host1 and host2.
$ sudo ip netns exec host1 ping 172.20.0.2 -c 4
# Start GTPing server (gsnsim.py).
~/gtping/test$ sudo ip netns exec host2 python gsnsim.py
# Confirm UDP port 2123 is open in another console.
$ sudo ip netns exec host2 ss -nau
State Recv-Q Send-Q Local Address:Port Peer Address:Port
UNCONN 0 0 *:2123 *:*
# Start capturing packet on veth1 (host1)
$ sudo ip netns exec host1 tcpdump -i veth1 -w gtping-20181127-01.trc
# GTPing from host1 to host2
$ sudo ip netns exec host1 gtping -c 3 172.20.0.2 -t 100
GTPing 0.15
GTPING 172.20.0.2 (172.20.0.2) packet version 1
12 bytes from 172.20.0.2: ver=1 seq=0 DSCP=be ttl=64 time=0.23 ms
12 bytes from 172.20.0.2: ver=1 seq=1 DSCP=be ttl=64 time=0.35 ms
12 bytes from 172.20.0.2: ver=1 seq=2 DSCP=be ttl=64 time=0.26 ms
6. How to GTPing | SRv6 Consortium, Data plane Study Group | 2018/11/27 (rev 0) 6
Packet Capture of GTP request / response
GTP Echo request GTP Echo response
7. • GTPing will use 2123 (GTP-C) as default destination UDP port
• Change the port number with “-p <port>” option if necessary.
• Some node might assume port number is 2152 (GTP-U)
• Default TEID is 0
• Change it with “-t <teid>” option.
• Special thanks to Tohru Kitamura (https://github.com/torukita/) who
introduced GTPing to me and helped setting it up.
How to GTPing | SRv6 Consortium, Data plane Study Group | 2018/11/27 (rev 0) 7
Notes