blob: aa6013884bdf97ee87a4f2bd169d9fa7036ae4d3 [file] [log] [blame]
jjakoc13c9df2003-07-07 15:15:38 +00001OPENGGSN README
2===============
jjako52c24142002-12-16 13:33:51 +00003
jjako0ac82a12003-01-05 18:36:33 +00004
jjakoc13c9df2003-07-07 15:15:38 +00005QuickStart
6==========
jjako52c24142002-12-16 13:33:51 +00007
jjakoc13c9df2003-07-07 15:15:38 +00008
9Requirements
10------------
11
jjakoff9985c2004-01-16 11:05:22 +000012*Linux*
13OpenGGSN was developed and tested using Redhat 8.0 and 9.0. It should
14run also on other Linux distributions as well as FreeBSD, but this is
jjakoe66a1ba2004-01-16 20:14:11 +000015untested. Compilation on Solaris 2.8 has also been verified.
jjakoc13c9df2003-07-07 15:15:38 +000016
17*Tun*
18The tun driver is required for proper operation of openggsn. For linux
19kernels later than 2.4.7 the driver is typically included, but need
20to be configured for automatic loading:
21
221. Add the following line to /etc/modules.conf: alias char-major-10-200 tun
232. depmod -a
24
25
26Installation from binary
27------------------------
28
29rpm -i openggsn-<version>.rpm
30
31This will install binaries, man pages, configuration files as well as
32a Sys V init script for the ggsn.
33
34
35Installation from source
36------------------------
37
381. ./configure
392. make
403. make install
jjakob3061692003-01-14 17:13:26 +000041
42You need to be root in order to install the package, but not in order
43to compile.
44
jjako52c24142002-12-16 13:33:51 +000045
jjakoc13c9df2003-07-07 15:15:38 +000046Running
47-------
48
49*sgsnemu*
jjakob3061692003-01-14 17:13:26 +000050Start the emulator as root using the command:
jjako52c24142002-12-16 13:33:51 +000051
jjakoc13c9df2003-07-07 15:15:38 +000052 sgsnemu -l 10.0.0.50 -r 10.0.0.40 --createif --defaultroute
jjako52c24142002-12-16 13:33:51 +000053
jjakoc13c9df2003-07-07 15:15:38 +000054This will cause the sgsn emulator to bind to local address 10.0.0.50
55and connect to the ggsn found at 10.0.0.40. It will first send off an
56ECHO_REQUEST message. After this it will attempt to establish a pdp
jjako52c24142002-12-16 13:33:51 +000057context. If successful it will create a local interface and set up
58routing. Now you should be able to ping through the connection. Use a
59network analysator such as ethereal to monitor the traffic.
60
jjakoe3af7a72003-10-22 09:48:38 +000061sgsnemu -h will show a list of available options.
62
63sgsnemu -c sgsnemu.conf will use sgsnemu.conf as a configuration
64file. A sample file is provided in examples/sgsnemu.conf.
jjakoc13c9df2003-07-07 15:15:38 +000065
66*ggsn*
67Edit the configuration file ggsn.conf found under openggsn/examples.
jjakob3061692003-01-14 17:13:26 +000068Start the ggsn as root using the command:
jjako0ac82a12003-01-05 18:36:33 +000069
jjako581c9f02003-10-22 11:28:20 +000070ggsn --fg -c examples/ggsn.conf -l 10.0.0.40 --statedir ./
jjako0ac82a12003-01-05 18:36:33 +000071
jjako52c24142002-12-16 13:33:51 +000072This will run the ggsn in foreground using the local interface
jjakoc13c9df2003-07-07 15:15:38 +00007310.0.0.40. If you don't have a GSM network available for testing you
jjako9944eba2003-04-11 10:49:02 +000074can use sgsnemu to test the GGSN.
jjakobcbfb412003-01-06 21:21:03 +000075
76
jjakoc13c9df2003-07-07 15:15:38 +000077Support
78-------
79
jjakobcbfb412003-01-06 21:21:03 +000080If you have any questions drop me a line at jj@openggsn.org.
jjako52c24142002-12-16 13:33:51 +000081
82
jjakoc13c9df2003-07-07 15:15:38 +000083Features
84========
jjako52c24142002-12-16 13:33:51 +000085
86OpenGGSN is an open source implementation of GPRS Support Nodes
jjakoe3af7a72003-10-22 09:48:38 +000087(GSNs). It implements the GPRS tunneling protocol (GTP) version 0 and
88version 1.
jjako52c24142002-12-16 13:33:51 +000089
90OpenGGSN provides 3 components:
jjakoc13c9df2003-07-07 15:15:38 +000091 * gtplib
92 * ggsn
93 * sgsnemu
jjako52c24142002-12-16 13:33:51 +000094
jjakoc13c9df2003-07-07 15:15:38 +000095*gtplib*
jjako0ac82a12003-01-05 18:36:33 +000096This library contains all functionality relating to the GTP
jjako9944eba2003-04-11 10:49:02 +000097protocol. Use this library if you want to implement your own
jjakoe3af7a72003-10-22 09:48:38 +000098GSN. gtplib supports both GTPv0 (GSM 09.60) and GTPv1 (3GPP
9929.060). At the moment no interface documentation is available for
100download.
jjako52c24142002-12-16 13:33:51 +0000101
jjakoc13c9df2003-07-07 15:15:38 +0000102*ggsn*
jjako0ac82a12003-01-05 18:36:33 +0000103The ggsn implements a Gateway GPRS Support Node. The GGSN is a small
104application which is provided in order to test and demonstrate the use
105of gtplib. It is fully compliant to the 3GPP standards, but lacks
106important functionality such as charging and management. Use this
jjako52c24142002-12-16 13:33:51 +0000107application as a starting point if you want to build your own GGSN
108with your own fancy VPN, management and charging functionality.
109
jjakoc13c9df2003-07-07 15:15:38 +0000110*sgsnemu*
jjako0ac82a12003-01-05 18:36:33 +0000111This application emulates a Serving GPRS Support Node (SGSN). sgsnemu
jjakobcbfb412003-01-06 21:21:03 +0000112enables you to test your 3GPP core network without the need to invest
jjako52c24142002-12-16 13:33:51 +0000113in a 3G radio access network. An important application of sgsnemu is
jjakoe3af7a72003-10-22 09:48:38 +0000114the testing of roaming connectivity through a GPRS roaming
115exchange. sgsnemu will first attempt to use GTPv1. If unsuccessful it
116will fallback to GTPv0.
jjako52c24142002-12-16 13:33:51 +0000117
jjako0ac82a12003-01-05 18:36:33 +0000118
jjakoc13c9df2003-07-07 15:15:38 +0000119Performance
120===========
jjako7bac2f82003-01-29 10:24:10 +0000121
122Two experiments were performed in order to test the performance of
123sgsnemu and ggsn. The ggsn used a 550 MHz Athlon with 384 MB of
124RAM. sgsnemu used a 1 GHz Athlon with 256 MB of RAM. Both machines had
jjakoafb2a972003-01-29 21:04:13 +0000125100 Mb/s NICs (RTL-8139) and were connected through a crossed patch
126cable. Both tests were performed by sending ICMP echo packets from
127sgsnemu to the ggsn.
jjako7bac2f82003-01-29 10:24:10 +0000128
jjakoafb2a972003-01-29 21:04:13 +000012989.5 Mb/s IP throughput when sending 10000 ICMP ping packets with a
130payload of 1400 bytes. Transfer time 1.27 sec, no packets lost.
jjako7bac2f82003-01-29 10:24:10 +0000131
jjakoafb2a972003-01-29 21:04:13 +000013271.4 Mb/s IP throughput when sending 10000 ICMP ping packets with a
133payload of 1000 bytes. Transfer time 1.15 sec, no packets lost.
134
13512,1 Mb/s IP throughput when sending 10000 ICMP ping packets with a
136payload of 100 bytes. Transfer time 0.84 sec, no packets lost.
jjako7bac2f82003-01-29 10:24:10 +0000137
138
jjakoc13c9df2003-07-07 15:15:38 +0000139Required software
140=================
jjako52c24142002-12-16 13:33:51 +0000141
jjakoc13c9df2003-07-07 15:15:38 +0000142Tun
143---
jjako52c24142002-12-16 13:33:51 +0000144
145Both ggsn and sgsnemu uses the tun package. You need at least tun
jjakoc13c9df2003-07-07 15:15:38 +0000146version 1.1. With Linux tun is normally included from kernel version
1472.4.7. To configure automatic loading:
jjako0ac82a12003-01-05 18:36:33 +0000148
jjakoc13c9df2003-07-07 15:15:38 +00001491. Add the following line to /etc/modules.conf: alias char-major-10-200 tun
1502. depmod -a
jjako52c24142002-12-16 13:33:51 +0000151
jjakoc13c9df2003-07-07 15:15:38 +0000152Alternatively you can execute "modprobe tun" on the commandline.
153
jjakoaa0a0ab2004-01-10 02:02:04 +0000154For Solaris the tun driver needs to be installed manually. For general
155information about tun see http://vtun.sourceforge.net/tun/
jjakoc13c9df2003-07-07 15:15:38 +0000156
157Gengetopt
158---------
jjako52c24142002-12-16 13:33:51 +0000159
160Gengetopt is required if you want to change the options defined in the
jjakobcbfb412003-01-06 21:21:03 +0000161cmdline.ggo source file. You need at least gengetopt version 2.8. If
162you are just going to compile the programs you don't need gengetopt.
jjako52c24142002-12-16 13:33:51 +0000163
jjako0ac82a12003-01-05 18:36:33 +0000164To use gengetopt for the ggsn do the following:
jjako52c24142002-12-16 13:33:51 +0000165cd ggsn
jjako0ac82a12003-01-05 18:36:33 +0000166gengetopt < cmdline.ggo --conf-parser
jjako52c24142002-12-16 13:33:51 +0000167
jjako0ac82a12003-01-05 18:36:33 +0000168To use gengetopt for the sgsnemu do the following:
jjako52c24142002-12-16 13:33:51 +0000169cd sgsnemu
jjako0ac82a12003-01-05 18:36:33 +0000170gengetopt < cmdline.ggo --conf-parser
jjako52c24142002-12-16 13:33:51 +0000171
jjakoc13c9df2003-07-07 15:15:38 +0000172For more information about gengetopt see
173http://www.gnu.org/software/gengetopt/gengetopt.html
jjako52c24142002-12-16 13:33:51 +0000174
jjako52c24142002-12-16 13:33:51 +0000175
jjakoc13c9df2003-07-07 15:15:38 +0000176Compilation and Installation
177============================
178
179
180Setting up autotools
181--------------------
jjakob3061692003-01-14 17:13:26 +0000182
183You do not need to perform this step if you are only going to compile
184the package:
185
jjakoc13c9df2003-07-07 15:15:38 +00001861. Get version from somewhere: Script to extract version from configure.in
1872. Copy the latest config.guess and config.sub from ftp://ftp.gnu.org/gnu/config
1883. Run autoscan and copy configure.scan to configure.in
1894. Add/edit the following lines in configure.in:
jjakoe3af7a72003-10-22 09:48:38 +0000190 - AC_INIT(openggsn, 0.70, jj@openggsn.org)
jjakoc13c9df2003-07-07 15:15:38 +0000191 - AC_CONFIG_SRCDIR([gtp/gtp.c])
192 - AM_CONFIG_HEADER([config.h])
193 - AC_PROG_LIBTOOL
194 - AM_PROG_LIBTOOL
195 - AM_INIT_AUTOMAKE()
1965. libtoolize --automake --copy
jjakob3061692003-01-14 17:13:26 +0000197 (ads copy of ltmain.sh)
jjakoc13c9df2003-07-07 15:15:38 +00001986. aclocal
1997. autoheader
2008. automake --add-missing --copy
jjako7bac2f82003-01-29 10:24:10 +0000201 (Ads copy of mkinstalldirs missing, install-sh, depcomp)
jjakoc13c9df2003-07-07 15:15:38 +00002029. automake
20310. autoconf
jjakob3061692003-01-14 17:13:26 +0000204
205The above will initialise the project to the current version of
206autotools (As installed in RedHat 8.0). See
207http://sources.redhat.com/autobook/autobook/autobook_25.html#SEC25
208for details on autotools.
jjako52c24142002-12-16 13:33:51 +0000209
210
jjakoc13c9df2003-07-07 15:15:38 +0000211Compilation and installation
212----------------------------
jjakob3061692003-01-14 17:13:26 +0000213
jjakoe66a1ba2004-01-16 20:14:11 +0000214If compiling under Solaris you need to edit the following line in
215ggsn/Makefile.in and sgsnemu/Makefile.in:
216
217LDFLAGS = -Wl,--rpath -Wl,/usr/local/lib @EXEC_LDFLAGS@
218
219should be changed to:
220
221LDFLAGS = -lresolv -lsocket -lnsl @EXEC_LDFLAGS@
222
223Note that the above is not necessary on other platforms. Compilation
224and installation is performed by the following steps:
225
jjakoc13c9df2003-07-07 15:15:38 +0000226 1. ./configure
227 2. make clean
228 3. cd gtp
229 4. make
230 5. make install (as root)
231 6. cd ..
jjakob3061692003-01-14 17:13:26 +0000232 (Step 3 to 6 you only need to run the first time to install libgtp)
jjakoc13c9df2003-07-07 15:15:38 +0000233 7. make
234 8. make install (as root)
235 9. Add /usr/local/lib to /etc/ld.so.conf
23610. run ldconfig
237
238(Steps 9 and 10 are not required as path to libgtp is included in Makefile)
239
240Documentation can be converted to html by issuing:
241
242 1. txt2html -pm -tf README > README.html
243 2. txt2html -pm -tf NEWS > NEWS.html
244 3. txt2html -pm -tf ChangeLog > ChangeLog.html
245 4. man2htm ggsn.8 > ggsn.html
246 5. man2htm sgsnemu.8 > sgsnemu.html
jjakob3061692003-01-14 17:13:26 +0000247
jjako52c24142002-12-16 13:33:51 +0000248
jjakoc13c9df2003-07-07 15:15:38 +0000249Installation from binary
250------------------------
251
2521. rpm -i openggsn-<version>.rpm
253
254This will install binaries, man pages, configuration files as well as
255a Sys V init script for the ggsn.
256
257
258Running ggsn
259============
jjakobcbfb412003-01-06 21:21:03 +0000260
261Use ggsn -h for a list of available options. All options available on
262the command line can also be given in a configuration file. See
263examples/ggsn.conf for the format of this file.
jjako52c24142002-12-16 13:33:51 +0000264
jjakoafb2a972003-01-29 21:04:13 +0000265Start the ggsn as root using the command:
266
jjakoe3af7a72003-10-22 09:48:38 +0000267ggsn -c examples/ggsn.conf --fg -l 10.0.0.40 --net 192.168.0.0/24 --dynip 192.168.0.0/24
jjakoafb2a972003-01-29 21:04:13 +0000268
269First a tun network interface will be created. In the above example
270the network interface address is 192.168.0.0 and the mask is
jjako9944eba2003-04-11 10:49:02 +0000271255.255.255.0. You can check that this interface is up by using
jjakoafb2a972003-01-29 21:04:13 +0000272ifconfig.
273
274After tun has been successfully established the ggsn will wait for GTP
275create PDP context requests on the local interface
jjakoc13c9df2003-07-07 15:15:38 +000027610.0.0.40. Currently all requests are accepted, and no password,
jjako9944eba2003-04-11 10:49:02 +0000277username or APN validation is performed.
jjakoafb2a972003-01-29 21:04:13 +0000278
279When receiving a create PDP context request a dynamic IP address will
jjako9944eba2003-04-11 10:49:02 +0000280be allocated from the address pool determined by --dynip. In the above
281example the first allocated address will be 192.168.0.1, followed by
282192.168.0.2 and so on. The request is confirmed by sending a create
283PDP context response message to the peer (SGSN).
jjakoafb2a972003-01-29 21:04:13 +0000284
285Now IP packets will be forwarded between the tun network interface and
286the established GTP tunnel. In order to allow users to access the
287external network routing needs to be set up. If private addresses are
jjako9944eba2003-04-11 10:49:02 +0000288used you need to configure network address translation. See the Linux
289Networking HOWTO for details.
jjakoafb2a972003-01-29 21:04:13 +0000290
jjakoc13c9df2003-07-07 15:15:38 +0000291Remember to enable routing:
jjako7bac2f82003-01-29 10:24:10 +0000292
jjakoc13c9df2003-07-07 15:15:38 +0000293echo 1 > /proc/sys/net/ipv4/ip_forward
294
295If you installed using a binary RPM package it is possible to start
296ggsn by using the Sys 5 script:
297
298/etc/init.d/ggsn start
299
300
301Running sgsnemu
302===============
jjakobcbfb412003-01-06 21:21:03 +0000303
304Use sgsnemu -h for a list of available options. All options available
305on the command line can also be given in a configuration file. See
306examples/sgsnemu.conf for the format of this file.
307
308If you want to test a GRX roaming connection you will need to do the
309following:
310
jjakoc13c9df2003-07-07 15:15:38 +00003111. Install sgsnemu on a Linux Box. See under installation above.
3122. Connect your Linux box with sgsnemu installed to the GPRS core
jjakobcbfb412003-01-06 21:21:03 +0000313network. Use the same LAN switch as the one your SGSN is connected
314to. You also need a free IP address that can be used by sgsnemu.
jjakoc13c9df2003-07-07 15:15:38 +00003153. You need to configure networking in terms of interface address,
jjakobcbfb412003-01-06 21:21:03 +0000316subnet mask and default route. See the Linux Networking HOWTO for
317details.
jjakoc13c9df2003-07-07 15:15:38 +00003184. Launch sgsnemu with something like:
jjakobcbfb412003-01-06 21:21:03 +0000319
jjakoe3af7a72003-10-22 09:48:38 +0000320sgsnemu --listen 10.0.0.50 --remote 10.0.0.40 --dns 10.20.38.51 --timelimit 10 --contexts 0
jjakobcbfb412003-01-06 21:21:03 +0000321
322sgsnemu will print something like the following on the screen:
323
jjakoc13c9df2003-07-07 15:15:38 +0000324<PRE>
325
jjakobcbfb412003-01-06 21:21:03 +0000326 Using DNS server: 10.20.38.51 (10.20.38.51)
jjakoc13c9df2003-07-07 15:15:38 +0000327 Local IP address is: 10.0.0.50 (10.0.0.50)
328 Remote IP address is: 10.0.0.40 (10.0.0.40)
jjakobcbfb412003-01-06 21:21:03 +0000329 IMSI is: 240011234567890 (0x98765432110042)
330 Using APN: internet
331 Using MSISDN: 46702123456
332
333 Initialising GTP library
334 OpenGGSN[1823]: GTP: gtp_newgsn() started
335 Done initialising GTP library
336
337 Sending off echo request
338 Waiting for response from ggsn........
339
340 Received echo response. Cause value: 0
341
jjakoc13c9df2003-07-07 15:15:38 +0000342</PRE>
343
jjakobcbfb412003-01-06 21:21:03 +0000344This is quite good. It means that you managed to send off an echo
345request to a remote GGSN, and it was friendly enough to answer you. If
346you did not get an echo response it means that something is wrong
347either with your setup OR with the GRX connection OR with your roaming
348partners connection.
349
350If the above went well you might want to try to establish a PDP
jjako7bac2f82003-01-29 10:24:10 +0000351context to the remote GGSN. Note that you should be careful when
jjakobcbfb412003-01-06 21:21:03 +0000352establishing PDP contexts using sgsnemu as each established PDP
353context will result in a Charge Detail Record (CDR) being generated by
354the GGSN. You should use real IMSI and MSISDN from a valid test SIM
355card. Otherwise some poor customer might get charged for your
356testing. Also note that you are establishing a connection to the Gi
jjako7bac2f82003-01-29 10:24:10 +0000357network, so please be carefull not to route internet traffic onto the
jjakobcbfb412003-01-06 21:21:03 +0000358GPRS core network! Assuming you know what you are doing:
359
jjakoe3af7a72003-10-22 09:48:38 +0000360sgsnemu --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
jjakobcbfb412003-01-06 21:21:03 +0000361
362sgsnemu will print something like the following on the screen:
363
jjakoc13c9df2003-07-07 15:15:38 +0000364<PRE>
365
jjakobcbfb412003-01-06 21:21:03 +0000366 Using DNS server: 10.20.38.51 (10.20.38.51)
jjakoc13c9df2003-07-07 15:15:38 +0000367 Local IP address is: 10.0.0.50 (10.0.0.50)
368 Remote IP address is: 10.0.0.40 (10.0.0.40)
jjakobcbfb412003-01-06 21:21:03 +0000369 IMSI is: 240011234567890 (0x98765432110042)
370 Using APN: internet
371 Using MSISDN: 46702123456
372
373 Initialising GTP library
374 OpenGGSN[1838]: GTP: gtp_newgsn() started
375 Done initialising GTP library
376
377 Sending off echo request
378 Setting up PDP context #0
379 Waiting for response from ggsn........
380
381 Received echo response. Cause value: 0
382 Received create PDP context response. Cause value: 128
383 Setting up interface and routing
384 /sbin/ifconfig tun0 192.168.0.1
385 /sbin/route add -net 192.168.0.0 netmask 255.255.255.0 gw 192.168.0.1
386
jjakoc13c9df2003-07-07 15:15:38 +0000387</PRE>
jjakobcbfb412003-01-06 21:21:03 +0000388
389Now a context is established to the remote GGSN. The IP address of the
jjako9944eba2003-04-11 10:49:02 +0000390context is 192.168.0.1. You should be able to ping a known address on
391the Gi network of the roaming partner. You should even be able to do
392web browsing through the PDP context.
jjakobcbfb412003-01-06 21:21:03 +0000393
394Note however that you probably need to adjust your routing tables, so
395that you make sure that all GRX traffic is routed to the GPRS core
396network and everything else through the PDP context. The proper way to
397do this is to use policy routing. Also note that you are effectively
398connecting the same computer to both the Gn and Gi network, so please
399be carefull not to route internet traffic onto the GPRS core network
400and please protect yourself against hackers! For this reason it is
401advised to always use --contexts 0 when testing a live network.
402
403After --timelimit seconds the PDP context is disconnected with the
404following messages from sgsnemu:
405
jjakoc13c9df2003-07-07 15:15:38 +0000406
407<PRE>
408
jjakobcbfb412003-01-06 21:21:03 +0000409 Disconnecting PDP context #0
410 Received delete PDP context response. Cause value: 128
411 Deleting tun interface
jjako52c24142002-12-16 13:33:51 +0000412
jjakoc13c9df2003-07-07 15:15:38 +0000413</PRE>
414