OpenBSC GPRS » History » Version 10
Anonymous, 02/19/2016 10:47 PM
1 | 1 | tnt | [[PageOutline]] |
---|---|---|---|
2 | |||
3 | = OpenBSC GPRS/EDGE Setup page = |
||
4 | |||
5 | == Pre-requisites == |
||
6 | |||
7 | * A nano BTS with GPRS or EDGE support. BS-11 are not supported (yet?) |
||
8 | 6 | tnt | * A compiled GGSN from OpenGGSN (make sure to use the osmocom version. git://git.osmocom.org/openggsn.git ) |
9 | 2 | tnt | * A working and up-to-date OpenBSC (see [wiki:Building_OpenBSC]) |
10 | 3 | tnt | * You will need to (re-)build it after having installed OpenGGSN so that the `libgtp` is detected and the SGSN binary `osmo-sgsn` built. |
11 | 8 | tnt | * A custom SIM for your network |
12 | * Currently osmo-sgsn refuses all roaming, so you need a SIM that matches your custom MCC/MNC network |
||
13 | 1 | tnt | |
14 | == Setup == |
||
15 | |||
16 | 3 | tnt | First a little picture to illustrate the different elements and their interactions : |
17 | 1 | tnt | |
18 | 8 | tnt | [[Image(gprs.2.png)]] |
19 | 1 | tnt | |
20 | 9 | tnt | === Compiling OpenBSC with [E]GPRS === |
21 | |||
22 | The guide below was tested on Ubuntu 11.10 but should work on Debian as well. This guide uses /root for everything. |
||
23 | |||
24 | First you need to download all dependencies: |
||
25 | |||
26 | {{{ |
||
27 | apt-get install libdbi0-dev libdbd-sqlite3 libtool autoconf git-core pkg-config make libortp-dev |
||
28 | }}} |
||
29 | |||
30 | Next, download the OpenGGSN source code: |
||
31 | {{{ |
||
32 | cd /root |
||
33 | git clone git://git.osmocom.org/openggsn.git |
||
34 | }}} |
||
35 | |||
36 | Compile OpenGGSN: |
||
37 | {{{ |
||
38 | cd /root/openggsn |
||
39 | autoreconf; automake --add-missing; autoreconf; autoconf; automake; ./configure --prefix=/usr/local; make -j 2; make install |
||
40 | }}} |
||
41 | |||
42 | Now download everything else: |
||
43 | {{{ |
||
44 | cd /root |
||
45 | 10 | tnt | git clone git://git.osmocom.org/libosmocore.git; git clone git://git.osmocom.org/libosmo-abis.git; git clone git://git.osmocom.org/libosmo-netif.git; git clone git://git.osmocom.org/openbsc.git |
46 | 9 | tnt | }}} |
47 | |||
48 | Compile the rest: |
||
49 | {{{ |
||
50 | cd /root/libosmocore; autoreconf -fi; ./configure; make; make install; ldconfig |
||
51 | 1 | tnt | cd /root/libosmo-abis; autoreconf -fi; ./configure; make; make install; ldconfig |
52 | 10 | tnt | cd /root/libosmo-netif; autoreconf -fi; ./configure; make; make install; ldconfig |
53 | 9 | tnt | cd /root/openbsc/openbsc; autoreconf -fi; export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig; ./configure; make |
54 | }}} |
||
55 | |||
56 | You should now have a working copy of ggsn, osmo-sgsn and osmo-nitb on your machine. |
||
57 | |||
58 | 1 | tnt | === OpenBSC configuration === |
59 | |||
60 | 3 | tnt | The first step is to configure OpenBSC for gprs support. Add this to the `network/bts` node in `openbsc.cfg`: |
61 | 1 | tnt | {{{ |
62 | 3 | tnt | gprs mode gprs |
63 | gprs routing area 0 |
||
64 | gprs cell bvci 2 |
||
65 | gprs nsei 101 |
||
66 | gprs nsvc 0 nsvci 101 |
||
67 | gprs nsvc 0 local udp port 23000 |
||
68 | gprs nsvc 0 remote udp port 23000 |
||
69 | gprs nsvc 0 remote ip 192.168.0.128 |
||
70 | 1 | tnt | }}} |
71 | |||
72 | 3 | tnt | The `gprs nsvc 0 remote` entries `192.168.0.128:23000` is the IP/port of the machine running the SGSN as seen from the BTS. It will be sent by OpenBSC to the BTS in the configration phase and the BTS will connect back to the SGSN. |
73 | |||
74 | The second step is to allocate some timeslots to packet data. For this, just change the 1 or more `network/bts/trx/timeslot` nodes using : |
||
75 | 2 | tnt | {{{ |
76 | 3 | tnt | phys_chan_config PDCH |
77 | 2 | tnt | }}} |
78 | 1 | tnt | |
79 | |||
80 | 2 | tnt | === Osmocom SGSN configuration === |
81 | 4 | tnt | |
82 | Here's a sample SGSN configuration file `osmo-sgsn.cfg` with some explanations : |
||
83 | 2 | tnt | |
84 | {{{ |
||
85 | ! |
||
86 | ! Osmocom SGSN configuration |
||
87 | ! |
||
88 | ! |
||
89 | line vty |
||
90 | no login |
||
91 | ! |
||
92 | sgsn |
||
93 | gtp local-ip 192.168.1.128 |
||
94 | ggsn 0 remote-ip 192.168.1.129 |
||
95 | ggsn 0 gtp-version 1 |
||
96 | ! |
||
97 | ns |
||
98 | timer tns-block 3 |
||
99 | timer tns-block-retries 3 |
||
100 | timer tns-reset 3 |
||
101 | timer tns-reset-retries 3 |
||
102 | timer tns-test 30 |
||
103 | timer tns-alive 3 |
||
104 | timer tns-alive-retries 10 |
||
105 | encapsulation udp local-ip 192.168.0.128 |
||
106 | encapsulation udp local-port 23000 |
||
107 | encapsulation framerelay-gre enabled 0 |
||
108 | ! |
||
109 | bssgp |
||
110 | ! |
||
111 | 1 | tnt | }}} |
112 | 4 | tnt | |
113 | * The `gtp local-ip` entry is the local IP the SGSN will bind to. |
||
114 | 1 | tnt | * The `ggsn 0 remote-ip` entry if the remote IP of the GGSN. The SGSN will connect to it. |
115 | 9 | tnt | * Those two IPs '''must''' be different even if you're running both processes on the same machine. A solution for that is to put several IP aliases on the same network interface or use the loopback interface. |
116 | 4 | tnt | * The `encapsulation` settings must be the same IP/port than you've setup in `openbsc.cfg` |
117 | |||
118 | 2 | tnt | === OpenGGSN configuration === |
119 | |||
120 | 4 | tnt | The ggsn.conf file is pretty well documented. What is mostly of interest here is : |
121 | |||
122 | * The configuration of the GTP link. (Must match the `ggsn 0 remote-ip` entry in `osmo-sgsn.cfg`) |
||
123 | |||
124 | 2 | tnt | {{{ |
125 | # TAG: listen |
||
126 | # Specifies the local IP address to listen to |
||
127 | listen 192.168.1.129 |
||
128 | }}} |
||
129 | |||
130 | 4 | tnt | * The configuration given to phones, IP pool & DNS. |
131 | |||
132 | 2 | tnt | {{{ |
133 | # TAG: dynip |
||
134 | # Dynamic IP address pool. |
||
135 | # Used for allocation of dynamic IP address when address is not given |
||
136 | # by HLR. |
||
137 | # If this option is not given then the net option is used as a substitute. |
||
138 | dynip 192.168.254.0/24 |
||
139 | |||
140 | # TAG: pcodns1/pcodns2 |
||
141 | # Protocol configuration option domain name system server 1 & 2. |
||
142 | pcodns1 208.67.222.222 |
||
143 | pcodns2 208.67.220.220 |
||
144 | }}} |
||
145 | |||
146 | === Network configuration === |
||
147 | |||
148 | You will also need to configure some networking rules to allow connectivity from `tun0`. Look up linux networking/nat howtos on google. |
||
149 | The basic setup for testing only in a safe environment would be : |
||
150 | |||
151 | {{{ |
||
152 | bash# echo 1 > /proc/sys/net/ipv4/ip_forward |
||
153 | bash# iptables -A POSTROUTING -s 192.168.254.0/24 -t nat -o eth0 -j MASQUERADE |
||
154 | }}} |
||
155 | |||
156 | (replace `eth0` by the interface providing your machine connectivity) |
||
157 | |||
158 | == Running == |
||
159 | 1 | tnt | |
160 | 4 | tnt | Just start the three processes : |
161 | * `ggsn` |
||
162 | * `osmo-sgsn` |
||
163 | 7 | laforge | * `osmo-nitb` |
164 | 4 | tnt | |
165 | You can access vty from |
||
166 | 6 | tnt | * OpenBSC on port 4242 See [wiki:osmo-nitb_VTY] |
167 | 5 | tnt | * SGSN on port 4245. See [wiki:osmo-sgsn_VTY] |