jjako | 52c2414 | 2002-12-16 13:33:51 +0000 | [diff] [blame] | 1 | *** QuickStart *** |
| 2 | |
| 3 | REQUIREMENTS |
| 4 | |
jjako | 0ac82a1 | 2003-01-05 18:36:33 +0000 | [diff] [blame] | 5 | Linux |
jjako | 52c2414 | 2002-12-16 13:33:51 +0000 | [diff] [blame] | 6 | OpenGGSN was developed and tested using Redhat 7.1 and Redhat |
| 7 | 7.2. It should run also on other Linux distributions as well as |
| 8 | FreeBSD and Solaris, but this is untested. Please tell me of any |
| 9 | testing results. |
| 10 | |
| 11 | Tun |
| 12 | Both ggsn and sgsnemu uses the tun package. You need at least tun |
| 13 | version 1.1. See http://vtun.sourceforge.net/tun/ for instructions on |
jjako | 0ac82a1 | 2003-01-05 18:36:33 +0000 | [diff] [blame] | 14 | installation. Tun is included in the kernel from early version 2.4, so |
jjako | b306169 | 2003-01-14 17:13:26 +0000 | [diff] [blame] | 15 | you will not normally need to install it. For Redhat 7.1, 7.2 and 8.0 |
| 16 | you do however need to do the following: |
jjako | 0ac82a1 | 2003-01-05 18:36:33 +0000 | [diff] [blame] | 17 | mkdir /dev/net |
| 18 | mknod /dev/net/tun c 10 200 |
jjako | bcbfb41 | 2003-01-06 21:21:03 +0000 | [diff] [blame] | 19 | Add this line to /etc/modules.conf: alias char-major-10-200 tun |
jjako | 0ac82a1 | 2003-01-05 18:36:33 +0000 | [diff] [blame] | 20 | depmod -a |
jjako | 52c2414 | 2002-12-16 13:33:51 +0000 | [diff] [blame] | 21 | |
jjako | 0ac82a1 | 2003-01-05 18:36:33 +0000 | [diff] [blame] | 22 | |
| 23 | COMPILATION and INSTALLATION |
jjako | 52c2414 | 2002-12-16 13:33:51 +0000 | [diff] [blame] | 24 | |
jjako | b306169 | 2003-01-14 17:13:26 +0000 | [diff] [blame] | 25 | 1 ./configure |
jjako | 7bac2f8 | 2003-01-29 10:24:10 +0000 | [diff] [blame] | 26 | 2 make |
| 27 | 3 make install |
jjako | b306169 | 2003-01-14 17:13:26 +0000 | [diff] [blame] | 28 | |
| 29 | You need to be root in order to install the package, but not in order |
| 30 | to compile. |
| 31 | |
jjako | 52c2414 | 2002-12-16 13:33:51 +0000 | [diff] [blame] | 32 | RUNNING |
| 33 | |
| 34 | sgsnemu |
| 35 | Edit the configuration file sgsnemu.conf found under |
jjako | 0ac82a1 | 2003-01-05 18:36:33 +0000 | [diff] [blame] | 36 | openggsn/examples. Use sgsnemu -h for a list of available options. |
jjako | b306169 | 2003-01-14 17:13:26 +0000 | [diff] [blame] | 37 | Start the emulator as root using the command: |
jjako | 52c2414 | 2002-12-16 13:33:51 +0000 | [diff] [blame] | 38 | |
jjako | 7bac2f8 | 2003-01-29 10:24:10 +0000 | [diff] [blame] | 39 | sgsnemu -c examples/sgsnemu.conf -l 10.20.30.50 -r 10.20.30.40 --createif |
jjako | 52c2414 | 2002-12-16 13:33:51 +0000 | [diff] [blame] | 40 | |
| 41 | This will cause the sgsn emulator to bind to local address 10.20.30.50 |
| 42 | and connect to the ggsn found at 10.20.30.40. It will first send off |
jjako | bcbfb41 | 2003-01-06 21:21:03 +0000 | [diff] [blame] | 43 | an ECHO_REQUEST message. After this it will attempt to establish a pdp |
jjako | 52c2414 | 2002-12-16 13:33:51 +0000 | [diff] [blame] | 44 | context. If successful it will create a local interface and set up |
| 45 | routing. Now you should be able to ping through the connection. Use a |
| 46 | network analysator such as ethereal to monitor the traffic. |
| 47 | |
| 48 | ggsn |
jjako | 0ac82a1 | 2003-01-05 18:36:33 +0000 | [diff] [blame] | 49 | Edit the configuration file ggsn.conf found under |
| 50 | openggsn/examples. Use sgsnemu -h for a list of available options. |
jjako | b306169 | 2003-01-14 17:13:26 +0000 | [diff] [blame] | 51 | Start the ggsn as root using the command: |
jjako | 0ac82a1 | 2003-01-05 18:36:33 +0000 | [diff] [blame] | 52 | |
| 53 | ggsn --fg -c examples/ggsn.conf -l 10.20.30.40 --statedir . |
| 54 | |
jjako | 52c2414 | 2002-12-16 13:33:51 +0000 | [diff] [blame] | 55 | This will run the ggsn in foreground using the local interface |
jjako | bcbfb41 | 2003-01-06 21:21:03 +0000 | [diff] [blame] | 56 | 10.20.30.40. Of cause you can use sgsnemu to test the GGSN. |
| 57 | |
| 58 | |
| 59 | SUPPORT |
| 60 | If you have any questions drop me a line at jj@openggsn.org. |
jjako | 52c2414 | 2002-12-16 13:33:51 +0000 | [diff] [blame] | 61 | |
| 62 | |
| 63 | *** Features *** |
| 64 | |
| 65 | OpenGGSN is an open source implementation of GPRS Support Nodes |
| 66 | (GSNs). It implements the GPRS tunneling protocol (GTP) version 0. |
| 67 | |
| 68 | OpenGGSN provides 3 components: |
| 69 | * gtplib |
| 70 | * ggsn |
| 71 | * sgsnemu |
| 72 | |
| 73 | gtplib |
jjako | 0ac82a1 | 2003-01-05 18:36:33 +0000 | [diff] [blame] | 74 | This library contains all functionality relating to the GTP |
jjako | 52c2414 | 2002-12-16 13:33:51 +0000 | [diff] [blame] | 75 | protocol. Use this libraty if you want to implement your own |
jjako | bcbfb41 | 2003-01-06 21:21:03 +0000 | [diff] [blame] | 76 | GSN. Currently gtplib supports GTPv0. At the moment no interface |
| 77 | documentation is available for download. |
jjako | 52c2414 | 2002-12-16 13:33:51 +0000 | [diff] [blame] | 78 | |
| 79 | ggsn |
jjako | 0ac82a1 | 2003-01-05 18:36:33 +0000 | [diff] [blame] | 80 | The ggsn implements a Gateway GPRS Support Node. The GGSN is a small |
| 81 | application which is provided in order to test and demonstrate the use |
| 82 | of gtplib. It is fully compliant to the 3GPP standards, but lacks |
| 83 | important functionality such as charging and management. Use this |
jjako | 52c2414 | 2002-12-16 13:33:51 +0000 | [diff] [blame] | 84 | application as a starting point if you want to build your own GGSN |
| 85 | with your own fancy VPN, management and charging functionality. |
| 86 | |
jjako | 0ac82a1 | 2003-01-05 18:36:33 +0000 | [diff] [blame] | 87 | sgsnemu |
| 88 | This application emulates a Serving GPRS Support Node (SGSN). sgsnemu |
jjako | bcbfb41 | 2003-01-06 21:21:03 +0000 | [diff] [blame] | 89 | enables you to test your 3GPP core network without the need to invest |
jjako | 52c2414 | 2002-12-16 13:33:51 +0000 | [diff] [blame] | 90 | in a 3G radio access network. An important application of sgsnemu is |
| 91 | the testing of roaming connectivity through a GPRS roaming exchange. |
| 92 | |
jjako | 0ac82a1 | 2003-01-05 18:36:33 +0000 | [diff] [blame] | 93 | |
jjako | 7bac2f8 | 2003-01-29 10:24:10 +0000 | [diff] [blame] | 94 | *** Performance *** |
| 95 | |
| 96 | Two experiments were performed in order to test the performance of |
| 97 | sgsnemu and ggsn. The ggsn used a 550 MHz Athlon with 384 MB of |
| 98 | RAM. sgsnemu used a 1 GHz Athlon with 256 MB of RAM. Both machines had |
jjako | afb2a97 | 2003-01-29 21:04:13 +0000 | [diff] [blame] | 99 | 100 Mb/s NICs (RTL-8139) and were connected through a crossed patch |
| 100 | cable. Both tests were performed by sending ICMP echo packets from |
| 101 | sgsnemu to the ggsn. |
jjako | 7bac2f8 | 2003-01-29 10:24:10 +0000 | [diff] [blame] | 102 | |
jjako | afb2a97 | 2003-01-29 21:04:13 +0000 | [diff] [blame] | 103 | 89.5 Mb/s IP throughput when sending 10000 ICMP ping packets with a |
| 104 | payload of 1400 bytes. Transfer time 1.27 sec, no packets lost. |
jjako | 7bac2f8 | 2003-01-29 10:24:10 +0000 | [diff] [blame] | 105 | |
jjako | afb2a97 | 2003-01-29 21:04:13 +0000 | [diff] [blame] | 106 | 71.4 Mb/s IP throughput when sending 10000 ICMP ping packets with a |
| 107 | payload of 1000 bytes. Transfer time 1.15 sec, no packets lost. |
| 108 | |
| 109 | 12,1 Mb/s IP throughput when sending 10000 ICMP ping packets with a |
| 110 | payload of 100 bytes. Transfer time 0.84 sec, no packets lost. |
jjako | 7bac2f8 | 2003-01-29 10:24:10 +0000 | [diff] [blame] | 111 | |
| 112 | |
jjako | 52c2414 | 2002-12-16 13:33:51 +0000 | [diff] [blame] | 113 | *** Required software *** |
| 114 | |
jjako | bcbfb41 | 2003-01-06 21:21:03 +0000 | [diff] [blame] | 115 | TUN (http://vtun.sourceforge.net/tun/) |
jjako | 52c2414 | 2002-12-16 13:33:51 +0000 | [diff] [blame] | 116 | |
| 117 | Both ggsn and sgsnemu uses the tun package. You need at least tun |
jjako | 0ac82a1 | 2003-01-05 18:36:33 +0000 | [diff] [blame] | 118 | version 1.1. See the above web page for instructions on |
| 119 | installation. Tun is included in the kernel from early version 2.4, so |
jjako | b306169 | 2003-01-14 17:13:26 +0000 | [diff] [blame] | 120 | you will not normally need to install it. For Redhat 7.1, 7.2 and 8.0 |
| 121 | you do however need to do the following: |
jjako | 0ac82a1 | 2003-01-05 18:36:33 +0000 | [diff] [blame] | 122 | mkdir /dev/net |
| 123 | mknod /dev/net/tun c 10 200 |
| 124 | Add the following line to /etc/modules.conf: alias char-major-10-200 tun |
| 125 | depmod -a |
| 126 | |
jjako | 52c2414 | 2002-12-16 13:33:51 +0000 | [diff] [blame] | 127 | |
jjako | bcbfb41 | 2003-01-06 21:21:03 +0000 | [diff] [blame] | 128 | GENGETOPT (http://www.gnu.org/software/gengetopt/gengetopt.html) |
jjako | 52c2414 | 2002-12-16 13:33:51 +0000 | [diff] [blame] | 129 | |
| 130 | Gengetopt is required if you want to change the options defined in the |
jjako | bcbfb41 | 2003-01-06 21:21:03 +0000 | [diff] [blame] | 131 | cmdline.ggo source file. You need at least gengetopt version 2.8. If |
| 132 | you are just going to compile the programs you don't need gengetopt. |
jjako | 52c2414 | 2002-12-16 13:33:51 +0000 | [diff] [blame] | 133 | |
jjako | 0ac82a1 | 2003-01-05 18:36:33 +0000 | [diff] [blame] | 134 | To use gengetopt for the ggsn do the following: |
jjako | 52c2414 | 2002-12-16 13:33:51 +0000 | [diff] [blame] | 135 | cd ggsn |
jjako | 0ac82a1 | 2003-01-05 18:36:33 +0000 | [diff] [blame] | 136 | gengetopt < cmdline.ggo --conf-parser |
jjako | 52c2414 | 2002-12-16 13:33:51 +0000 | [diff] [blame] | 137 | |
jjako | 0ac82a1 | 2003-01-05 18:36:33 +0000 | [diff] [blame] | 138 | To use gengetopt for the sgsnemu do the following: |
jjako | 52c2414 | 2002-12-16 13:33:51 +0000 | [diff] [blame] | 139 | cd sgsnemu |
jjako | 0ac82a1 | 2003-01-05 18:36:33 +0000 | [diff] [blame] | 140 | gengetopt < cmdline.ggo --conf-parser |
jjako | 52c2414 | 2002-12-16 13:33:51 +0000 | [diff] [blame] | 141 | |
jjako | 52c2414 | 2002-12-16 13:33:51 +0000 | [diff] [blame] | 142 | |
| 143 | *** Compilation and Installation *** |
| 144 | |
jjako | b306169 | 2003-01-14 17:13:26 +0000 | [diff] [blame] | 145 | SETTING UP AUTOTOOLS |
| 146 | |
| 147 | You do not need to perform this step if you are only going to compile |
| 148 | the package: |
| 149 | |
jjako | 7bac2f8 | 2003-01-29 10:24:10 +0000 | [diff] [blame] | 150 | 0 Get version from somewhere: Script to extract version from configure.in |
jjako | b306169 | 2003-01-14 17:13:26 +0000 | [diff] [blame] | 151 | 1 Copy the latest config.guess and config.sub from ftp://ftp.gnu.org/gnu/config |
jjako | 7bac2f8 | 2003-01-29 10:24:10 +0000 | [diff] [blame] | 152 | 2 Run autoscan and copy configure.scan to configure.in |
| 153 | 3 Add/edit the following lines in configure.in: |
jjako | b306169 | 2003-01-14 17:13:26 +0000 | [diff] [blame] | 154 | AC_INIT(openggsn, 0.52, jj@openggsn.org) |
| 155 | AC_CONFIG_SRCDIR([gtp/gtp.c]) |
| 156 | AM_CONFIG_HEADER([config.h]) |
| 157 | AC_PROG_LIBTOOL |
| 158 | AM_PROG_LIBTOOL |
| 159 | AM_INIT_AUTOMAKE() |
| 160 | 4 libtoolize --automake --copy |
| 161 | (ads copy of ltmain.sh) |
| 162 | 5 aclocal |
| 163 | 6 autoheader |
jjako | 7bac2f8 | 2003-01-29 10:24:10 +0000 | [diff] [blame] | 164 | 7 automake --add-missing --copy |
| 165 | (Ads copy of mkinstalldirs missing, install-sh, depcomp) |
jjako | b306169 | 2003-01-14 17:13:26 +0000 | [diff] [blame] | 166 | 8 automake |
| 167 | 9 autoconf |
| 168 | |
| 169 | The above will initialise the project to the current version of |
| 170 | autotools (As installed in RedHat 8.0). See |
| 171 | http://sources.redhat.com/autobook/autobook/autobook_25.html#SEC25 |
| 172 | for details on autotools. |
jjako | 52c2414 | 2002-12-16 13:33:51 +0000 | [diff] [blame] | 173 | |
| 174 | |
jjako | b306169 | 2003-01-14 17:13:26 +0000 | [diff] [blame] | 175 | COMPILATION AND INSTALLATION |
| 176 | |
| 177 | 1 ./configure |
| 178 | 2 make clean |
| 179 | 3 cd gtp |
| 180 | 4 make |
| 181 | 5 make install (as root) |
| 182 | 6 cd .. |
| 183 | (Step 3 to 6 you only need to run the first time to install libgtp) |
| 184 | 7 make |
| 185 | 8 make install (as root) |
| 186 | 9 Add /usr/local/lib to /etc/ld.so.conf |
| 187 | 10 run ldconfig |
| 188 | (Step 9 and 10 are not required as path to libgtp is included in Makefile) |
| 189 | |
jjako | 52c2414 | 2002-12-16 13:33:51 +0000 | [diff] [blame] | 190 | |
| 191 | *** Running ggsn *** |
jjako | bcbfb41 | 2003-01-06 21:21:03 +0000 | [diff] [blame] | 192 | |
| 193 | Use ggsn -h for a list of available options. All options available on |
| 194 | the command line can also be given in a configuration file. See |
| 195 | examples/ggsn.conf for the format of this file. |
jjako | 52c2414 | 2002-12-16 13:33:51 +0000 | [diff] [blame] | 196 | |
jjako | afb2a97 | 2003-01-29 21:04:13 +0000 | [diff] [blame] | 197 | Start the ggsn as root using the command: |
| 198 | |
| 199 | ggsn -c examples/ggsn.conf --fg -l 10.20.30.40 --net 192.168.0.0 --mask 255.255.0.0 |
| 200 | |
| 201 | First a tun network interface will be created. In the above example |
| 202 | the network interface address is 192.168.0.0 and the mask is |
| 203 | 255.255.0.0. You can check that this interface is up by using |
| 204 | ifconfig. |
| 205 | |
| 206 | After tun has been successfully established the ggsn will wait for GTP |
| 207 | create PDP context requests on the local interface |
| 208 | 10.20.30.40. Currently all requests are excepted, and no password, |
| 209 | username or APN validation is performed. |
| 210 | |
| 211 | When receiving a create PDP context request a dynamic IP address will |
| 212 | be allocated from the address pool determined by --net and --mask. In |
| 213 | the above example the first allocated address will be 192.168.0.1, |
| 214 | followed by 192.168.0.2 and so on. The request is confirmed by sending |
| 215 | a create PDP context response message to the peer (SGSN). |
| 216 | |
| 217 | Now IP packets will be forwarded between the tun network interface and |
| 218 | the established GTP tunnel. In order to allow users to access the |
| 219 | external network routing needs to be set up. If private addresses are |
| 220 | are used you need to configure network address translation. See the |
| 221 | Linux Networking HOWTO for details. |
| 222 | |
jjako | 7bac2f8 | 2003-01-29 10:24:10 +0000 | [diff] [blame] | 223 | Remember to enable routing: echo 1 > /proc/sys/net/ipv4/ip_forward |
| 224 | |
jjako | 52c2414 | 2002-12-16 13:33:51 +0000 | [diff] [blame] | 225 | *** Running sgsnemu *** |
jjako | bcbfb41 | 2003-01-06 21:21:03 +0000 | [diff] [blame] | 226 | |
| 227 | Use sgsnemu -h for a list of available options. All options available |
| 228 | on the command line can also be given in a configuration file. See |
| 229 | examples/sgsnemu.conf for the format of this file. |
| 230 | |
| 231 | If you want to test a GRX roaming connection you will need to do the |
| 232 | following: |
| 233 | |
| 234 | 1) Install sgsnemu on a Linux Box. See under installation above. |
| 235 | |
| 236 | 2) Connect your Linux box with sgsnemu installed to the GPRS core |
| 237 | network. Use the same LAN switch as the one your SGSN is connected |
| 238 | to. You also need a free IP address that can be used by sgsnemu. |
| 239 | |
| 240 | 3) You need to configure networking in terms of interface address, |
| 241 | subnet mask and default route. See the Linux Networking HOWTO for |
| 242 | details. |
| 243 | |
| 244 | 4) Launch sgsnemu with something like: |
| 245 | |
| 246 | sgsnemu --fg --listen 10.20.30.50 --remote 10.20.30.40 --dns 10.20.38.51 --timelimit 10 --contexts 0 |
| 247 | |
| 248 | sgsnemu will print something like the following on the screen: |
| 249 | |
| 250 | Using DNS server: 10.20.38.51 (10.20.38.51) |
| 251 | Local IP address is: 10.20.30.50 (10.20.30.50) |
| 252 | Remote IP address is: 10.20.30.40 (10.20.30.40) |
| 253 | IMSI is: 240011234567890 (0x98765432110042) |
| 254 | Using APN: internet |
| 255 | Using MSISDN: 46702123456 |
| 256 | |
| 257 | Initialising GTP library |
| 258 | OpenGGSN[1823]: GTP: gtp_newgsn() started |
| 259 | Done initialising GTP library |
| 260 | |
| 261 | Sending off echo request |
| 262 | Waiting for response from ggsn........ |
| 263 | |
| 264 | Received echo response. Cause value: 0 |
| 265 | |
| 266 | This is quite good. It means that you managed to send off an echo |
| 267 | request to a remote GGSN, and it was friendly enough to answer you. If |
| 268 | you did not get an echo response it means that something is wrong |
| 269 | either with your setup OR with the GRX connection OR with your roaming |
| 270 | partners connection. |
| 271 | |
| 272 | If the above went well you might want to try to establish a PDP |
jjako | 7bac2f8 | 2003-01-29 10:24:10 +0000 | [diff] [blame] | 273 | context to the remote GGSN. Note that you should be careful when |
jjako | bcbfb41 | 2003-01-06 21:21:03 +0000 | [diff] [blame] | 274 | establishing PDP contexts using sgsnemu as each established PDP |
| 275 | context will result in a Charge Detail Record (CDR) being generated by |
| 276 | the GGSN. You should use real IMSI and MSISDN from a valid test SIM |
| 277 | card. Otherwise some poor customer might get charged for your |
| 278 | testing. Also note that you are establishing a connection to the Gi |
jjako | 7bac2f8 | 2003-01-29 10:24:10 +0000 | [diff] [blame] | 279 | network, so please be carefull not to route internet traffic onto the |
jjako | bcbfb41 | 2003-01-06 21:21:03 +0000 | [diff] [blame] | 280 | GPRS core network! Assuming you know what you are doing: |
| 281 | |
jjako | 7bac2f8 | 2003-01-29 10:24:10 +0000 | [diff] [blame] | 282 | sgsnemu --fg --listen 10.20.30.50 --remote 10.20.30.40 --dns 10.20.38.51 --timelimit 10 --contexts 1 --apn internet --imsi 240011234567890 --msisdn 46702123456 --net 192.168.0.0 --mask 255.255.255.0 --createif |
jjako | bcbfb41 | 2003-01-06 21:21:03 +0000 | [diff] [blame] | 283 | |
| 284 | sgsnemu will print something like the following on the screen: |
| 285 | |
| 286 | Using DNS server: 10.20.38.51 (10.20.38.51) |
| 287 | Local IP address is: 10.20.30.50 (10.20.30.50) |
| 288 | Remote IP address is: 10.20.30.40 (10.20.30.40) |
| 289 | IMSI is: 240011234567890 (0x98765432110042) |
| 290 | Using APN: internet |
| 291 | Using MSISDN: 46702123456 |
| 292 | |
| 293 | Initialising GTP library |
| 294 | OpenGGSN[1838]: GTP: gtp_newgsn() started |
| 295 | Done initialising GTP library |
| 296 | |
| 297 | Sending off echo request |
| 298 | Setting up PDP context #0 |
| 299 | Waiting for response from ggsn........ |
| 300 | |
| 301 | Received echo response. Cause value: 0 |
| 302 | Received create PDP context response. Cause value: 128 |
| 303 | Setting up interface and routing |
| 304 | /sbin/ifconfig tun0 192.168.0.1 |
| 305 | /sbin/route add -net 192.168.0.0 netmask 255.255.255.0 gw 192.168.0.1 |
| 306 | |
| 307 | |
| 308 | Now a context is established to the remote GGSN. The IP address of the |
| 309 | context is 192.168.0.1. If you specified the correct --net and --mask |
| 310 | you should be able to ping a known address on the Gi network of the |
| 311 | roaming partner. You should even be able to do web browsing through |
| 312 | the PDP context. |
| 313 | |
| 314 | Note however that you probably need to adjust your routing tables, so |
| 315 | that you make sure that all GRX traffic is routed to the GPRS core |
| 316 | network and everything else through the PDP context. The proper way to |
| 317 | do this is to use policy routing. Also note that you are effectively |
| 318 | connecting the same computer to both the Gn and Gi network, so please |
| 319 | be carefull not to route internet traffic onto the GPRS core network |
| 320 | and please protect yourself against hackers! For this reason it is |
| 321 | advised to always use --contexts 0 when testing a live network. |
| 322 | |
| 323 | After --timelimit seconds the PDP context is disconnected with the |
| 324 | following messages from sgsnemu: |
| 325 | |
| 326 | Disconnecting PDP context #0 |
| 327 | Received delete PDP context response. Cause value: 128 |
| 328 | Deleting tun interface |
jjako | 52c2414 | 2002-12-16 13:33:51 +0000 | [diff] [blame] | 329 | |