sgsnemu: Fix up gengetopt file for RAI
[openggsn.git] / README.md
blob34e13a9dc5cf066b62b27e925dd7b6a6875b9c3e
1 ** As of September 2017, OpenGGSN is obsoleted by OsmoGGSN, please use http://git.osmocom.org/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 http://git.osmocom.org/osmo-ggsn/ instead**
16 Homepage
17 --------
19 The official homepage of the project is
20 https://osmocom.org/projects/openggsn/wiki
22 GIT Repository
23 --------------
25 ** As of September 2017, OpenGGSN is obsoleted by OsmoGGSN, please use http://git.osmocom.org/osmo-ggsn/ instead**
27 Homepage
28 You can clone from the official libosmocore.git repository using
30         git clone git://git.osmocom.org/openggsn.git
32 There is a cgit interface at http://git.osmocom.org/openggsn/
34 Documentation
35 -------------
37 There currently is no other documentation other than the wiki on the
38 homepage.  It would be great if somebody would work towards a user
39 manual that can become part of the osmo-gsm-manuals project.
41 Mailing List
42 ------------
44 Discussions related to openggsn are happening on the
45 osmocom-net-gprs@lists.osmocom.org mailing list, please see
46 https://lists.osmocom.org/mailman/listinfo/osmocom-net-gprs for
47 subscription options and the list archive.
49 Please observe the [Osmocom Mailing List
50 Rules](https://osmocom.org/projects/cellular-infrastructure/wiki/Mailing_List_Rules)
51 when posting.
53 Contributing
54 ------------
56 Our coding standards are described at
57 https://osmocom.org/projects/cellular-infrastructure/wiki/Coding_standards
59 We us a gerrit based patch submission/review process for managing
60 contributions.  Please see
61 https://osmocom.org/projects/cellular-infrastructure/wiki/Gerrit for
62 more details
64 The current patch queue for OpenGGSN can be seen at
65 https://gerrit.osmocom.org/#/q/project:openggsn+status:open
66 OPENGGSN README
67 ===============
70 QuickStart
71 ==========
73 Requirements
74 ------------
76 *Linux* 
77 OpenGGSN was originally developed and tested using Redhat 8.0 and 9.0
78 and is these days mostly developed on Debian GNU/Linux.  It should run
79 also on other Linux distributions as well as FreeBSD, but this is
80 untested. Compilation on Solaris 2.8 has also been verified.
82 *Tun*
83 The tun driver is required for proper operation of openggsn. For Linux
84 kernels later than 2.4.7 the driver is typically included, but might
85 need to be configured for automatic loading:
87 1. Add the following line to /etc/modules.conf: alias char-major-10-200 tun 
88 2. depmod -a
91 Installation from binary
92 ------------------------
94 OpenGGSN is built for common versions of Debian and Ubuntu as part of
95 the [Osmocom Nightly Builds](https://osmocom.org/projects/cellular-infrastructure/wiki/Nightly_Builds)
96 project.  If you don't want to do development, it is suggested to simply
97 use those binary packages, rather than building yourself from source.
100 Installation from source
101 ------------------------
103 1. ./configure
104 2. make
105 3. make install
107 You need to be root in order to install the package, but not in order
108 to compile.
111 Running
112 -------
114 *sgsnemu*
115 Start the emulator as root using the command:
117   sgsnemu -l 10.0.0.50 -r 10.0.0.40 --createif --defaultroute
119 This will cause the sgsn emulator to bind to local address 10.0.0.50
120 and connect to the ggsn found at 10.0.0.40. It will first send off an
121 ECHO_REQUEST message. After this it will attempt to establish a pdp
122 context. If successful it will create a local interface and set up
123 routing. Now you should be able to ping through the connection. Use a
124 network analysator such as ethereal to monitor the traffic.
126 sgsnemu -h will show a list of available options. 
128 sgsnemu -c sgsnemu.conf will use sgsnemu.conf as a configuration
129 file. A sample file is provided in examples/sgsnemu.conf.
131 *ggsn*
132 Edit the configuration file ggsn.conf found under openggsn/examples.
133 Start the ggsn as root using the command:
135 ggsn --fg -c examples/ggsn.conf -l 10.0.0.40 --statedir ./
137 This will run the ggsn in foreground using the local interface
138 10.0.0.40. If you don't have a GSM network available for testing you
139 can use sgsnemu to test the GGSN.
142 Support
143 -------
145 Please contact the Mailing List above for community-based support.
148 Features
149 ========
151 OpenGGSN is an open source implementation of GPRS Support Nodes
152 (GSNs). It implements the GPRS tunneling protocol (GTP) version 0 and
153 version 1.
155 OpenGGSN provides 3 components:
156  * gtplib
157  * ggsn
158  * sgsnemu
160 *gtplib*
161 This library contains all functionality relating to the GTP
162 protocol. Use this library if you want to implement your own
163 GSN. gtplib supports both GTPv0 (GSM 09.60) and GTPv1 (3GPP
164 29.060). At the moment no interface documentation is available for
165 download.
167 *ggsn*
168 The ggsn implements a Gateway GPRS Support Node. The GGSN is a small
169 application which is provided in order to test and demonstrate the use
170 of gtplib. It is fully compliant to the 3GPP standards, but lacks
171 important functionality such as charging and management. Use this
172 application as a starting point if you want to build your own GGSN
173 with your own fancy VPN, management and charging functionality.
175 *sgsnemu*
176 This application emulates a Serving GPRS Support Node (SGSN). sgsnemu
177 enables you to test your 3GPP core network without the need to invest
178 in a 3G radio access network. An important application of sgsnemu is
179 the testing of roaming connectivity through a GPRS roaming
180 exchange. sgsnemu will first attempt to use GTPv1. If unsuccessful it
181 will fallback to GTPv0.
184 Performance
185 ===========
187 Two experiments were performed in order to test the performance of
188 sgsnemu and ggsn. The ggsn used a 550 MHz Athlon with 384 MB of
189 RAM. sgsnemu used a 1 GHz Athlon with 256 MB of RAM. Both machines had
190 100 Mb/s NICs (RTL-8139) and were connected through a crossed patch
191 cable. Both tests were performed by sending ICMP echo packets from
192 sgsnemu to the ggsn.
194 89.5 Mb/s IP throughput when sending 10000 ICMP ping packets with a
195 payload of 1400 bytes. Transfer time 1.27 sec, no packets lost.
197 71.4 Mb/s IP throughput when sending 10000 ICMP ping packets with a
198 payload of 1000 bytes. Transfer time 1.15 sec, no packets lost.
200 12,1 Mb/s IP throughput when sending 10000 ICMP ping packets with a
201 payload of 100 bytes. Transfer time 0.84 sec, no packets lost.
204 Required software
205 =================
210 Both ggsn and sgsnemu uses the tun package. You need at least tun
211 version 1.1. With Linux tun is normally included from kernel version
212 2.4.7. To configure automatic loading:
214 1. Add the following line to /etc/modules.conf: alias char-major-10-200 tun 
215 2. depmod -a
217 Alternatively you can execute "modprobe tun" on the commandline.
219 For Solaris the tun driver needs to be installed manually. For general
220 information about tun see http://vtun.sourceforge.net/tun/
222 Gengetopt
223 ---------
225 Gengetopt is required if you want to change the options defined in the
226 cmdline.ggo source file. You need at least gengetopt version 2.8. If
227 you are just going to compile the programs you don't need gengetopt.
229 To use gengetopt for the ggsn do the following:
230 cd ggsn
231 gengetopt < cmdline.ggo --conf-parser
233 To use gengetopt for the sgsnemu do the following:
234 cd sgsnemu
235 gengetopt < cmdline.ggo --conf-parser
237 For more information about gengetopt see
238 http://www.gnu.org/software/gengetopt/gengetopt.html
241 Compilation and Installation
242 ============================
245 Setting up autotools
246 --------------------
248 You do not need to perform this step if you are only going to compile
249 the package:
251 1. Get version from somewhere: Script to extract version from configure.in
252 2. Copy the latest config.guess and config.sub from ftp://ftp.gnu.org/gnu/config
253 3. Run autoscan and copy configure.scan to configure.in
254 4. Add/edit the following lines in configure.in:
255    - AC_INIT(openggsn, 0.70, jj@openggsn.org)
256    - AC_CONFIG_SRCDIR([gtp/gtp.c])
257    - AM_CONFIG_HEADER([config.h])
258    - AC_PROG_LIBTOOL
259    - AM_PROG_LIBTOOL
260    - AM_INIT_AUTOMAKE()
261 5. libtoolize --automake --copy
262   (ads copy of ltmain.sh)
263 6. aclocal
264 7. autoheader
265 8. automake --add-missing --copy
266   (Ads copy of mkinstalldirs missing, install-sh, depcomp)
267 9. automake
268 10. autoconf
270 The above will initialise the project to the current version of
271 autotools (As installed in RedHat 8.0). See
272 http://sources.redhat.com/autobook/autobook/autobook_25.html#SEC25 
273 for details on autotools.
276 Checking out from CVS
277 ---------------------
279 To download the latest source code from anonymous CVS:
281 cvs -d:pserver:anonymous@cvs.sourceforge.net:/cvsroot/ggsn login
282 cvs -z3 -d:pserver:anonymous@cvs.sourceforge.net:/cvsroot/ggsn co openggsn
284 Or to download from developer CVS:
286 export CVS_RSH=ssh
287 cvs -z3 -d:ext:developername@cvs.sourceforge.net:/cvsroot/ggsn co openggsn
289 Both the above sets of commands creates a new directory called openggsn.
292 Compilation and installation
293 ----------------------------
295 If compiling under Solaris you need to edit the following line in
296 ggsn/Makefile.in and sgsnemu/Makefile.in:
298 LDFLAGS = -Wl,--rpath -Wl,/usr/local/lib @EXEC_LDFLAGS@
300 should be changed to:
302 LDFLAGS =  -lresolv -lsocket -lnsl @EXEC_LDFLAGS@ 
304 Note that the above is not necessary on other platforms. Compilation
305 and installation is performed by the following steps:
307  1. ./configure
308  2. make clean
309  3. cd gtp
310  4. make
311  5. make install (as root)
312  6. cd ..
313    (Step 3 to 6 you only need to run the first time to install libgtp)
314  7. make
315  8. make install (as root)
316  9. Add /usr/local/lib to /etc/ld.so.conf
317 10. run ldconfig
319 (Steps 9 and 10 are not required as path to libgtp is included in Makefile)
321 Documentation can be converted to html by issuing:
323  1. txt2html -pm -tf README > README.html
324  2. txt2html -pm -tf NEWS > NEWS.html
325  3. man2htm ggsn.8 > ggsn.html
326  4. man2htm sgsnemu.8 > sgsnemu.html
329 Installation from binary
330 ------------------------
332 1. rpm -i openggsn-<version>.rpm
334 This will install binaries, man pages, configuration files as well as
335 a Sys V init script for the ggsn.
338 Running ggsn
339 ============
341 Use ggsn -h for a list of available options. All options available on
342 the command line can also be given in a configuration file. See
343 examples/ggsn.conf for the format of this file.
345 Start the ggsn as root using the command:
347 ggsn -c examples/ggsn.conf --fg -l 10.0.0.40 --net 192.168.0.0/24 --dynip 192.168.0.0/24
349 First a tun network interface will be created. In the above example
350 the network interface address is 192.168.0.0 and the mask is
351 255.255.255.0. You can check that this interface is up by using
352 ifconfig.
354 After tun has been successfully established the ggsn will wait for GTP
355 create PDP context requests on the local interface
356 10.0.0.40. Currently all requests are accepted, and no password,
357 username or APN validation is performed.
359 When receiving a create PDP context request a dynamic IP address will
360 be allocated from the address pool determined by --dynip. In the above
361 example the first allocated address will be 192.168.0.1, followed by
362 192.168.0.2 and so on. The request is confirmed by sending a create
363 PDP context response message to the peer (SGSN).
365 Now IP packets will be forwarded between the tun network interface and
366 the established GTP tunnel. In order to allow users to access the
367 external network routing needs to be set up. If private addresses are
368 used you need to configure network address translation. See the Linux
369 Networking HOWTO for details.
371 Remember to enable routing: 
373 echo 1 > /proc/sys/net/ipv4/ip_forward
375 If you installed using a binary RPM package it is possible to start
376 ggsn by using the Sys 5 script:
378 /etc/init.d/ggsn start
381 Running sgsnemu
382 ===============
384 Use sgsnemu -h for a list of available options. All options available
385 on the command line can also be given in a configuration file. See
386 examples/sgsnemu.conf for the format of this file.
388 If you want to test a GRX roaming connection you will need to do the
389 following:
391 1. Install sgsnemu on a Linux Box. See under installation above.
392 2. Connect your Linux box with sgsnemu installed to the GPRS core
393 network. Use the same LAN switch as the one your SGSN is connected
394 to. You also need a free IP address that can be used by sgsnemu.
395 3. You need to configure networking in terms of interface address,
396 subnet mask and default route. See the Linux Networking HOWTO for
397 details.
398 4. Launch sgsnemu with something like:
400 sgsnemu --listen 10.0.0.50 --remote 10.0.0.40 --dns 10.20.38.51 --timelimit 10 --contexts 0 
402 sgsnemu will print something like the following on the screen:
405   Using DNS server:      10.20.38.51 (10.20.38.51)
406   Local IP address is:   10.0.0.50 (10.0.0.50)
407   Remote IP address is:  10.0.0.40 (10.0.0.40)
408   IMSI is:               240011234567890 (0x98765432110042)
409   Using APN:             internet
410   Using MSISDN:          46702123456
412   Initialising GTP library
413   OpenGGSN[1823]: GTP: gtp_newgsn() started
414   Done initialising GTP library
416   Sending off echo request
417   Waiting for response from ggsn........
419   Received echo response. Cause value: 0
421 This is quite good. It means that you managed to send off an echo
422 request to a remote GGSN, and it was friendly enough to answer you. If
423 you did not get an echo response it means that something is wrong
424 either with your setup OR with the GRX connection OR with your roaming
425 partners connection.
427 If the above went well you might want to try to establish a PDP
428 context to the remote GGSN. Note that you should be careful when
429 establishing PDP contexts using sgsnemu as each established PDP
430 context will result in a Charge Detail Record (CDR) being generated by
431 the GGSN. You should use real IMSI and MSISDN from a valid test SIM
432 card. Otherwise some poor customer might get charged for your
433 testing. Also note that you are establishing a connection to the Gi
434 network, so please be carefull not to route internet traffic onto the
435 GPRS core network! Assuming you know what you are doing:
437 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
439 sgsnemu will print something like the following on the screen:
441   Using DNS server:      10.20.38.51 (10.20.38.51)
442   Local IP address is:   10.0.0.50 (10.0.0.50)
443   Remote IP address is:  10.0.0.40 (10.0.0.40)
444   IMSI is:               240011234567890 (0x98765432110042)
445   Using APN:             internet
446   Using MSISDN:          46702123456
448   Initialising GTP library
449   OpenGGSN[1838]: GTP: gtp_newgsn() started
450   Done initialising GTP library
452   Sending off echo request
453   Setting up PDP context #0
454   Waiting for response from ggsn........
456   Received echo response. Cause value: 0
457   Received create PDP context response. Cause value: 128
458   Setting up interface and routing
459   /sbin/ifconfig tun0 192.168.0.1
460   /sbin/route add -net 192.168.0.0 netmask 255.255.255.0 gw 192.168.0.1
463 Now a context is established to the remote GGSN. The IP address of the
464 context is 192.168.0.1. You should be able to ping a known address on
465 the Gi network of the roaming partner. You should even be able to do
466 web browsing through the PDP context.
468 Note however that you probably need to adjust your routing tables, so
469 that you make sure that all GRX traffic is routed to the GPRS core
470 network and everything else through the PDP context. The proper way to
471 do this is to use policy routing. Also note that you are effectively
472 connecting the same computer to both the Gn and Gi network, so please
473 be carefull not to route internet traffic onto the GPRS core network
474 and please protect yourself against hackers! For this reason it is
475 advised to always use --contexts 0 when testing a live network.
477 After --timelimit seconds the PDP context is disconnected with the
478 following messages from sgsnemu:
481   Disconnecting PDP context #0
482   Received delete PDP context response. Cause value: 128
483   Deleting tun interface