blob: f633cbc74a4b144126569b5bbe5c7a3b27d3ce93 [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
12*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 and Solaris,
15but this is untested. Please tell me of any testing results.
16
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
jjakoc13c9df2003-07-07 15:15:38 +000061sgsnemu -h will show a list of available options. "-c sgsnemu.conf"
62use sgsnemu.conf as a configuration file. A sample file is provided in
63examples/sgsnemu.conf.
64
65*ggsn*
66Edit the configuration file ggsn.conf found under openggsn/examples.
jjakob3061692003-01-14 17:13:26 +000067Start the ggsn as root using the command:
jjako0ac82a12003-01-05 18:36:33 +000068
jjakoc13c9df2003-07-07 15:15:38 +000069ggsn --fg -c examples/ggsn.conf -l 10.0.0.40 --statedir .
jjako0ac82a12003-01-05 18:36:33 +000070
jjako52c24142002-12-16 13:33:51 +000071This will run the ggsn in foreground using the local interface
jjakoc13c9df2003-07-07 15:15:38 +00007210.0.0.40. If you don't have a GSM network available for testing you
jjako9944eba2003-04-11 10:49:02 +000073can use sgsnemu to test the GGSN.
jjakobcbfb412003-01-06 21:21:03 +000074
75
jjakoc13c9df2003-07-07 15:15:38 +000076Support
77-------
78
jjakobcbfb412003-01-06 21:21:03 +000079If you have any questions drop me a line at jj@openggsn.org.
jjako52c24142002-12-16 13:33:51 +000080
81
jjakoc13c9df2003-07-07 15:15:38 +000082Features
83========
jjako52c24142002-12-16 13:33:51 +000084
85OpenGGSN is an open source implementation of GPRS Support Nodes
86(GSNs). It implements the GPRS tunneling protocol (GTP) version 0.
87
88OpenGGSN provides 3 components:
jjakoc13c9df2003-07-07 15:15:38 +000089 * gtplib
90 * ggsn
91 * sgsnemu
jjako52c24142002-12-16 13:33:51 +000092
jjakoc13c9df2003-07-07 15:15:38 +000093*gtplib*
jjako0ac82a12003-01-05 18:36:33 +000094This library contains all functionality relating to the GTP
jjako9944eba2003-04-11 10:49:02 +000095protocol. Use this library if you want to implement your own
jjakobcbfb412003-01-06 21:21:03 +000096GSN. Currently gtplib supports GTPv0. At the moment no interface
97documentation is available for download.
jjako52c24142002-12-16 13:33:51 +000098
jjakoc13c9df2003-07-07 15:15:38 +000099*ggsn*
jjako0ac82a12003-01-05 18:36:33 +0000100The ggsn implements a Gateway GPRS Support Node. The GGSN is a small
101application which is provided in order to test and demonstrate the use
102of gtplib. It is fully compliant to the 3GPP standards, but lacks
103important functionality such as charging and management. Use this
jjako52c24142002-12-16 13:33:51 +0000104application as a starting point if you want to build your own GGSN
105with your own fancy VPN, management and charging functionality.
106
jjakoc13c9df2003-07-07 15:15:38 +0000107*sgsnemu*
jjako0ac82a12003-01-05 18:36:33 +0000108This application emulates a Serving GPRS Support Node (SGSN). sgsnemu
jjakobcbfb412003-01-06 21:21:03 +0000109enables you to test your 3GPP core network without the need to invest
jjako52c24142002-12-16 13:33:51 +0000110in a 3G radio access network. An important application of sgsnemu is
111the testing of roaming connectivity through a GPRS roaming exchange.
112
jjako0ac82a12003-01-05 18:36:33 +0000113
jjakoc13c9df2003-07-07 15:15:38 +0000114Performance
115===========
jjako7bac2f82003-01-29 10:24:10 +0000116
117Two experiments were performed in order to test the performance of
118sgsnemu and ggsn. The ggsn used a 550 MHz Athlon with 384 MB of
119RAM. sgsnemu used a 1 GHz Athlon with 256 MB of RAM. Both machines had
jjakoafb2a972003-01-29 21:04:13 +0000120100 Mb/s NICs (RTL-8139) and were connected through a crossed patch
121cable. Both tests were performed by sending ICMP echo packets from
122sgsnemu to the ggsn.
jjako7bac2f82003-01-29 10:24:10 +0000123
jjakoafb2a972003-01-29 21:04:13 +000012489.5 Mb/s IP throughput when sending 10000 ICMP ping packets with a
125payload of 1400 bytes. Transfer time 1.27 sec, no packets lost.
jjako7bac2f82003-01-29 10:24:10 +0000126
jjakoafb2a972003-01-29 21:04:13 +000012771.4 Mb/s IP throughput when sending 10000 ICMP ping packets with a
128payload of 1000 bytes. Transfer time 1.15 sec, no packets lost.
129
13012,1 Mb/s IP throughput when sending 10000 ICMP ping packets with a
131payload of 100 bytes. Transfer time 0.84 sec, no packets lost.
jjako7bac2f82003-01-29 10:24:10 +0000132
133
jjakoc13c9df2003-07-07 15:15:38 +0000134Required software
135=================
jjako52c24142002-12-16 13:33:51 +0000136
jjakoc13c9df2003-07-07 15:15:38 +0000137Tun
138---
jjako52c24142002-12-16 13:33:51 +0000139
140Both ggsn and sgsnemu uses the tun package. You need at least tun
jjakoc13c9df2003-07-07 15:15:38 +0000141version 1.1. With Linux tun is normally included from kernel version
1422.4.7. To configure automatic loading:
jjako0ac82a12003-01-05 18:36:33 +0000143
jjakoc13c9df2003-07-07 15:15:38 +00001441. Add the following line to /etc/modules.conf: alias char-major-10-200 tun
1452. depmod -a
jjako52c24142002-12-16 13:33:51 +0000146
jjakoc13c9df2003-07-07 15:15:38 +0000147Alternatively you can execute "modprobe tun" on the commandline.
148
149For other platforms and general information about tun see
150http://vtun.sourceforge.net/tun/
151
152Gengetopt
153---------
jjako52c24142002-12-16 13:33:51 +0000154
155Gengetopt is required if you want to change the options defined in the
jjakobcbfb412003-01-06 21:21:03 +0000156cmdline.ggo source file. You need at least gengetopt version 2.8. If
157you are just going to compile the programs you don't need gengetopt.
jjako52c24142002-12-16 13:33:51 +0000158
jjako0ac82a12003-01-05 18:36:33 +0000159To use gengetopt for the ggsn do the following:
jjako52c24142002-12-16 13:33:51 +0000160cd ggsn
jjako0ac82a12003-01-05 18:36:33 +0000161gengetopt < cmdline.ggo --conf-parser
jjako52c24142002-12-16 13:33:51 +0000162
jjako0ac82a12003-01-05 18:36:33 +0000163To use gengetopt for the sgsnemu do the following:
jjako52c24142002-12-16 13:33:51 +0000164cd sgsnemu
jjako0ac82a12003-01-05 18:36:33 +0000165gengetopt < cmdline.ggo --conf-parser
jjako52c24142002-12-16 13:33:51 +0000166
jjakoc13c9df2003-07-07 15:15:38 +0000167For more information about gengetopt see
168http://www.gnu.org/software/gengetopt/gengetopt.html
jjako52c24142002-12-16 13:33:51 +0000169
jjako52c24142002-12-16 13:33:51 +0000170
jjakoc13c9df2003-07-07 15:15:38 +0000171Compilation and Installation
172============================
173
174
175Setting up autotools
176--------------------
jjakob3061692003-01-14 17:13:26 +0000177
178You do not need to perform this step if you are only going to compile
179the package:
180
jjakoc13c9df2003-07-07 15:15:38 +00001811. Get version from somewhere: Script to extract version from configure.in
1822. Copy the latest config.guess and config.sub from ftp://ftp.gnu.org/gnu/config
1833. Run autoscan and copy configure.scan to configure.in
1844. Add/edit the following lines in configure.in:
185 - AC_INIT(openggsn, 0.52, jj@openggsn.org)
186 - AC_CONFIG_SRCDIR([gtp/gtp.c])
187 - AM_CONFIG_HEADER([config.h])
188 - AC_PROG_LIBTOOL
189 - AM_PROG_LIBTOOL
190 - AM_INIT_AUTOMAKE()
1915. libtoolize --automake --copy
jjakob3061692003-01-14 17:13:26 +0000192 (ads copy of ltmain.sh)
jjakoc13c9df2003-07-07 15:15:38 +00001936. aclocal
1947. autoheader
1958. automake --add-missing --copy
jjako7bac2f82003-01-29 10:24:10 +0000196 (Ads copy of mkinstalldirs missing, install-sh, depcomp)
jjakoc13c9df2003-07-07 15:15:38 +00001979. automake
19810. autoconf
jjakob3061692003-01-14 17:13:26 +0000199
200The above will initialise the project to the current version of
201autotools (As installed in RedHat 8.0). See
202http://sources.redhat.com/autobook/autobook/autobook_25.html#SEC25
203for details on autotools.
jjako52c24142002-12-16 13:33:51 +0000204
205
jjakoc13c9df2003-07-07 15:15:38 +0000206Compilation and installation
207----------------------------
jjakob3061692003-01-14 17:13:26 +0000208
jjakoc13c9df2003-07-07 15:15:38 +0000209 1. ./configure
210 2. make clean
211 3. cd gtp
212 4. make
213 5. make install (as root)
214 6. cd ..
jjakob3061692003-01-14 17:13:26 +0000215 (Step 3 to 6 you only need to run the first time to install libgtp)
jjakoc13c9df2003-07-07 15:15:38 +0000216 7. make
217 8. make install (as root)
218 9. Add /usr/local/lib to /etc/ld.so.conf
21910. run ldconfig
220
221(Steps 9 and 10 are not required as path to libgtp is included in Makefile)
222
223Documentation can be converted to html by issuing:
224
225 1. txt2html -pm -tf README > README.html
226 2. txt2html -pm -tf NEWS > NEWS.html
227 3. txt2html -pm -tf ChangeLog > ChangeLog.html
228 4. man2htm ggsn.8 > ggsn.html
229 5. man2htm sgsnemu.8 > sgsnemu.html
jjakob3061692003-01-14 17:13:26 +0000230
jjako52c24142002-12-16 13:33:51 +0000231
jjakoc13c9df2003-07-07 15:15:38 +0000232Installation from binary
233------------------------
234
2351. rpm -i openggsn-<version>.rpm
236
237This will install binaries, man pages, configuration files as well as
238a Sys V init script for the ggsn.
239
240
241Running ggsn
242============
jjakobcbfb412003-01-06 21:21:03 +0000243
244Use ggsn -h for a list of available options. All options available on
245the command line can also be given in a configuration file. See
246examples/ggsn.conf for the format of this file.
jjako52c24142002-12-16 13:33:51 +0000247
jjakoafb2a972003-01-29 21:04:13 +0000248Start the ggsn as root using the command:
249
jjakoc13c9df2003-07-07 15:15:38 +0000250 ggsn -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 +0000251
252First a tun network interface will be created. In the above example
253the network interface address is 192.168.0.0 and the mask is
jjako9944eba2003-04-11 10:49:02 +0000254255.255.255.0. You can check that this interface is up by using
jjakoafb2a972003-01-29 21:04:13 +0000255ifconfig.
256
257After tun has been successfully established the ggsn will wait for GTP
258create PDP context requests on the local interface
jjakoc13c9df2003-07-07 15:15:38 +000025910.0.0.40. Currently all requests are accepted, and no password,
jjako9944eba2003-04-11 10:49:02 +0000260username or APN validation is performed.
jjakoafb2a972003-01-29 21:04:13 +0000261
262When receiving a create PDP context request a dynamic IP address will
jjako9944eba2003-04-11 10:49:02 +0000263be allocated from the address pool determined by --dynip. In the above
264example the first allocated address will be 192.168.0.1, followed by
265192.168.0.2 and so on. The request is confirmed by sending a create
266PDP context response message to the peer (SGSN).
jjakoafb2a972003-01-29 21:04:13 +0000267
268Now IP packets will be forwarded between the tun network interface and
269the established GTP tunnel. In order to allow users to access the
270external network routing needs to be set up. If private addresses are
jjako9944eba2003-04-11 10:49:02 +0000271used you need to configure network address translation. See the Linux
272Networking HOWTO for details.
jjakoafb2a972003-01-29 21:04:13 +0000273
jjakoc13c9df2003-07-07 15:15:38 +0000274Remember to enable routing:
jjako7bac2f82003-01-29 10:24:10 +0000275
jjakoc13c9df2003-07-07 15:15:38 +0000276echo 1 > /proc/sys/net/ipv4/ip_forward
277
278If you installed using a binary RPM package it is possible to start
279ggsn by using the Sys 5 script:
280
281/etc/init.d/ggsn start
282
283
284Running sgsnemu
285===============
jjakobcbfb412003-01-06 21:21:03 +0000286
287Use sgsnemu -h for a list of available options. All options available
288on the command line can also be given in a configuration file. See
289examples/sgsnemu.conf for the format of this file.
290
291If you want to test a GRX roaming connection you will need to do the
292following:
293
jjakoc13c9df2003-07-07 15:15:38 +00002941. Install sgsnemu on a Linux Box. See under installation above.
2952. Connect your Linux box with sgsnemu installed to the GPRS core
jjakobcbfb412003-01-06 21:21:03 +0000296network. Use the same LAN switch as the one your SGSN is connected
297to. You also need a free IP address that can be used by sgsnemu.
jjakoc13c9df2003-07-07 15:15:38 +00002983. You need to configure networking in terms of interface address,
jjakobcbfb412003-01-06 21:21:03 +0000299subnet mask and default route. See the Linux Networking HOWTO for
300details.
jjakoc13c9df2003-07-07 15:15:38 +00003014. Launch sgsnemu with something like:
jjakobcbfb412003-01-06 21:21:03 +0000302
jjakoc13c9df2003-07-07 15:15:38 +0000303 sgsnemu --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 +0000304
305sgsnemu will print something like the following on the screen:
306
jjakoc13c9df2003-07-07 15:15:38 +0000307<PRE>
308
jjakobcbfb412003-01-06 21:21:03 +0000309 Using DNS server: 10.20.38.51 (10.20.38.51)
jjakoc13c9df2003-07-07 15:15:38 +0000310 Local IP address is: 10.0.0.50 (10.0.0.50)
311 Remote IP address is: 10.0.0.40 (10.0.0.40)
jjakobcbfb412003-01-06 21:21:03 +0000312 IMSI is: 240011234567890 (0x98765432110042)
313 Using APN: internet
314 Using MSISDN: 46702123456
315
316 Initialising GTP library
317 OpenGGSN[1823]: GTP: gtp_newgsn() started
318 Done initialising GTP library
319
320 Sending off echo request
321 Waiting for response from ggsn........
322
323 Received echo response. Cause value: 0
324
jjakoc13c9df2003-07-07 15:15:38 +0000325</PRE>
326
jjakobcbfb412003-01-06 21:21:03 +0000327This is quite good. It means that you managed to send off an echo
328request to a remote GGSN, and it was friendly enough to answer you. If
329you did not get an echo response it means that something is wrong
330either with your setup OR with the GRX connection OR with your roaming
331partners connection.
332
333If the above went well you might want to try to establish a PDP
jjako7bac2f82003-01-29 10:24:10 +0000334context to the remote GGSN. Note that you should be careful when
jjakobcbfb412003-01-06 21:21:03 +0000335establishing PDP contexts using sgsnemu as each established PDP
336context will result in a Charge Detail Record (CDR) being generated by
337the GGSN. You should use real IMSI and MSISDN from a valid test SIM
338card. Otherwise some poor customer might get charged for your
339testing. Also note that you are establishing a connection to the Gi
jjako7bac2f82003-01-29 10:24:10 +0000340network, so please be carefull not to route internet traffic onto the
jjakobcbfb412003-01-06 21:21:03 +0000341GPRS core network! Assuming you know what you are doing:
342
jjakoc13c9df2003-07-07 15:15:38 +0000343 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
jjakobcbfb412003-01-06 21:21:03 +0000344
345sgsnemu will print something like the following on the screen:
346
jjakoc13c9df2003-07-07 15:15:38 +0000347<PRE>
348
jjakobcbfb412003-01-06 21:21:03 +0000349 Using DNS server: 10.20.38.51 (10.20.38.51)
jjakoc13c9df2003-07-07 15:15:38 +0000350 Local IP address is: 10.0.0.50 (10.0.0.50)
351 Remote IP address is: 10.0.0.40 (10.0.0.40)
jjakobcbfb412003-01-06 21:21:03 +0000352 IMSI is: 240011234567890 (0x98765432110042)
353 Using APN: internet
354 Using MSISDN: 46702123456
355
356 Initialising GTP library
357 OpenGGSN[1838]: GTP: gtp_newgsn() started
358 Done initialising GTP library
359
360 Sending off echo request
361 Setting up PDP context #0
362 Waiting for response from ggsn........
363
364 Received echo response. Cause value: 0
365 Received create PDP context response. Cause value: 128
366 Setting up interface and routing
367 /sbin/ifconfig tun0 192.168.0.1
368 /sbin/route add -net 192.168.0.0 netmask 255.255.255.0 gw 192.168.0.1
369
jjakoc13c9df2003-07-07 15:15:38 +0000370</PRE>
jjakobcbfb412003-01-06 21:21:03 +0000371
372Now a context is established to the remote GGSN. The IP address of the
jjako9944eba2003-04-11 10:49:02 +0000373context is 192.168.0.1. You should be able to ping a known address on
374the Gi network of the roaming partner. You should even be able to do
375web browsing through the PDP context.
jjakobcbfb412003-01-06 21:21:03 +0000376
377Note however that you probably need to adjust your routing tables, so
378that you make sure that all GRX traffic is routed to the GPRS core
379network and everything else through the PDP context. The proper way to
380do this is to use policy routing. Also note that you are effectively
381connecting the same computer to both the Gn and Gi network, so please
382be carefull not to route internet traffic onto the GPRS core network
383and please protect yourself against hackers! For this reason it is
384advised to always use --contexts 0 when testing a live network.
385
386After --timelimit seconds the PDP context is disconnected with the
387following messages from sgsnemu:
388
jjakoc13c9df2003-07-07 15:15:38 +0000389
390<PRE>
391
jjakobcbfb412003-01-06 21:21:03 +0000392 Disconnecting PDP context #0
393 Received delete PDP context response. Cause value: 128
394 Deleting tun interface
jjako52c24142002-12-16 13:33:51 +0000395
jjakoc13c9df2003-07-07 15:15:38 +0000396</PRE>
397