Basic Testing¶
This page documents some basic testing setup for the Kernel GTP-U code. It follows the below rationale:- focus on testing the kernel GTP-U module without too much external dependencies
- test GTP-U interoperability of the kernel with at least one other implementation, not just kernel-to-kernel (which currently is not supported in the kernel, as it only implements the GGSN/P-GW role)
- limit testing to SGSN/S-GW and GGSN/P-GW, without a real cellular network (which is possible e.g. using OsmoSGSN and OsmoPCU)
Building / Installing dependencies¶
In order to follow below test instructions, you will need- A Linux kernel including the GTP-U driver (
drivers/net/gtp.c
) either compiled-in or as kernel module - libgtpnl - the userspace library providing an API around the kernel GTP-U netlink interface
- OpenGGSN - a minimal C-language implementation of a 3GPP GGSN, also contains a SGSN-side emulator called sgsnemu
- make sure you use Version 0.93 or later
- make sure you compile it with
--enable-gtp-linux
enable during the./configure
step
You can find some instructions on how to build OpenGGSN with support for libgtpnl and kernel GTP-U at this wiki page: Kernel_GTP
Test setup description¶
We will run the GGSN natively on the host, and put the emulated SGSN inside a separate network namespace.
The two namespaces are interconnected by a virtual ethernet device using the transfer network 172.31.1.0/24
The GGSN is configured to provide a pool of IP addresses from the 192.168.71.0/24 range. Each PDP context will be allocated one dynamic address from that pool
Test instructions¶
create the network namespace for the SGSN¶
ip netns add sgsn
add veth to be used between SGSN and GGSN¶
ip link add veth0 type veth peer name veth1
remote (SGSN) side of veth device¶
ip link set veth1 netns sgsn ip netns exec sgsn ip addr add 172.31.1.2/24 dev veth1 ip netns exec sgsn ip link set veth1 up
local (GGSN) side of veth device¶
ip addr add 172.31.1.1/24 dev veth0 ip link set veth0 up
execute the GGSN on the host¶
ggsn -g -c ./ggsn.conf.test
(use the file ggsn.conf.test)
The -g
option is responsible for activating kernel-GTP support. If you cannot get the example described in this document to work, try the pure GTP-U userspace implementation by removing -g
from the above command line. If it works then, there's something related to Kernel GTP-U that breaks the setup.
execute the emulated SGSN inside the sgsn namespace¶
ip netns exec sgsn sgsnemu -d -r 172.31.1.1 -l 172.31.1.2 --defaultroute --createif
verify the existence of the GTP tunnel¶
ggsn:~# gtp-tunnel list version 1 tei 1/1 ms_addr 192.168.71.2 sgsn_addr 172.31.1.2
further testing¶
in the sgsn
namespace, there's now a default-route that points into the GTP tunnel. You can use this to ping any network address that's reachable to the GGSN host. If that host is connected to the internet, you can e.g. run a ping command from within the namespace using
ip netns exec sgsn ping -c 10 8.8.8.8
which will send some IP packets to 8.8.8.8 via the tun0 device (created by sgsnemu). It will be encapsulated by the userspace GTP-U implementation of sgsnemu, sent via the veth device to the host, where it ends up inthe GTP-U kernel module, decapsulating the package and passing in on to the gtp0 device there. Anything beyond that point depends on your local routing configuration.
Updated by osmith over 1 year ago · 8 revisions