update git URLs (git -> https; gitea)
[openggsn.git] / README.md
blob3ed720766d1d91affb88645d9ab740518e9fa995
1 ** As of September 2017, OpenGGSN is obsoleted by OsmoGGSN, please use <https://gitea.osmocom.org/cellular-infrastructure/osmo-ggsn> instead**
3 OpenGGSN - Open Source GGSN
4 ===========================
6 This repository contains a C-language implementation of a GGSN (Gateway
7 GPRS Support Node), a core network element of ETSI/3GPP cellular
8 networks such as GPRS, EDGE, UMTS or HSPA.
10 OpenGGSN is part of the [Osmocom](https://osmocom.org/) Open Source
11 Mobile Communications projects, even thogh it was previously developed
12 by Mondru AB.
14 ** As of September 2017, OpenGGSN is obsoleted by OsmoGGSN, please use
15 <https://gitea.osmocom.org/cellular-infrastructure/osmo-ggsn> instead**
17 Homepage
18 --------
20 The official homepage of the project is
21 https://osmocom.org/projects/openggsn/wiki
23 GIT Repository
24 --------------
26 ** As of September 2017, OpenGGSN is obsoleted by OsmoGGSN, please use <https://gitea.osmocom.org/cellular-infrastructure/osmo-ggsn> instead**
28 Homepage
29 You can clone from the official libosmocore.git repository using
31         git clone https://gitea.osmocom.org/cellular-infrastructure/openggsn
33 There is a cgit interface at https://gitea.osmocom.org/cellular-infrastructure/openggsn
35 Documentation
36 -------------
38 There currently is no other documentation other than the wiki on the
39 homepage.  It would be great if somebody would work towards a user
40 manual that can become part of the osmo-gsm-manuals project.
42 Mailing List
43 ------------
45 Discussions related to openggsn are happening on the
46 osmocom-net-gprs@lists.osmocom.org mailing list, please see
47 https://lists.osmocom.org/mailman/listinfo/osmocom-net-gprs for
48 subscription options and the list archive.
50 Please observe the [Osmocom Mailing List
51 Rules](https://osmocom.org/projects/cellular-infrastructure/wiki/Mailing_List_Rules)
52 when posting.
54 Contributing
55 ------------
57 Our coding standards are described at
58 https://osmocom.org/projects/cellular-infrastructure/wiki/Coding_standards
60 We us a gerrit based patch submission/review process for managing
61 contributions.  Please see
62 https://osmocom.org/projects/cellular-infrastructure/wiki/Gerrit for
63 more details
65 The current patch queue for OpenGGSN can be seen at
66 https://gerrit.osmocom.org/#/q/project:openggsn+status:open
67 OPENGGSN README
68 ===============
71 QuickStart
72 ==========
74 Requirements
75 ------------
77 *Linux* 
78 OpenGGSN was originally developed and tested using Redhat 8.0 and 9.0
79 and is these days mostly developed on Debian GNU/Linux.  It should run
80 also on other Linux distributions as well as FreeBSD, but this is
81 untested. Compilation on Solaris 2.8 has also been verified.
83 *Tun*
84 The tun driver is required for proper operation of openggsn. For Linux
85 kernels later than 2.4.7 the driver is typically included, but might
86 need to be configured for automatic loading:
88 1. Add the following line to /etc/modules.conf: alias char-major-10-200 tun 
89 2. depmod -a
92 Installation from binary
93 ------------------------
95 OpenGGSN is built for common versions of Debian and Ubuntu as part of
96 the [Osmocom Nightly Builds](https://osmocom.org/projects/cellular-infrastructure/wiki/Nightly_Builds)
97 project.  If you don't want to do development, it is suggested to simply
98 use those binary packages, rather than building yourself from source.
101 Installation from source
102 ------------------------
104 1. ./configure
105 2. make
106 3. make install
108 You need to be root in order to install the package, but not in order
109 to compile.
112 Running
113 -------
115 *sgsnemu*
116 Start the emulator as root using the command:
118   sgsnemu -l 10.0.0.50 -r 10.0.0.40 --createif --defaultroute
120 This will cause the sgsn emulator to bind to local address 10.0.0.50
121 and connect to the ggsn found at 10.0.0.40. It will first send off an
122 ECHO_REQUEST message. After this it will attempt to establish a pdp
123 context. If successful it will create a local interface and set up
124 routing. Now you should be able to ping through the connection. Use a
125 network analysator such as ethereal to monitor the traffic.
127 sgsnemu -h will show a list of available options. 
129 sgsnemu -c sgsnemu.conf will use sgsnemu.conf as a configuration
130 file. A sample file is provided in examples/sgsnemu.conf.
132 *ggsn*
133 Edit the configuration file ggsn.conf found under openggsn/examples.
134 Start the ggsn as root using the command:
136 ggsn --fg -c examples/ggsn.conf -l 10.0.0.40 --statedir ./
138 This will run the ggsn in foreground using the local interface
139 10.0.0.40. If you don't have a GSM network available for testing you
140 can use sgsnemu to test the GGSN.
143 Support
144 -------
146 Please contact the Mailing List above for community-based support.
149 Features
150 ========
152 OpenGGSN is an open source implementation of GPRS Support Nodes
153 (GSNs). It implements the GPRS tunneling protocol (GTP) version 0 and
154 version 1.
156 OpenGGSN provides 3 components:
157  * gtplib
158  * ggsn
159  * sgsnemu
161 *gtplib*
162 This library contains all functionality relating to the GTP
163 protocol. Use this library if you want to implement your own
164 GSN. gtplib supports both GTPv0 (GSM 09.60) and GTPv1 (3GPP
165 29.060). At the moment no interface documentation is available for
166 download.
168 *ggsn*
169 The ggsn implements a Gateway GPRS Support Node. The GGSN is a small
170 application which is provided in order to test and demonstrate the use
171 of gtplib. It is fully compliant to the 3GPP standards, but lacks
172 important functionality such as charging and management. Use this
173 application as a starting point if you want to build your own GGSN
174 with your own fancy VPN, management and charging functionality.
176 *sgsnemu*
177 This application emulates a Serving GPRS Support Node (SGSN). sgsnemu
178 enables you to test your 3GPP core network without the need to invest
179 in a 3G radio access network. An important application of sgsnemu is
180 the testing of roaming connectivity through a GPRS roaming
181 exchange. sgsnemu will first attempt to use GTPv1. If unsuccessful it
182 will fallback to GTPv0.
185 Performance
186 ===========
188 Two experiments were performed in order to test the performance of
189 sgsnemu and ggsn. The ggsn used a 550 MHz Athlon with 384 MB of
190 RAM. sgsnemu used a 1 GHz Athlon with 256 MB of RAM. Both machines had
191 100 Mb/s NICs (RTL-8139) and were connected through a crossed patch
192 cable. Both tests were performed by sending ICMP echo packets from
193 sgsnemu to the ggsn.
195 89.5 Mb/s IP throughput when sending 10000 ICMP ping packets with a
196 payload of 1400 bytes. Transfer time 1.27 sec, no packets lost.
198 71.4 Mb/s IP throughput when sending 10000 ICMP ping packets with a
199 payload of 1000 bytes. Transfer time 1.15 sec, no packets lost.
201 12,1 Mb/s IP throughput when sending 10000 ICMP ping packets with a
202 payload of 100 bytes. Transfer time 0.84 sec, no packets lost.
205 Required software
206 =================
211 Both ggsn and sgsnemu uses the tun package. You need at least tun
212 version 1.1. With Linux tun is normally included from kernel version
213 2.4.7. To configure automatic loading:
215 1. Add the following line to /etc/modules.conf: alias char-major-10-200 tun 
216 2. depmod -a
218 Alternatively you can execute "modprobe tun" on the commandline.
220 For Solaris the tun driver needs to be installed manually. For general
221 information about tun see http://vtun.sourceforge.net/tun/
223 Gengetopt
224 ---------
226 Gengetopt is required if you want to change the options defined in the
227 cmdline.ggo source file. You need at least gengetopt version 2.8. If
228 you are just going to compile the programs you don't need gengetopt.
230 To use gengetopt for the ggsn do the following:
231 cd ggsn
232 gengetopt < cmdline.ggo --conf-parser
234 To use gengetopt for the sgsnemu do the following:
235 cd sgsnemu
236 gengetopt < cmdline.ggo --conf-parser
238 For more information about gengetopt see
239 http://www.gnu.org/software/gengetopt/gengetopt.html
242 Compilation and Installation
243 ============================
246 Setting up autotools
247 --------------------
249 You do not need to perform this step if you are only going to compile
250 the package:
252 1. Get version from somewhere: Script to extract version from configure.in
253 2. Copy the latest config.guess and config.sub from ftp://ftp.gnu.org/gnu/config
254 3. Run autoscan and copy configure.scan to configure.in
255 4. Add/edit the following lines in configure.in:
256    - AC_INIT(openggsn, 0.70, jj@openggsn.org)
257    - AC_CONFIG_SRCDIR([gtp/gtp.c])
258    - AM_CONFIG_HEADER([config.h])
259    - AC_PROG_LIBTOOL
260    - AM_PROG_LIBTOOL
261    - AM_INIT_AUTOMAKE()
262 5. libtoolize --automake --copy
263   (ads copy of ltmain.sh)
264 6. aclocal
265 7. autoheader
266 8. automake --add-missing --copy
267   (Ads copy of mkinstalldirs missing, install-sh, depcomp)
268 9. automake
269 10. autoconf
271 The above will initialise the project to the current version of
272 autotools (As installed in RedHat 8.0). See
273 http://sources.redhat.com/autobook/autobook/autobook_25.html#SEC25 
274 for details on autotools.
277 Checking out from CVS
278 ---------------------
280 To download the latest source code from anonymous CVS:
282 cvs -d:pserver:anonymous@cvs.sourceforge.net:/cvsroot/ggsn login
283 cvs -z3 -d:pserver:anonymous@cvs.sourceforge.net:/cvsroot/ggsn co openggsn
285 Or to download from developer CVS:
287 export CVS_RSH=ssh
288 cvs -z3 -d:ext:developername@cvs.sourceforge.net:/cvsroot/ggsn co openggsn
290 Both the above sets of commands creates a new directory called openggsn.
293 Compilation and installation
294 ----------------------------
296 If compiling under Solaris you need to edit the following line in
297 ggsn/Makefile.in and sgsnemu/Makefile.in:
299 LDFLAGS = -Wl,--rpath -Wl,/usr/local/lib @EXEC_LDFLAGS@
301 should be changed to:
303 LDFLAGS =  -lresolv -lsocket -lnsl @EXEC_LDFLAGS@ 
305 Note that the above is not necessary on other platforms. Compilation
306 and installation is performed by the following steps:
308  1. ./configure
309  2. make clean
310  3. cd gtp
311  4. make
312  5. make install (as root)
313  6. cd ..
314    (Step 3 to 6 you only need to run the first time to install libgtp)
315  7. make
316  8. make install (as root)
317  9. Add /usr/local/lib to /etc/ld.so.conf
318 10. run ldconfig
320 (Steps 9 and 10 are not required as path to libgtp is included in Makefile)
322 Documentation can be converted to html by issuing:
324  1. txt2html -pm -tf README > README.html
325  2. txt2html -pm -tf NEWS > NEWS.html
326  3. man2htm ggsn.8 > ggsn.html
327  4. man2htm sgsnemu.8 > sgsnemu.html
330 Installation from binary
331 ------------------------
333 1. rpm -i openggsn-<version>.rpm
335 This will install binaries, man pages, configuration files as well as
336 a Sys V init script for the ggsn.
339 Running ggsn
340 ============
342 Use ggsn -h for a list of available options. All options available on
343 the command line can also be given in a configuration file. See
344 examples/ggsn.conf for the format of this file.
346 Start the ggsn as root using the command:
348 ggsn -c examples/ggsn.conf --fg -l 10.0.0.40 --net 192.168.0.0/24 --dynip 192.168.0.0/24
350 First a tun network interface will be created. In the above example
351 the network interface address is 192.168.0.0 and the mask is
352 255.255.255.0. You can check that this interface is up by using
353 ifconfig.
355 After tun has been successfully established the ggsn will wait for GTP
356 create PDP context requests on the local interface
357 10.0.0.40. Currently all requests are accepted, and no password,
358 username or APN validation is performed.
360 When receiving a create PDP context request a dynamic IP address will
361 be allocated from the address pool determined by --dynip. In the above
362 example the first allocated address will be 192.168.0.1, followed by
363 192.168.0.2 and so on. The request is confirmed by sending a create
364 PDP context response message to the peer (SGSN).
366 Now IP packets will be forwarded between the tun network interface and
367 the established GTP tunnel. In order to allow users to access the
368 external network routing needs to be set up. If private addresses are
369 used you need to configure network address translation. See the Linux
370 Networking HOWTO for details.
372 Remember to enable routing: 
374 echo 1 > /proc/sys/net/ipv4/ip_forward
376 If you installed using a binary RPM package it is possible to start
377 ggsn by using the Sys 5 script:
379 /etc/init.d/ggsn start
382 Running sgsnemu
383 ===============
385 Use sgsnemu -h for a list of available options. All options available
386 on the command line can also be given in a configuration file. See
387 examples/sgsnemu.conf for the format of this file.
389 If you want to test a GRX roaming connection you will need to do the
390 following:
392 1. Install sgsnemu on a Linux Box. See under installation above.
393 2. Connect your Linux box with sgsnemu installed to the GPRS core
394 network. Use the same LAN switch as the one your SGSN is connected
395 to. You also need a free IP address that can be used by sgsnemu.
396 3. You need to configure networking in terms of interface address,
397 subnet mask and default route. See the Linux Networking HOWTO for
398 details.
399 4. Launch sgsnemu with something like:
401 sgsnemu --listen 10.0.0.50 --remote 10.0.0.40 --dns 10.20.38.51 --timelimit 10 --contexts 0 
403 sgsnemu will print something like the following on the screen:
406   Using DNS server:      10.20.38.51 (10.20.38.51)
407   Local IP address is:   10.0.0.50 (10.0.0.50)
408   Remote IP address is:  10.0.0.40 (10.0.0.40)
409   IMSI is:               240011234567890 (0x98765432110042)
410   Using APN:             internet
411   Using MSISDN:          46702123456
413   Initialising GTP library
414   OpenGGSN[1823]: GTP: gtp_newgsn() started
415   Done initialising GTP library
417   Sending off echo request
418   Waiting for response from ggsn........
420   Received echo response. Cause value: 0
422 This is quite good. It means that you managed to send off an echo
423 request to a remote GGSN, and it was friendly enough to answer you. If
424 you did not get an echo response it means that something is wrong
425 either with your setup OR with the GRX connection OR with your roaming
426 partners connection.
428 If the above went well you might want to try to establish a PDP
429 context to the remote GGSN. Note that you should be careful when
430 establishing PDP contexts using sgsnemu as each established PDP
431 context will result in a Charge Detail Record (CDR) being generated by
432 the GGSN. You should use real IMSI and MSISDN from a valid test SIM
433 card. Otherwise some poor customer might get charged for your
434 testing. Also note that you are establishing a connection to the Gi
435 network, so please be carefull not to route internet traffic onto the
436 GPRS core network! Assuming you know what you are doing:
438 sgsnemu --listen 10.0.0.50 --remote 10.0.0.40 --dns 10.20.38.51 --timelimit 10 --contexts 1 --apn internet --imsi 240011234567890 --msisdn 46702123456 --createif --defaultroute
440 sgsnemu will print something like the following on the screen:
442   Using DNS server:      10.20.38.51 (10.20.38.51)
443   Local IP address is:   10.0.0.50 (10.0.0.50)
444   Remote IP address is:  10.0.0.40 (10.0.0.40)
445   IMSI is:               240011234567890 (0x98765432110042)
446   Using APN:             internet
447   Using MSISDN:          46702123456
449   Initialising GTP library
450   OpenGGSN[1838]: GTP: gtp_newgsn() started
451   Done initialising GTP library
453   Sending off echo request
454   Setting up PDP context #0
455   Waiting for response from ggsn........
457   Received echo response. Cause value: 0
458   Received create PDP context response. Cause value: 128
459   Setting up interface and routing
460   /sbin/ifconfig tun0 192.168.0.1
461   /sbin/route add -net 192.168.0.0 netmask 255.255.255.0 gw 192.168.0.1
464 Now a context is established to the remote GGSN. The IP address of the
465 context is 192.168.0.1. You should be able to ping a known address on
466 the Gi network of the roaming partner. You should even be able to do
467 web browsing through the PDP context.
469 Note however that you probably need to adjust your routing tables, so
470 that you make sure that all GRX traffic is routed to the GPRS core
471 network and everything else through the PDP context. The proper way to
472 do this is to use policy routing. Also note that you are effectively
473 connecting the same computer to both the Gn and Gi network, so please
474 be carefull not to route internet traffic onto the GPRS core network
475 and please protect yourself against hackers! For this reason it is
476 advised to always use --contexts 0 when testing a live network.
478 After --timelimit seconds the PDP context is disconnected with the
479 following messages from sgsnemu:
482   Disconnecting PDP context #0
483   Received delete PDP context response. Cause value: 128
484   Deleting tun interface