Project

General

Profile

Osmocom Network In The Box » History » Version 34

neels, 11/09/2017 06:35 PM

1 23 neels
{{>toc}}
2
3 29 neels
h1. WIP
4
5 31 neels
*This wiki page is still new and in an alpha state. We're still checking whether it is consistent and contains all the important information.*
6 29 neels
7 1 neels
h1. Osmocom Network In The Box
8
9 22 neels
This is a brief guide to the most basic and minimal setup of an Osmocom 2G and/or 3G network for voice and data services. It is a good starting point for newcomers to familiarize with the software, and to expand upon by the [[Osmocom Manuals]] and other wiki pages.
10 21 neels
11 2 neels
h2. OsmoNITB R.I.P., long live the Network In The Box
12 1 neels
13 2 neels
Historically, Osmocom offered the [[OsmoNITB:]] "Network-In-The-Box" as an actual single program. It was a useful simplification at the time, but in 2017, Osmocom have decided to split OsmoNITB into programs more closely resembling traditional network architecture. It is recommended to use the new separate components instead of the OsmoNITB, since active development focus has moved there.
14 1 neels
15 4 neels
It is still very much possible to run a complete Osmocom core network in one "box". For example, a sysmoBTS can run the entire core network on the same hardware that drives the TRX, making it a complete network in actually one single box. At the same time, having separate components also allows scaling to large deployments, with properly distributed load and a central subscriber database.
16 1 neels
17 2 neels
To migrate from OsmoNITB to the new separate programs, see the [[OsmoNITB Migration Guide]].
18
19
h2. Part of this Complete Network
20
21 32 neels
Assuming that you have your radio hardware ready (a BTS, a femto cell or an SDR driven by osmo-trx), the core network consists of separate programs providing voice/SMS/USSD ("circuit-switched" or CS) and data ("packet-switched" or PS) services.
22 2 neels
23 32 neels
Here is a table of the components you need:
24 1 neels
25 32 neels
|\4. *Required for*  |/3. *Program* |/3. *Description* |
26
|\2. *2G*  |\2. *3G* |
27
| *CS* | *PS* | *CS* | *PS* |
28
| ✔ | ✔ | ✔ | ✔ | [[OsmoHLR:]] | Home Location Register, stores subscriber IMSI, phone number and auth tokens. |
29
| ✔ | (1) | ✔ | (1) | [[OsmoMSC:]] | Mobile Switching Center, handles signalling, i.e. attach/detach of subscribers, call establishment, messaging (SMS and USSD). |
30
| ✔ |   | ✔ |   | [[OsmoMGW:]] | Media Gateway, is instructed by the MSC and/or the BSC to direct RTP streams for active voice calls. |
31
| ✔ | ✔ | ✔ | ✔ | [[OsmoSTP:]] | Signal Transfer Point, routes SCCP messages between MSC, BSC, HNBGW and for 3G also the SGSN. |
32
| ✔ | (1) |   |   | [[OsmoBSC:]] | 2G Base Station Controller, manages logical channels and other lower level aspects for one or more 2G BTS; it is technically part of the BSS and not the "core network". |
33
|   |   | ✔ | ✔ | [[OsmoHNBGW:]] | 3G HomeNodeB Gateway, receives the Iuh protocol from a 3G femto cell and forwards to MSC and SGSN by SCCP/M3UA via OsmoSTP. |
34
|   | ✔ (2) |   | ✔ (2) | [[OpenGGSN:|OsmoGGSN]] | Gateway GPRS Support Node, "opens" GTP tunnels received from SGSNs to internet uplink. |
35
|   | ✔ |   | ✔ | [[OsmoSGSN:]] | Serving GPRS Support Node, handles signalling, i.e. attach/detach of subscribers and PDP contexts. |
36
| ✔ | (1) |   |   | [[OsmoBTS:]] | for 2G networks, drives the TRX and ties to the BSC via Abis-interface. |
37
|   | ✔ |   |   | [[OsmoPCU:]] | for 2G networks, a component closely tied to the BTS, drives the TRX for PS timeslots and ties to the SGSN via Gb-interface. |
38 5 neels
39 32 neels
1: PS is always an _addition_ to CS: even though these components do not handle PS requests, you need to have these to be able to setup and register with a network, which is a prerequisite for data services.
40 28 neels
41 32 neels
2: For the GGSN to successfully route packets to an internet uplink, the system needs to have
42 28 neels
* IP-forwarding enabled,
43
* IP-masquerading set up,
44
* a usable tunnel device set up.
45
46
<pre>
47
echo 1 > /proc/sys/net/ipv4/ip_forward
48 33 neels
iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
49 34 neels
# Replace 'eth0' with your ethernet device name, or use '*' for all.
50 1 neels
</pre>
51
52 34 neels
53 18 neels
54 5 neels
h1. Have to Know
55 10 neels
56
Each program features a detailed [[Osmocom Manuals|user manual]], your primary source of information to expand on the setup described here.
57 24 laforge
58 5 neels
Osmocom offers [[Binary_Packages|compiled packages for various distributions]]. If you're up to it, you may also [[Build from Source]].
59
60
Each Osmocom program typically has
61
62 1 neels
* a distinct configuration file;
63 25 neels
* a VTY telnet console for live interaction;
64 1 neels
* a CTRL interface for live interaction from 3rd party programs.
65 18 neels
66
See [[Port Numbers]] to find out which program runs VTY on which port.
67
68
h1. Configuration Examples
69 5 neels
70 6 neels
h2. OsmoHLR
71
72
See the [[Osmocom Manuals|manual]] on creating a subscriber database, and add one or more subscribers.
73
74
While you do need one, your configuration file may actually remain empty. This will serve GSUP on localhost (127.0.0.1), sufficient for a Network In The Box.
75
76
h2. OsmoMSC
77
78
The VLR component of OsmoMSC needs to connect to the OsmoHLR's GSUP server to know which subscribers are authorized. By default, it will connect to OsmoHLR on localhost, no explicit config needed.
79 26 neels
80 6 neels
To be reachable by OsmoBSC and OsmoHNBGW, OsmoMSC needs an SCCP point code, and it needs to connect to OsmoSTP to make itself known to SCCP routing.
81 7 neels
82 6 neels
* There is a default point code, currently 0.23.1 (in 8.8.3 point code format).
83
* OsmoMSC will by default look for OsmoSTP on localhost's M3UA port, 2905.
84 7 neels
85 6 neels
To direct RTP streams, OsmoMSC needs an OsmoMGW instance. By default, it will look for an MGW on localhost and the default MGCP port, 4222.
86
87 9 neels
Again, your config file may remain empty.
88
89
h2. OsmoMGW
90 27 neels
91
*NOTE: Currently, OsmoMSC still requires the legacy osmo-bsc_mgcp program, which will move to the new osmo-mgw soon. osmo-bsc_mgcp is still available from osmo-mgw.git.*
92 9 neels
93
The Media Gateway receives instructions in the form of MGCP messages from OsmoMSC. It forwards RTP streams directly between BTS, femto cells and remote endpoints, e.g. other MGW instances.
94
95
Its RTP IP address must be reachable by the BTS / the femto cell.
96
97
* In a setup that truly runs in one box (e.g. sysmoBTS or osmo-trx with co-located core network), this may be localhost (127.0.0.1).
98
* With a separate BTS or RNC (e.g. 3G femto cell or nanoBTS), make sure to configure an IP address that is reachable.
99
100
*osmo-mgw.cfg*
101
<pre>
102
mgcp
103
  local ip 192.168.0.3
104
  bind ip 192.168.0.3
105
</pre>
106
107
The default is to allow any BTS / femto cell IP address to connect.
108
109
(Near future: a second OsmoMGW may be needed to run alongside each OsmoBSC instance.)
110
111
h2. OsmoSTP
112
113
OsmoSTP acts as a server for routing messages. OsmoMSC, OsmoBSC, OsmoHNBGW and OsmoSGSN contact OsmoSTP and announce their own point code, after which they may instruct OsmoSTP to route SCCP messages to each other by these point codes.
114
115
The basic configuration that permits dynamic routing is:
116
117
*osmo-stp.cfg*
118
<pre>
119
cs7 instance 0
120
 xua rkm routing-key-allocation dynamic-permitted
121
 listen m3ua 2905
122
  accept-asp-connections dynamic-permitted
123 11 neels
</pre>
124
125
h2. OsmoBSC
126
127
OsmoBSC needs to register with OsmoSTP, and contact the MSC by its point code.
128
129
OsmoBSC also needs complete configuration of all connected BTS. This example shows configuration for a sysmoBTS.
130
131
Furthermore, some network properties need to be set.
132 15 neels
133
The 'gprs mode' determines whether packet switched access will be enabled. 'gprs mode none' switches off data services, as osmo-bts will not contact osmo-pcu to establish data service. This is a configuration without packet switched service:
134
135 11 neels
*osmo-bsc.cfg* for voice only
136
<pre>
137
network
138
 network country code 901
139
 mobile network code 70
140
 mm info 1
141
 short name Osmocom
142
 long name Osmocom
143
 auth policy closed
144
 encryption a5 0
145
 bts 0
146
  type sysmobts
147
  band GSM-1800
148
  cell_identity 0
149
  location_area_code 23
150
  ip.access unit_id 1800 0
151
  gprs mode none
152
  trx 0
153
   rf_locked 0
154
   arfcn 868
155
   nominal power 23
156
   timeslot 0
157
    phys_chan_config CCCH+SDCCH4
158
   timeslot 1
159
    phys_chan_config SDCCH8
160
   timeslot 2
161
    phys_chan_config TCH/H
162
   timeslot 3
163
    phys_chan_config TCH/H
164
   timeslot 4
165
    phys_chan_config TCH/H
166
   timeslot 5
167
    phys_chan_config TCH/H
168
   timeslot 6
169
    phys_chan_config TCH/H
170
   timeslot 7
171
    phys_chan_config TCH/H
172
cs7 instance 0
173
 ! osmo-bsc's own point code
174
 point-code 0.42.0
175
 ! address book entry named 'msc_remote', used below
176
 sccp-address msc_remote
177
  point-code 0.23.1
178
msc 0
179 1 neels
 msc-addr msc_remote
180 15 neels
</pre>
181
182
To allow data service, set a 'gprs mode gprs' or 'gprs mode egprs', and configure PDCH timeslots. Traditionally, a fixed amount of TCH timeslots for voice and PDCH timeslots for data service are configured. OsmoBTS also supports two types of dynamic timeslots, as described in the "Abis manual":http://ftp.osmocom.org/docs/latest/osmobts-abis.pdf, chapter "Dynamic Channel Combinations". The following is a configuration with data service based on Osmocom style dynamic timeslots:
183
184
185
*osmo-bsc.cfg* for voice and data service
186
<pre>
187
network
188
 network country code 901
189
 mobile network code 70
190
 mm info 1
191
 short name Osmocom
192
 long name Osmocom
193
 auth policy closed
194
 encryption a5 0
195
 bts 0
196
  type sysmobts
197
  band GSM-1800
198
  cell_identity 0
199
  location_area_code 23
200
  ip.access unit_id 1800 0
201
  gprs mode gprs
202
  trx 0
203
   rf_locked 0
204
   arfcn 868
205
   nominal power 23
206
   timeslot 0
207
    phys_chan_config CCCH+SDCCH4
208
   timeslot 1
209
    phys_chan_config SDCCH8
210
   timeslot 2
211
    phys_chan_config TCH/F_TCH/H_PDCH
212
   timeslot 3
213
    phys_chan_config TCH/F_TCH/H_PDCH
214
   timeslot 4
215
    phys_chan_config TCH/F_TCH/H_PDCH
216
   timeslot 5
217
    phys_chan_config TCH/F_TCH/H_PDCH
218
   timeslot 6
219
    phys_chan_config TCH/F_TCH/H_PDCH
220
   timeslot 7
221
    phys_chan_config PDCH
222
cs7 instance 0
223
 ! osmo-bsc's own point code
224
 point-code 0.42.0
225
 ! address book entry named 'msc_remote', used below
226
 sccp-address msc_remote
227
  point-code 0.23.1
228
msc 0
229
 msc-addr msc_remote
230
</pre>
231 12 neels
232 1 neels
h2. OsmoHNBGW
233 16 neels
234 1 neels
For connecting a 3G hNodeB (femto cell), OsmoHNBGW is needed to receive Iuh and forward IuCS and IuPS. (For a pure 2G setup, no HNBGW is needed.)
235 16 neels
236
OsmoHNBGW needs to connect to OsmoSTP for routing, and needs to know the MSC and SGSN point codes.
237
238 12 neels
It must also be reachable by the hNodeB, hence its Iuh must typically run on a public IP, not a loopback address like 127.0.0.1.
239
240
*osmo-hnbgw.cfg*
241
<pre>
242
cs7 instance 0
243
 ! OsmoHNBGW's own local point code
244
 point-code 0.3.0
245
 ! Address book entries, used below
246
 sccp-address msc
247
  point-code 0.23.1
248
 sccp-address sgsn
249
  point-code 0.23.2
250
hnbgw
251
 iuh
252
  local-ip 192.168.0.3
253
 iucs
254
  remote-addr msc
255
 iups
256
  remote-addr sgsn
257 13 neels
</pre>
258
259
h2. OsmoGGSN
260 14 neels
261 13 neels
To provide packet switched service, OsmoGGSN must offer GTP service to the OsmoSGSN. Notably, both OsmoGGSN and OsmoSGSN must use identical port numbers, which an intrinsic requirement of the GTP protocol. Hence they must not run on the same IP address. It is sufficient to, for example, run OsmoGGSN on 127.0.0.2, and OsmoSGSN's GTP on 127.0.0.1.
262
263
OsmoGGSN maintains a gsn_restart counter, to be able to reliably communicate to the SGSN that it has restarted. This is kept in the 'state-dir', by default in /tmp.
264
265
It also needs access to a tun device. This may be configured ahead of time, so that OsmoGGSN does not need root privileges. If run with 'sudo', OsmoGGSN may also create its own tun device. In below example, the 'tun4' device has been created ahead of time. IPv4 operation is enabled by default, but for future compatibility, it is good to indicate that explicitly.
266
267 1 neels
OsmoGGSN furthermore indicates DNS servers, as well as an IPv4 address range to assign to subscribers' PDP contexts.
268 14 neels
269 13 neels
*osmo-ggsn.cfg*
270
<pre>
271
ggsn ggsn0
272
 gtp bind-ip 127.0.0.2
273
 apn internet
274
  tun-device tun4
275
  type-support v4
276
  ip dns 0 192.168.100.1
277
  ip dns 1 8.8.8.8
278 1 neels
  ip ifconfig 176.16.222.0/24
279 14 neels
  ip prefix dynamic 176.16.222.0/24
280
</pre>
281
282
h2. OsmoSGSN
283
284
OsmoSGSN needs to reach the GGSN to establish GTP tunnels for subscribers. It must have a separate GTP IP address from OsmoGGSN, as mentioned before.
285
286
For 2G, OsmoSGSN needs to be reachable by the PCU, and needs a public IP for the Gb interface if it is not running directly on the BTS hardware (e.g. on sysmoBTS or when using osmo-trx). For 2G operation, SGSN and GGSN may both use a local IP address for GTP, as long as they differ (e.g. 127.0.0.1 and 127.0.0.2).
287
288
For 3G, OsmoSGSN needs to be reachable by both the HNBGW for IuPS as well as by the hNodeB for GTP, i.e. it definitely needs to have a public IP address for the GTP port. IuPS may remain local if both HNBGW and SGSN are on the same box.
289
290
Finally, OsmoSGSN needs access to OsmoHLR to access subscriber data. Set 'auth-policy remote' to use the HLR for subscriber authorization. The default 
291
292
*osmo-sgsn.cfg*
293
<pre>
294
sgsn
295
 gtp local-ip 192.168.0.3
296 1 neels
 ggsn 0 remote-ip 192.168.0.142
297 14 neels
 auth-policy remote
298 13 neels
 gsup remote-ip 127.0.0.1
299 17 neels
</pre>
300 18 neels
301 17 neels
h1. Running Examples
302
303
Each Osmocom program comes with a systemd service file. It is recommended to place config files in /etc/osmocom/ and launch the individual components using systemd.
304
305
When installed from debian or opkg feeds, you will find the systemd service files in /lib/systemd/system/.
306
307
Re/starting and stopping then works like this:
308
309
<pre>
310
systemctl restart osmo-hlr
311 1 neels
systemctl stop osmo-hlr
312
</pre>
313
314
For illustration, the manual command invocations for the components would look like this:
315
316
<pre>
317
osmo-hlr -l hlr.db -c osmo-hlr.cfg
318
osmo-msc -c osmo-msc.cfg
319
osmo-mgw -c osmo-mgw.cfg
320
osmo-stp -c osmo-stp.cfg
321
osmo-bsc -c osmo-bsc.cfg
322
osmo-hnbgw -c osmo-hnbgw.cfg
323
osmo-ggsn -c osmo-ggsn.cfg
324
osmo-sgsn -c osmo-sgsn.cfg
325 18 neels
</pre>
326
327
h1. Logging Examples
328
329
Osmocom programs have a common logging mechanism, configurable by the config files as well as the telnet VTY.
330
331
Depending on the system's logging configuration, logs may by default be visible in /var/log/daemon.log, or by using journalctl:
332
333
<pre>
334
journalctl -f -u osmo-hlr
335
</pre>
336
337
When journalctl is used, it may be necessary to enable it first, e.g. by setting "Storage=volatile" in /etc/systemd/journald.conf followed by a 'systemctl restart systemd-journald'.
338 19 neels
339
A sure way to see the logs is to connect to the program's telnet VTY and enable logging on the VTY session -- this way you do not modify the application's default logging, but create a separate logging target for your telnet VTY session:
340
341
<pre>
342
$ telnet localhost 4254
343
OsmoMSC> logging enable 
344
OsmoMSC> logging level ?
345
  all      Global setting for all subsystems
346
  rll      A-bis Radio Link Layer (RLL)
347
  cc       Layer3 Call Control (CC)
348
  mm       Layer3 Mobility Management (MM)
349
  rr       Layer3 Radio Resource (RR)
350
  rsl      A-bis Radio Siganlling Link (RSL)
351
  nm       A-bis Network Management / O&M (NM/OML)
352
  mncc     MNCC API for Call Control application
353
  pag      Paging Subsystem
354
  meas     Radio Measurement Processing
355
  sccp     SCCP Protocol
356
  msc      Mobile Switching Center
357
  mgcp     Media Gateway Control Protocol
358
  ho       Hand-Over
359
  db       Database Layer
360
  ref      Reference Counting
361
  gprs     GPRS Packet Service
362
  ns       GPRS Network Service (NS)
363
  bssgp    GPRS BSS Gateway Protocol (BSSGP)
364
  llc      GPRS Logical Link Control Protocol (LLC)
365
  sndcp    GPRS Sub-Network Dependent Control Protocol (SNDCP)
366
  nat      GSM 08.08 NAT/Multiplexer
367
  ctrl     Control interface
368
  smpp     SMPP interface for external SMS apps
369
  filter   BSC/NAT IMSI based filtering
370
  ranap    Radio Access Network Application Part Protocol
371
  sua      SCCP User Adaptation Protocol
372
  pcu      PCU Interface
373
  vlr      Visitor Location Register
374
  iucs     Iu-CS Protocol
375
  sigtran  SIGTRAN Signalling Transport
376
  lglobal  Library-internal global log family
377
  llapd    LAPD in libosmogsm
378
  linp     A-bis Intput Subsystem
379
  lmux     A-bis B-Subchannel TRAU Frame Multiplex
380
  lmi      A-bis Input Driver for Signalling
381
  lmib     A-bis Input Driver for B-Channels (voice)
382
  lsms     Layer3 Short Message Service (SMS)
383
  lctrl    Control Interface
384
  lgtp     GPRS GTP library
385
  lstats   Statistics messages and logging
386
  lgsup    Generic Subscriber Update Protocol
387
  loap     Osmocom Authentication Protocol
388
  lss7     libosmo-sigtran Signalling System 7
389
  lsccp    libosmo-sigtran SCCP Implementation
390
  lsua     libosmo-sigtran SCCP User Adaptation
391
  lm3ua    libosmo-sigtran MTP3 User Adaptation
392
  lmgcp    libosmo-mgcp Media Gateway Control Protocol
393
OsmoMSC> logging level mm ?
394
everything debug      info       notice     error      fatal      
395
OsmoMSC> logging level mm debug 
396
OsmoMSC> logging level rr debug
397
OsmoMSC> logging filter all 1
398 20 neels
</pre>
399
400 1 neels
You will see logging output on your telnet console immediately. Note that the VTY prompt is still listening, so you may at any time issue 'logging filter all 0' to switch off logging, and be able to type commands without being cluttered by ongoing log output.
Add picture from clipboard (Maximum size: 48.8 MB)