sgsnemu(8) Serving GPRS Support Node Emulator


sgsnemu --help

sgsnemu --version

sgsnemu [ --debug ] [ --conf file ] [ --pidfile file ] [ --statedir file ] [ --dns host ] [ --listen host ] [ --remote host ] [ --contexts num ] [ --timelimit seconds ] [ --gtpversion version ] [ --apn apn ] [ --selmode selmode ] [ --imsi imsi ] [ --nsapi nsapi ] [ --msisdn msisdn ] [ --qos qos ] [ --charging charging ] [ --uid uid ] [ --pwd pwd ] [ --createif ] [ --net net ] [ --defaultroute ] [ --ipup script ] [ --ipdown script ] [ --pinghost host ] [ --pingrate num ] [ --pingsize num ] [ --pingcount num ]


sgsnemu is part of the OpenGGSN project, and implements a Serving GPRS Support Node (SGSN) emulator. It can be used for testing Gateway GPRS Support Nodes (GGSNs), GPRS core networks as well as GPRS roaming connections.

The GPRS functionality and protocols has been standardised by the Third Generation Partnership Project (3GPP). According to the 3GPP specifications an SGSN has several interfaces. sgsnemu implements the Gn/Gp interface which is used towards GGSNs.

The Gn/Gp interface can be seen as the uplink interface of the SGSN. It is used for communicating with a GGSN which is typically connected to the Internet. The Gn/Gp interface uses the GPRS tunneling protocol (GTP). User data packets (typically IP packets) are tunneled over GTP, which again uses UDP over IP.

sgsnemu will establish a number of connections to the GGSN. An internal ping facility will transmit ping requests through the established connections. Alternatively a local network interface can be created. In this case sgsnemu will forward packets between the local network interface and the established connections on the Gn/Gp interface.

sgsnemu uses the TUN/TAP driver for the local interface. A tun network interface is established for each connection established to the GGSN.

Runtime errors are reported using the Osmocom logging framework.


Print help and exit.

Print version and exit.

Run in debug mode (default = off)

--conf file
Read configuration file where each line corresponds to one command line option, but with the leading '--' removed. Command line options override the options given in the configuration file.

--pidfile file
Filename of process id file (default = ./

--statedir path
path to directory of nonvolatile data (default = ./)

--dns host
DNS server to use for APN lookups. If omitted the default system DNS configuration will be used.

--listen host
Local interface IP address to use for the Gn/Gp interface. If omitted sgsnemu will listen to any IP address.

--remote host
GGSN host to connect to. If DNS is setup correctly it should be possible to specify the access point name (APN) as the remote host.

--contexts num
Number of contexts to establish. (default = 1). For multiple contexts the the first context is established using imsi + 0 and msisdn + 0. The second context is established using imsi + 1 and msisdn + 1. The third....

--timelimit seconds
Exit sgsnemu after seconds. When using the ping facility sgsnemu will also exit after --pingcount packets has been transmitted.

--gtpversion version
version of GTP to use when establishing a context (default = 1). If not able to establish a GTPv1 context sgsnemu will fall back to using GTPv0.

--apn apn
apn to use when connecting to the GGSN (default = internet). APN is an abbreviation of Access Point Name.

--selmode selmode
Selection mode to use when connecting to the GGSN (default = 0x01). The encoding of the selection mode is as follows: 0: MS or network provided APN, subscribed verified, 1: MS provided APN, subscription not verified, 2: Network provided APN, subscription not verified.

--imsi imsi
imsi to use when connecting to the GGSN (default = 240010123456789). IMSI is an abbreviation of International Mobile Subscriber Identity. Must be exactly 15 digits. See the contexts option for the the use of the imsi option with multiple contexts.

--nsapi nsapi
nsapi to use when connecting to the GGSN (default = 0). Must be between 0 and 15.

--msisdn msisdn
msisdn to use when connecting to the GGSN (default = 46702123456). MSISDN is an abbreviation of International Mobile Integrated Services Digital Network. Effectly a phone number in international format without the leading 00 or 011. See the contexts option for the the use of the msisdn option with multiple contexts.

--qos qos
qos to use when connecting to the GGSN (default = 0x0b921f). QoS is an abbreviation of Quality of Service. See 3GPP specification 09.60 for the format of this string.

--charging charging
Charging characteristics to use when connecting to the GGSN (default = 0x0800). 0x0800 = Normal, 0x0400 = Prepaid, 0x0200 = Flat rate, 0x0100 = Hot billing. See 3GPP specification 32.015 for the format of this field.

--uid uid
User ID to send to GGSN as protocol configuration option.

--pwd pws
Password to send to GGSN as protocol configuration option.

Create a local tun interface. This interface will be used for forwarding packets to and from the Gn/Gp interface. Use with caution as the Gn/Gp interface is normally be routed to the Internet by the GGSN. Only one interface will be created, even if several contexts are established. The interface will be given an IP address for each established context, or the address can be specified with the net option.

--net net
Network address of the local interface. The net option is only valid when the createif option is used. The net option is given in cidr format (net/mask bits). If the net option omitted an IP address is allocated for each context established.

Create a defaultroute to the local tun interface.

--ipup script
Script executed after the tun network interface has been brought up. Executed with the following parameters: <devicename> <ip address>

--ipdown script
Script executed after the tun network interface has been taken down. Executed with the following parameters: <devicename> <ip address>

--pinghost host
Ping host through the Gn/GP interface. Ping statistics are reported much like done by the original ping program. Use this facility for performance test of GGSNs.

--pingrate num
Number of ping requests per second (default = 1)

--pingsize num
The size of each ping requests in octets (default = 56)

--pingcount num
Number of ping requests to send (default = 0). A value of 0 (zero) indicates infinite.

Do not print information for each packet received (default = off). Is quite useful for high pingrates.


The configuration file for sgsnemu.
Process ID file.
Directory holding nonvolatile data.


Report all bugs to the OpenGGSN bug tracking list at


Besides the long options documented in this man page sgsnemu also accepts a number of short options with the same functionality. Use sgsnemu --help for a full list of all the available options.

The TUN/TAP driver is required for proper operation of sgsnemu. For linux kernels later than 2.4.7 the TUN/TAP driver is included in the kernel, but typically needs to be loaded manually with modprobe tun. For automatic loading the line alias char-major-10-200 tun can be added to /etc/modules.conf. For other platforms see for information on how to install and configure the tun driver.

sgsnemu uses the GPRS Tunneling Protocol (GTP) as specified by the Third Generation Partnership Project (3GPP). 3GPP protocols specifications can be found at


Copyright (C) 2002, 2003, 2004 by Mondru AB.

The contents of this file may be used under the terms of the GNU General Public License Version 2, provided that the above copyright notice and this permission notice is included in all copies or substantial portions of the software.


Jens Jakobsen <[email protected]>