blob: 3a254a52bae29068fe30081bd7b8b1e7d53296da [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
15untested. Compilation on Solaris 2.8 has also been verified. Please
16tell me of any testing results.
jjakoc13c9df2003-07-07 15:15:38 +000017
18*Tun*
19The tun driver is required for proper operation of openggsn. For linux
20kernels later than 2.4.7 the driver is typically included, but need
21to be configured for automatic loading:
22
231. Add the following line to /etc/modules.conf: alias char-major-10-200 tun
242. depmod -a
25
26
27Installation from binary
28------------------------
29
30rpm -i openggsn-<version>.rpm
31
32This will install binaries, man pages, configuration files as well as
33a Sys V init script for the ggsn.
34
35
36Installation from source
37------------------------
38
391. ./configure
402. make
413. make install
jjakob3061692003-01-14 17:13:26 +000042
43You need to be root in order to install the package, but not in order
44to compile.
45
jjako52c24142002-12-16 13:33:51 +000046
jjakoc13c9df2003-07-07 15:15:38 +000047Running
48-------
49
50*sgsnemu*
jjakob3061692003-01-14 17:13:26 +000051Start the emulator as root using the command:
jjako52c24142002-12-16 13:33:51 +000052
jjakoc13c9df2003-07-07 15:15:38 +000053 sgsnemu -l 10.0.0.50 -r 10.0.0.40 --createif --defaultroute
jjako52c24142002-12-16 13:33:51 +000054
jjakoc13c9df2003-07-07 15:15:38 +000055This will cause the sgsn emulator to bind to local address 10.0.0.50
56and connect to the ggsn found at 10.0.0.40. It will first send off an
57ECHO_REQUEST message. After this it will attempt to establish a pdp
jjako52c24142002-12-16 13:33:51 +000058context. If successful it will create a local interface and set up
59routing. Now you should be able to ping through the connection. Use a
60network analysator such as ethereal to monitor the traffic.
61
jjakoe3af7a72003-10-22 09:48:38 +000062sgsnemu -h will show a list of available options.
63
64sgsnemu -c sgsnemu.conf will use sgsnemu.conf as a configuration
65file. A sample file is provided in examples/sgsnemu.conf.
jjakoc13c9df2003-07-07 15:15:38 +000066
67*ggsn*
68Edit the configuration file ggsn.conf found under openggsn/examples.
jjakob3061692003-01-14 17:13:26 +000069Start the ggsn as root using the command:
jjako0ac82a12003-01-05 18:36:33 +000070
jjako581c9f02003-10-22 11:28:20 +000071ggsn --fg -c examples/ggsn.conf -l 10.0.0.40 --statedir ./
jjako0ac82a12003-01-05 18:36:33 +000072
jjako52c24142002-12-16 13:33:51 +000073This will run the ggsn in foreground using the local interface
jjakoc13c9df2003-07-07 15:15:38 +00007410.0.0.40. If you don't have a GSM network available for testing you
jjako9944eba2003-04-11 10:49:02 +000075can use sgsnemu to test the GGSN.
jjakobcbfb412003-01-06 21:21:03 +000076
77
jjakoc13c9df2003-07-07 15:15:38 +000078Support
79-------
80
jjakobcbfb412003-01-06 21:21:03 +000081If you have any questions drop me a line at jj@openggsn.org.
jjako52c24142002-12-16 13:33:51 +000082
83
jjakoc13c9df2003-07-07 15:15:38 +000084Features
85========
jjako52c24142002-12-16 13:33:51 +000086
87OpenGGSN is an open source implementation of GPRS Support Nodes
jjakoe3af7a72003-10-22 09:48:38 +000088(GSNs). It implements the GPRS tunneling protocol (GTP) version 0 and
89version 1.
jjako52c24142002-12-16 13:33:51 +000090
91OpenGGSN provides 3 components:
jjakoc13c9df2003-07-07 15:15:38 +000092 * gtplib
93 * ggsn
94 * sgsnemu
jjako52c24142002-12-16 13:33:51 +000095
jjakoc13c9df2003-07-07 15:15:38 +000096*gtplib*
jjako0ac82a12003-01-05 18:36:33 +000097This library contains all functionality relating to the GTP
jjako9944eba2003-04-11 10:49:02 +000098protocol. Use this library if you want to implement your own
jjakoe3af7a72003-10-22 09:48:38 +000099GSN. gtplib supports both GTPv0 (GSM 09.60) and GTPv1 (3GPP
10029.060). At the moment no interface documentation is available for
101download.
jjako52c24142002-12-16 13:33:51 +0000102
jjakoc13c9df2003-07-07 15:15:38 +0000103*ggsn*
jjako0ac82a12003-01-05 18:36:33 +0000104The ggsn implements a Gateway GPRS Support Node. The GGSN is a small
105application which is provided in order to test and demonstrate the use
106of gtplib. It is fully compliant to the 3GPP standards, but lacks
107important functionality such as charging and management. Use this
jjako52c24142002-12-16 13:33:51 +0000108application as a starting point if you want to build your own GGSN
109with your own fancy VPN, management and charging functionality.
110
jjakoc13c9df2003-07-07 15:15:38 +0000111*sgsnemu*
jjako0ac82a12003-01-05 18:36:33 +0000112This application emulates a Serving GPRS Support Node (SGSN). sgsnemu
jjakobcbfb412003-01-06 21:21:03 +0000113enables you to test your 3GPP core network without the need to invest
jjako52c24142002-12-16 13:33:51 +0000114in a 3G radio access network. An important application of sgsnemu is
jjakoe3af7a72003-10-22 09:48:38 +0000115the testing of roaming connectivity through a GPRS roaming
116exchange. sgsnemu will first attempt to use GTPv1. If unsuccessful it
117will fallback to GTPv0.
jjako52c24142002-12-16 13:33:51 +0000118
jjako0ac82a12003-01-05 18:36:33 +0000119
jjakoc13c9df2003-07-07 15:15:38 +0000120Performance
121===========
jjako7bac2f82003-01-29 10:24:10 +0000122
123Two experiments were performed in order to test the performance of
124sgsnemu and ggsn. The ggsn used a 550 MHz Athlon with 384 MB of
125RAM. sgsnemu used a 1 GHz Athlon with 256 MB of RAM. Both machines had
jjakoafb2a972003-01-29 21:04:13 +0000126100 Mb/s NICs (RTL-8139) and were connected through a crossed patch
127cable. Both tests were performed by sending ICMP echo packets from
128sgsnemu to the ggsn.
jjako7bac2f82003-01-29 10:24:10 +0000129
jjakoafb2a972003-01-29 21:04:13 +000013089.5 Mb/s IP throughput when sending 10000 ICMP ping packets with a
131payload of 1400 bytes. Transfer time 1.27 sec, no packets lost.
jjako7bac2f82003-01-29 10:24:10 +0000132
jjakoafb2a972003-01-29 21:04:13 +000013371.4 Mb/s IP throughput when sending 10000 ICMP ping packets with a
134payload of 1000 bytes. Transfer time 1.15 sec, no packets lost.
135
13612,1 Mb/s IP throughput when sending 10000 ICMP ping packets with a
137payload of 100 bytes. Transfer time 0.84 sec, no packets lost.
jjako7bac2f82003-01-29 10:24:10 +0000138
139
jjakoc13c9df2003-07-07 15:15:38 +0000140Required software
141=================
jjako52c24142002-12-16 13:33:51 +0000142
jjakoc13c9df2003-07-07 15:15:38 +0000143Tun
144---
jjako52c24142002-12-16 13:33:51 +0000145
146Both ggsn and sgsnemu uses the tun package. You need at least tun
jjakoc13c9df2003-07-07 15:15:38 +0000147version 1.1. With Linux tun is normally included from kernel version
1482.4.7. To configure automatic loading:
jjako0ac82a12003-01-05 18:36:33 +0000149
jjakoc13c9df2003-07-07 15:15:38 +00001501. Add the following line to /etc/modules.conf: alias char-major-10-200 tun
1512. depmod -a
jjako52c24142002-12-16 13:33:51 +0000152
jjakoc13c9df2003-07-07 15:15:38 +0000153Alternatively you can execute "modprobe tun" on the commandline.
154
jjakoaa0a0ab2004-01-10 02:02:04 +0000155For Solaris the tun driver needs to be installed manually. For general
156information about tun see http://vtun.sourceforge.net/tun/
jjakoc13c9df2003-07-07 15:15:38 +0000157
158Gengetopt
159---------
jjako52c24142002-12-16 13:33:51 +0000160
161Gengetopt is required if you want to change the options defined in the
jjakobcbfb412003-01-06 21:21:03 +0000162cmdline.ggo source file. You need at least gengetopt version 2.8. If
163you are just going to compile the programs you don't need gengetopt.
jjako52c24142002-12-16 13:33:51 +0000164
jjako0ac82a12003-01-05 18:36:33 +0000165To use gengetopt for the ggsn do the following:
jjako52c24142002-12-16 13:33:51 +0000166cd ggsn
jjako0ac82a12003-01-05 18:36:33 +0000167gengetopt < cmdline.ggo --conf-parser
jjako52c24142002-12-16 13:33:51 +0000168
jjako0ac82a12003-01-05 18:36:33 +0000169To use gengetopt for the sgsnemu do the following:
jjako52c24142002-12-16 13:33:51 +0000170cd sgsnemu
jjako0ac82a12003-01-05 18:36:33 +0000171gengetopt < cmdline.ggo --conf-parser
jjako52c24142002-12-16 13:33:51 +0000172
jjakoc13c9df2003-07-07 15:15:38 +0000173For more information about gengetopt see
174http://www.gnu.org/software/gengetopt/gengetopt.html
jjako52c24142002-12-16 13:33:51 +0000175
jjako52c24142002-12-16 13:33:51 +0000176
jjakoc13c9df2003-07-07 15:15:38 +0000177Compilation and Installation
178============================
179
180
181Setting up autotools
182--------------------
jjakob3061692003-01-14 17:13:26 +0000183
184You do not need to perform this step if you are only going to compile
185the package:
186
jjakoc13c9df2003-07-07 15:15:38 +00001871. Get version from somewhere: Script to extract version from configure.in
1882. Copy the latest config.guess and config.sub from ftp://ftp.gnu.org/gnu/config
1893. Run autoscan and copy configure.scan to configure.in
1904. Add/edit the following lines in configure.in:
jjakoe3af7a72003-10-22 09:48:38 +0000191 - AC_INIT(openggsn, 0.70, jj@openggsn.org)
jjakoc13c9df2003-07-07 15:15:38 +0000192 - AC_CONFIG_SRCDIR([gtp/gtp.c])
193 - AM_CONFIG_HEADER([config.h])
194 - AC_PROG_LIBTOOL
195 - AM_PROG_LIBTOOL
196 - AM_INIT_AUTOMAKE()
1975. libtoolize --automake --copy
jjakob3061692003-01-14 17:13:26 +0000198 (ads copy of ltmain.sh)
jjakoc13c9df2003-07-07 15:15:38 +00001996. aclocal
2007. autoheader
2018. automake --add-missing --copy
jjako7bac2f82003-01-29 10:24:10 +0000202 (Ads copy of mkinstalldirs missing, install-sh, depcomp)
jjakoc13c9df2003-07-07 15:15:38 +00002039. automake
20410. autoconf
jjakob3061692003-01-14 17:13:26 +0000205
206The above will initialise the project to the current version of
207autotools (As installed in RedHat 8.0). See
208http://sources.redhat.com/autobook/autobook/autobook_25.html#SEC25
209for details on autotools.
jjako52c24142002-12-16 13:33:51 +0000210
211
jjakoc13c9df2003-07-07 15:15:38 +0000212Compilation and installation
213----------------------------
jjakob3061692003-01-14 17:13:26 +0000214
jjakoc13c9df2003-07-07 15:15:38 +0000215 1. ./configure
216 2. make clean
217 3. cd gtp
218 4. make
219 5. make install (as root)
220 6. cd ..
jjakob3061692003-01-14 17:13:26 +0000221 (Step 3 to 6 you only need to run the first time to install libgtp)
jjakoc13c9df2003-07-07 15:15:38 +0000222 7. make
223 8. make install (as root)
224 9. Add /usr/local/lib to /etc/ld.so.conf
22510. run ldconfig
226
227(Steps 9 and 10 are not required as path to libgtp is included in Makefile)
228
229Documentation can be converted to html by issuing:
230
231 1. txt2html -pm -tf README > README.html
232 2. txt2html -pm -tf NEWS > NEWS.html
233 3. txt2html -pm -tf ChangeLog > ChangeLog.html
234 4. man2htm ggsn.8 > ggsn.html
235 5. man2htm sgsnemu.8 > sgsnemu.html
jjakob3061692003-01-14 17:13:26 +0000236
jjako52c24142002-12-16 13:33:51 +0000237
jjakoc13c9df2003-07-07 15:15:38 +0000238Installation from binary
239------------------------
240
2411. rpm -i openggsn-<version>.rpm
242
243This will install binaries, man pages, configuration files as well as
244a Sys V init script for the ggsn.
245
246
247Running ggsn
248============
jjakobcbfb412003-01-06 21:21:03 +0000249
250Use ggsn -h for a list of available options. All options available on
251the command line can also be given in a configuration file. See
252examples/ggsn.conf for the format of this file.
jjako52c24142002-12-16 13:33:51 +0000253
jjakoafb2a972003-01-29 21:04:13 +0000254Start the ggsn as root using the command:
255
jjakoe3af7a72003-10-22 09:48:38 +0000256ggsn -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 +0000257
258First a tun network interface will be created. In the above example
259the network interface address is 192.168.0.0 and the mask is
jjako9944eba2003-04-11 10:49:02 +0000260255.255.255.0. You can check that this interface is up by using
jjakoafb2a972003-01-29 21:04:13 +0000261ifconfig.
262
263After tun has been successfully established the ggsn will wait for GTP
264create PDP context requests on the local interface
jjakoc13c9df2003-07-07 15:15:38 +000026510.0.0.40. Currently all requests are accepted, and no password,
jjako9944eba2003-04-11 10:49:02 +0000266username or APN validation is performed.
jjakoafb2a972003-01-29 21:04:13 +0000267
268When receiving a create PDP context request a dynamic IP address will
jjako9944eba2003-04-11 10:49:02 +0000269be allocated from the address pool determined by --dynip. In the above
270example the first allocated address will be 192.168.0.1, followed by
271192.168.0.2 and so on. The request is confirmed by sending a create
272PDP context response message to the peer (SGSN).
jjakoafb2a972003-01-29 21:04:13 +0000273
274Now IP packets will be forwarded between the tun network interface and
275the established GTP tunnel. In order to allow users to access the
276external network routing needs to be set up. If private addresses are
jjako9944eba2003-04-11 10:49:02 +0000277used you need to configure network address translation. See the Linux
278Networking HOWTO for details.
jjakoafb2a972003-01-29 21:04:13 +0000279
jjakoc13c9df2003-07-07 15:15:38 +0000280Remember to enable routing:
jjako7bac2f82003-01-29 10:24:10 +0000281
jjakoc13c9df2003-07-07 15:15:38 +0000282echo 1 > /proc/sys/net/ipv4/ip_forward
283
284If you installed using a binary RPM package it is possible to start
285ggsn by using the Sys 5 script:
286
287/etc/init.d/ggsn start
288
289
290Running sgsnemu
291===============
jjakobcbfb412003-01-06 21:21:03 +0000292
293Use sgsnemu -h for a list of available options. All options available
294on the command line can also be given in a configuration file. See
295examples/sgsnemu.conf for the format of this file.
296
297If you want to test a GRX roaming connection you will need to do the
298following:
299
jjakoc13c9df2003-07-07 15:15:38 +00003001. Install sgsnemu on a Linux Box. See under installation above.
3012. Connect your Linux box with sgsnemu installed to the GPRS core
jjakobcbfb412003-01-06 21:21:03 +0000302network. Use the same LAN switch as the one your SGSN is connected
303to. You also need a free IP address that can be used by sgsnemu.
jjakoc13c9df2003-07-07 15:15:38 +00003043. You need to configure networking in terms of interface address,
jjakobcbfb412003-01-06 21:21:03 +0000305subnet mask and default route. See the Linux Networking HOWTO for
306details.
jjakoc13c9df2003-07-07 15:15:38 +00003074. Launch sgsnemu with something like:
jjakobcbfb412003-01-06 21:21:03 +0000308
jjakoe3af7a72003-10-22 09:48:38 +0000309sgsnemu --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 +0000310
311sgsnemu will print something like the following on the screen:
312
jjakoc13c9df2003-07-07 15:15:38 +0000313<PRE>
314
jjakobcbfb412003-01-06 21:21:03 +0000315 Using DNS server: 10.20.38.51 (10.20.38.51)
jjakoc13c9df2003-07-07 15:15:38 +0000316 Local IP address is: 10.0.0.50 (10.0.0.50)
317 Remote IP address is: 10.0.0.40 (10.0.0.40)
jjakobcbfb412003-01-06 21:21:03 +0000318 IMSI is: 240011234567890 (0x98765432110042)
319 Using APN: internet
320 Using MSISDN: 46702123456
321
322 Initialising GTP library
323 OpenGGSN[1823]: GTP: gtp_newgsn() started
324 Done initialising GTP library
325
326 Sending off echo request
327 Waiting for response from ggsn........
328
329 Received echo response. Cause value: 0
330
jjakoc13c9df2003-07-07 15:15:38 +0000331</PRE>
332
jjakobcbfb412003-01-06 21:21:03 +0000333This is quite good. It means that you managed to send off an echo
334request to a remote GGSN, and it was friendly enough to answer you. If
335you did not get an echo response it means that something is wrong
336either with your setup OR with the GRX connection OR with your roaming
337partners connection.
338
339If the above went well you might want to try to establish a PDP
jjako7bac2f82003-01-29 10:24:10 +0000340context to the remote GGSN. Note that you should be careful when
jjakobcbfb412003-01-06 21:21:03 +0000341establishing PDP contexts using sgsnemu as each established PDP
342context will result in a Charge Detail Record (CDR) being generated by
343the GGSN. You should use real IMSI and MSISDN from a valid test SIM
344card. Otherwise some poor customer might get charged for your
345testing. Also note that you are establishing a connection to the Gi
jjako7bac2f82003-01-29 10:24:10 +0000346network, so please be carefull not to route internet traffic onto the
jjakobcbfb412003-01-06 21:21:03 +0000347GPRS core network! Assuming you know what you are doing:
348
jjakoe3af7a72003-10-22 09:48:38 +0000349sgsnemu --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 +0000350
351sgsnemu will print something like the following on the screen:
352
jjakoc13c9df2003-07-07 15:15:38 +0000353<PRE>
354
jjakobcbfb412003-01-06 21:21:03 +0000355 Using DNS server: 10.20.38.51 (10.20.38.51)
jjakoc13c9df2003-07-07 15:15:38 +0000356 Local IP address is: 10.0.0.50 (10.0.0.50)
357 Remote IP address is: 10.0.0.40 (10.0.0.40)
jjakobcbfb412003-01-06 21:21:03 +0000358 IMSI is: 240011234567890 (0x98765432110042)
359 Using APN: internet
360 Using MSISDN: 46702123456
361
362 Initialising GTP library
363 OpenGGSN[1838]: GTP: gtp_newgsn() started
364 Done initialising GTP library
365
366 Sending off echo request
367 Setting up PDP context #0
368 Waiting for response from ggsn........
369
370 Received echo response. Cause value: 0
371 Received create PDP context response. Cause value: 128
372 Setting up interface and routing
373 /sbin/ifconfig tun0 192.168.0.1
374 /sbin/route add -net 192.168.0.0 netmask 255.255.255.0 gw 192.168.0.1
375
jjakoc13c9df2003-07-07 15:15:38 +0000376</PRE>
jjakobcbfb412003-01-06 21:21:03 +0000377
378Now a context is established to the remote GGSN. The IP address of the
jjako9944eba2003-04-11 10:49:02 +0000379context is 192.168.0.1. You should be able to ping a known address on
380the Gi network of the roaming partner. You should even be able to do
381web browsing through the PDP context.
jjakobcbfb412003-01-06 21:21:03 +0000382
383Note however that you probably need to adjust your routing tables, so
384that you make sure that all GRX traffic is routed to the GPRS core
385network and everything else through the PDP context. The proper way to
386do this is to use policy routing. Also note that you are effectively
387connecting the same computer to both the Gn and Gi network, so please
388be carefull not to route internet traffic onto the GPRS core network
389and please protect yourself against hackers! For this reason it is
390advised to always use --contexts 0 when testing a live network.
391
392After --timelimit seconds the PDP context is disconnected with the
393following messages from sgsnemu:
394
jjakoc13c9df2003-07-07 15:15:38 +0000395
396<PRE>
397
jjakobcbfb412003-01-06 21:21:03 +0000398 Disconnecting PDP context #0
399 Received delete PDP context response. Cause value: 128
400 Deleting tun interface
jjako52c24142002-12-16 13:33:51 +0000401
jjakoc13c9df2003-07-07 15:15:38 +0000402</PRE>
403