blob: 3d55259b188385415537f7b81b0bba0dc414416e [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
jjako409b8552004-02-04 22:57:41 +0000211Checking out from CVS
212---------------------
213
214To download the latest source code from anonymous CVS:
215
216cvs -d:pserver:anonymous@cvs.sourceforge.net:/cvsroot/ggsn login
217cvs -z3 -d:pserver:anonymous@cvs.sourceforge.net:/cvsroot/ggsn co openggsn
218
219Or to download from developer CVS:
220
221export CVS_RSH=ssh
222cvs -z3 -d:ext:developername@cvs.sourceforge.net:/cvsroot/ggsn co openggsn
223
224Both the above sets of commands creates a new directory called openggsn.
225
226
jjakoc13c9df2003-07-07 15:15:38 +0000227Compilation and installation
228----------------------------
jjakob3061692003-01-14 17:13:26 +0000229
jjakoe66a1ba2004-01-16 20:14:11 +0000230If compiling under Solaris you need to edit the following line in
231ggsn/Makefile.in and sgsnemu/Makefile.in:
232
233LDFLAGS = -Wl,--rpath -Wl,/usr/local/lib @EXEC_LDFLAGS@
234
235should be changed to:
236
237LDFLAGS = -lresolv -lsocket -lnsl @EXEC_LDFLAGS@
238
239Note that the above is not necessary on other platforms. Compilation
240and installation is performed by the following steps:
241
jjakoc13c9df2003-07-07 15:15:38 +0000242 1. ./configure
243 2. make clean
244 3. cd gtp
245 4. make
246 5. make install (as root)
247 6. cd ..
jjakob3061692003-01-14 17:13:26 +0000248 (Step 3 to 6 you only need to run the first time to install libgtp)
jjakoc13c9df2003-07-07 15:15:38 +0000249 7. make
250 8. make install (as root)
251 9. Add /usr/local/lib to /etc/ld.so.conf
25210. run ldconfig
253
254(Steps 9 and 10 are not required as path to libgtp is included in Makefile)
255
256Documentation can be converted to html by issuing:
257
258 1. txt2html -pm -tf README > README.html
259 2. txt2html -pm -tf NEWS > NEWS.html
260 3. txt2html -pm -tf ChangeLog > ChangeLog.html
261 4. man2htm ggsn.8 > ggsn.html
262 5. man2htm sgsnemu.8 > sgsnemu.html
jjakob3061692003-01-14 17:13:26 +0000263
jjako52c24142002-12-16 13:33:51 +0000264
jjakoc13c9df2003-07-07 15:15:38 +0000265Installation from binary
266------------------------
267
2681. rpm -i openggsn-<version>.rpm
269
270This will install binaries, man pages, configuration files as well as
271a Sys V init script for the ggsn.
272
273
274Running ggsn
275============
jjakobcbfb412003-01-06 21:21:03 +0000276
277Use ggsn -h for a list of available options. All options available on
278the command line can also be given in a configuration file. See
279examples/ggsn.conf for the format of this file.
jjako52c24142002-12-16 13:33:51 +0000280
jjakoafb2a972003-01-29 21:04:13 +0000281Start the ggsn as root using the command:
282
jjakoe3af7a72003-10-22 09:48:38 +0000283ggsn -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 +0000284
285First a tun network interface will be created. In the above example
286the network interface address is 192.168.0.0 and the mask is
jjako9944eba2003-04-11 10:49:02 +0000287255.255.255.0. You can check that this interface is up by using
jjakoafb2a972003-01-29 21:04:13 +0000288ifconfig.
289
290After tun has been successfully established the ggsn will wait for GTP
291create PDP context requests on the local interface
jjakoc13c9df2003-07-07 15:15:38 +000029210.0.0.40. Currently all requests are accepted, and no password,
jjako9944eba2003-04-11 10:49:02 +0000293username or APN validation is performed.
jjakoafb2a972003-01-29 21:04:13 +0000294
295When receiving a create PDP context request a dynamic IP address will
jjako9944eba2003-04-11 10:49:02 +0000296be allocated from the address pool determined by --dynip. In the above
297example the first allocated address will be 192.168.0.1, followed by
298192.168.0.2 and so on. The request is confirmed by sending a create
299PDP context response message to the peer (SGSN).
jjakoafb2a972003-01-29 21:04:13 +0000300
301Now IP packets will be forwarded between the tun network interface and
302the established GTP tunnel. In order to allow users to access the
303external network routing needs to be set up. If private addresses are
jjako9944eba2003-04-11 10:49:02 +0000304used you need to configure network address translation. See the Linux
305Networking HOWTO for details.
jjakoafb2a972003-01-29 21:04:13 +0000306
jjakoc13c9df2003-07-07 15:15:38 +0000307Remember to enable routing:
jjako7bac2f82003-01-29 10:24:10 +0000308
jjakoc13c9df2003-07-07 15:15:38 +0000309echo 1 > /proc/sys/net/ipv4/ip_forward
310
311If you installed using a binary RPM package it is possible to start
312ggsn by using the Sys 5 script:
313
314/etc/init.d/ggsn start
315
316
317Running sgsnemu
318===============
jjakobcbfb412003-01-06 21:21:03 +0000319
320Use sgsnemu -h for a list of available options. All options available
321on the command line can also be given in a configuration file. See
322examples/sgsnemu.conf for the format of this file.
323
324If you want to test a GRX roaming connection you will need to do the
325following:
326
jjakoc13c9df2003-07-07 15:15:38 +00003271. Install sgsnemu on a Linux Box. See under installation above.
3282. Connect your Linux box with sgsnemu installed to the GPRS core
jjakobcbfb412003-01-06 21:21:03 +0000329network. Use the same LAN switch as the one your SGSN is connected
330to. You also need a free IP address that can be used by sgsnemu.
jjakoc13c9df2003-07-07 15:15:38 +00003313. You need to configure networking in terms of interface address,
jjakobcbfb412003-01-06 21:21:03 +0000332subnet mask and default route. See the Linux Networking HOWTO for
333details.
jjakoc13c9df2003-07-07 15:15:38 +00003344. Launch sgsnemu with something like:
jjakobcbfb412003-01-06 21:21:03 +0000335
jjakoe3af7a72003-10-22 09:48:38 +0000336sgsnemu --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 +0000337
338sgsnemu will print something like the following on the screen:
339
jjakoc13c9df2003-07-07 15:15:38 +0000340<PRE>
341
jjakobcbfb412003-01-06 21:21:03 +0000342 Using DNS server: 10.20.38.51 (10.20.38.51)
jjakoc13c9df2003-07-07 15:15:38 +0000343 Local IP address is: 10.0.0.50 (10.0.0.50)
344 Remote IP address is: 10.0.0.40 (10.0.0.40)
jjakobcbfb412003-01-06 21:21:03 +0000345 IMSI is: 240011234567890 (0x98765432110042)
346 Using APN: internet
347 Using MSISDN: 46702123456
348
349 Initialising GTP library
350 OpenGGSN[1823]: GTP: gtp_newgsn() started
351 Done initialising GTP library
352
353 Sending off echo request
354 Waiting for response from ggsn........
355
356 Received echo response. Cause value: 0
357
jjakoc13c9df2003-07-07 15:15:38 +0000358</PRE>
359
jjakobcbfb412003-01-06 21:21:03 +0000360This is quite good. It means that you managed to send off an echo
361request to a remote GGSN, and it was friendly enough to answer you. If
362you did not get an echo response it means that something is wrong
363either with your setup OR with the GRX connection OR with your roaming
364partners connection.
365
366If the above went well you might want to try to establish a PDP
jjako7bac2f82003-01-29 10:24:10 +0000367context to the remote GGSN. Note that you should be careful when
jjakobcbfb412003-01-06 21:21:03 +0000368establishing PDP contexts using sgsnemu as each established PDP
369context will result in a Charge Detail Record (CDR) being generated by
370the GGSN. You should use real IMSI and MSISDN from a valid test SIM
371card. Otherwise some poor customer might get charged for your
372testing. Also note that you are establishing a connection to the Gi
jjako7bac2f82003-01-29 10:24:10 +0000373network, so please be carefull not to route internet traffic onto the
jjakobcbfb412003-01-06 21:21:03 +0000374GPRS core network! Assuming you know what you are doing:
375
jjakoe3af7a72003-10-22 09:48:38 +0000376sgsnemu --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 +0000377
378sgsnemu will print something like the following on the screen:
379
jjakoc13c9df2003-07-07 15:15:38 +0000380<PRE>
381
jjakobcbfb412003-01-06 21:21:03 +0000382 Using DNS server: 10.20.38.51 (10.20.38.51)
jjakoc13c9df2003-07-07 15:15:38 +0000383 Local IP address is: 10.0.0.50 (10.0.0.50)
384 Remote IP address is: 10.0.0.40 (10.0.0.40)
jjakobcbfb412003-01-06 21:21:03 +0000385 IMSI is: 240011234567890 (0x98765432110042)
386 Using APN: internet
387 Using MSISDN: 46702123456
388
389 Initialising GTP library
390 OpenGGSN[1838]: GTP: gtp_newgsn() started
391 Done initialising GTP library
392
393 Sending off echo request
394 Setting up PDP context #0
395 Waiting for response from ggsn........
396
397 Received echo response. Cause value: 0
398 Received create PDP context response. Cause value: 128
399 Setting up interface and routing
400 /sbin/ifconfig tun0 192.168.0.1
401 /sbin/route add -net 192.168.0.0 netmask 255.255.255.0 gw 192.168.0.1
402
jjakoc13c9df2003-07-07 15:15:38 +0000403</PRE>
jjakobcbfb412003-01-06 21:21:03 +0000404
405Now a context is established to the remote GGSN. The IP address of the
jjako9944eba2003-04-11 10:49:02 +0000406context is 192.168.0.1. You should be able to ping a known address on
407the Gi network of the roaming partner. You should even be able to do
408web browsing through the PDP context.
jjakobcbfb412003-01-06 21:21:03 +0000409
410Note however that you probably need to adjust your routing tables, so
411that you make sure that all GRX traffic is routed to the GPRS core
412network and everything else through the PDP context. The proper way to
413do this is to use policy routing. Also note that you are effectively
414connecting the same computer to both the Gn and Gi network, so please
415be carefull not to route internet traffic onto the GPRS core network
416and please protect yourself against hackers! For this reason it is
417advised to always use --contexts 0 when testing a live network.
418
419After --timelimit seconds the PDP context is disconnected with the
420following messages from sgsnemu:
421
jjakoc13c9df2003-07-07 15:15:38 +0000422
423<PRE>
424
jjakobcbfb412003-01-06 21:21:03 +0000425 Disconnecting PDP context #0
426 Received delete PDP context response. Cause value: 128
427 Deleting tun interface
jjako52c24142002-12-16 13:33:51 +0000428
jjakoc13c9df2003-07-07 15:15:38 +0000429</PRE>
430