Project

General

Profile

Osmocom Network In The Box » History » Version 27

neels, 10/30/2017 11:49 PM

1 23 neels
{{>toc}}
2
3 1 neels
h1. Osmocom Network In The Box
4
5 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.
6 21 neels
7 2 neels
h2. OsmoNITB R.I.P., long live the Network In The Box
8 1 neels
9 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.
10 1 neels
11 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.
12 1 neels
13 2 neels
To migrate from OsmoNITB to the new separate programs, see the [[OsmoNITB Migration Guide]].
14
15
h2. Part of this Complete Network
16
17
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") and data ("packet-switched") services.
18
19
h3. Circuit-Switched Components
20
21
To run a circuit-switched core network, you need:
22
23
* [[OsmoHLR:]] -- Home Location Register, stores subscriber IMSI, phone number and auth tokens.
24
* [[OsmoMSC:]] -- Mobile Switching Center, handles signalling, i.e. attach/detach of subscribers, call establishment, messaging (SMS and USSD).
25 1 neels
* [[OsmoMGW:]] -- Media Gateway, is instructed by the MSC and/or the BSC to direct RTP streams for active voice calls.
26 8 neels
* [[OsmoSTP:]] -- Signal Transfer Point, routes SCCP messages between MSC, BSC, HNBGW and for 3G also the SGSN.
27 2 neels
* [[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".
28
* [[OsmoHNBGW:]] -- 3G HomeNodeB Gateway, receives the Iuh protocol from a 3G femto cell and forwards to MSC and SGSN by SCCP/M3UA via OsmoSTP.
29
30
h3. Packet-Switched Components
31
32 3 neels
* [[OpenGGSN:|OsmoGGSN]] -- Gateway GPRS Support Node, "opens" GTP tunnels received from SGSNs to internet uplink.
33 2 neels
* [[OsmoSGSN:]] -- Serving GPRS Support Node, handles signalling, i.e. attach/detach of subscribers and PDP contexts.
34
* [[OsmoHLR:]] -- same as for circuit switched, see above.
35
* [[OsmoHNBGW:]] -- for 3G packet switched networks, same as for 3G circuit switched, see above.
36
* ([[OsmoPCU:]] -- for 2G networks, a component closely tied to the BTS, drives the TRX and ties to the SGSN via Gb-interface.)
37 5 neels
38 18 neels
h1. Have to Know
39 5 neels
40 10 neels
Each program features a detailed [[Osmocom Manuals|user manual]], your primary source of information to expand on the setup described here.
41
42 24 laforge
Osmocom offers [[Binary_Packages|compiled packages for various distributions]]. If you're up to it, you may also [[Build from Source]].
43 5 neels
44
Each Osmocom program typically has
45
46
* a distinct configuration file;
47 1 neels
* a VTY telnet console for live interaction;
48 25 neels
* a CTRL interface for live interaction from 3rd party programs.
49 1 neels
50 18 neels
See [[Port Numbers]] to find out which program runs VTY on which port.
51
52
h1. Configuration Examples
53
54 5 neels
h2. OsmoHLR
55 6 neels
56
See the [[Osmocom Manuals|manual]] on creating a subscriber database, and add one or more subscribers.
57
58
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.
59
60
h2. OsmoMSC
61
62
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.
63
64 26 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.
65 6 neels
66 7 neels
* There is a default point code, currently 0.23.1 (in 8.8.3 point code format).
67 6 neels
* OsmoMSC will by default look for OsmoSTP on localhost's M3UA port, 2905.
68
69 7 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.
70 6 neels
71
Again, your config file may remain empty.
72 9 neels
73
h2. OsmoMGW
74
75 27 neels
*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.*
76
77 9 neels
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.
78
79
Its RTP IP address must be reachable by the BTS / the femto cell.
80
81
* 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).
82
* With a separate BTS or RNC (e.g. 3G femto cell or nanoBTS), make sure to configure an IP address that is reachable.
83
84
*osmo-mgw.cfg*
85
<pre>
86
mgcp
87
  local ip 192.168.0.3
88
  bind ip 192.168.0.3
89
</pre>
90
91
The default is to allow any BTS / femto cell IP address to connect.
92
93
(Near future: a second OsmoMGW may be needed to run alongside each OsmoBSC instance.)
94
95
h2. OsmoSTP
96
97
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.
98
99
The basic configuration that permits dynamic routing is:
100
101
*osmo-stp.cfg*
102
<pre>
103
cs7 instance 0
104
 xua rkm routing-key-allocation dynamic-permitted
105
 listen m3ua 2905
106
  accept-asp-connections dynamic-permitted
107
</pre>
108 11 neels
109
h2. OsmoBSC
110
111
OsmoBSC needs to register with OsmoSTP, and contact the MSC by its point code.
112
113
OsmoBSC also needs complete configuration of all connected BTS. This example shows configuration for a sysmoBTS.
114
115
Furthermore, some network properties need to be set.
116
117 15 neels
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:
118
119
*osmo-bsc.cfg* for voice only
120 11 neels
<pre>
121
network
122
 network country code 901
123
 mobile network code 70
124
 mm info 1
125
 short name Osmocom
126
 long name Osmocom
127
 auth policy closed
128
 encryption a5 0
129
 bts 0
130
  type sysmobts
131
  band GSM-1800
132
  cell_identity 0
133
  location_area_code 23
134
  ip.access unit_id 1800 0
135
  gprs mode none
136
  trx 0
137
   rf_locked 0
138
   arfcn 868
139
   nominal power 23
140
   timeslot 0
141
    phys_chan_config CCCH+SDCCH4
142
   timeslot 1
143
    phys_chan_config SDCCH8
144
   timeslot 2
145
    phys_chan_config TCH/H
146
   timeslot 3
147
    phys_chan_config TCH/H
148
   timeslot 4
149
    phys_chan_config TCH/H
150
   timeslot 5
151
    phys_chan_config TCH/H
152
   timeslot 6
153
    phys_chan_config TCH/H
154
   timeslot 7
155
    phys_chan_config TCH/H
156
cs7 instance 0
157
 ! osmo-bsc's own point code
158
 point-code 0.42.0
159
 ! address book entry named 'msc_remote', used below
160
 sccp-address msc_remote
161
  point-code 0.23.1
162
msc 0
163
 msc-addr msc_remote
164 1 neels
</pre>
165 15 neels
166
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:
167
168
169
*osmo-bsc.cfg* for voice and data service
170
<pre>
171
network
172
 network country code 901
173
 mobile network code 70
174
 mm info 1
175
 short name Osmocom
176
 long name Osmocom
177
 auth policy closed
178
 encryption a5 0
179
 bts 0
180
  type sysmobts
181
  band GSM-1800
182
  cell_identity 0
183
  location_area_code 23
184
  ip.access unit_id 1800 0
185
  gprs mode gprs
186
  trx 0
187
   rf_locked 0
188
   arfcn 868
189
   nominal power 23
190
   timeslot 0
191
    phys_chan_config CCCH+SDCCH4
192
   timeslot 1
193
    phys_chan_config SDCCH8
194
   timeslot 2
195
    phys_chan_config TCH/F_TCH/H_PDCH
196
   timeslot 3
197
    phys_chan_config TCH/F_TCH/H_PDCH
198
   timeslot 4
199
    phys_chan_config TCH/F_TCH/H_PDCH
200
   timeslot 5
201
    phys_chan_config TCH/F_TCH/H_PDCH
202
   timeslot 6
203
    phys_chan_config TCH/F_TCH/H_PDCH
204
   timeslot 7
205
    phys_chan_config PDCH
206
cs7 instance 0
207
 ! osmo-bsc's own point code
208
 point-code 0.42.0
209
 ! address book entry named 'msc_remote', used below
210
 sccp-address msc_remote
211
  point-code 0.23.1
212
msc 0
213
 msc-addr msc_remote
214
</pre>
215
216 12 neels
h2. OsmoHNBGW
217 1 neels
218 16 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.)
219 1 neels
220 16 neels
OsmoHNBGW needs to connect to OsmoSTP for routing, and needs to know the MSC and SGSN point codes.
221
222
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.
223 12 neels
224
*osmo-hnbgw.cfg*
225
<pre>
226
cs7 instance 0
227
 ! OsmoHNBGW's own local point code
228
 point-code 0.3.0
229
 ! Address book entries, used below
230
 sccp-address msc
231
  point-code 0.23.1
232
 sccp-address sgsn
233
  point-code 0.23.2
234
hnbgw
235
 iuh
236
  local-ip 192.168.0.3
237
 iucs
238
  remote-addr msc
239
 iups
240
  remote-addr sgsn
241
</pre>
242 13 neels
243
h2. OsmoGGSN
244
245 14 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.
246 13 neels
247
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.
248
249
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.
250
251
OsmoGGSN furthermore indicates DNS servers, as well as an IPv4 address range to assign to subscribers' PDP contexts.
252 1 neels
253 14 neels
*osmo-ggsn.cfg*
254 13 neels
<pre>
255
ggsn ggsn0
256
 gtp bind-ip 127.0.0.2
257
 apn internet
258
  tun-device tun4
259
  type-support v4
260
  ip dns 0 192.168.100.1
261
  ip dns 1 8.8.8.8
262
  ip ifconfig 176.16.222.0/24
263 1 neels
  ip prefix dynamic 176.16.222.0/24
264 14 neels
</pre>
265
266
h2. OsmoSGSN
267
268
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.
269
270
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).
271
272
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.
273
274
Finally, OsmoSGSN needs access to OsmoHLR to access subscriber data. Set 'auth-policy remote' to use the HLR for subscriber authorization. The default 
275
276
*osmo-sgsn.cfg*
277
<pre>
278
sgsn
279
 gtp local-ip 192.168.0.3
280
 ggsn 0 remote-ip 192.168.0.142
281 1 neels
 auth-policy remote
282 14 neels
 gsup remote-ip 127.0.0.1
283 13 neels
</pre>
284 17 neels
285 18 neels
h1. Running Examples
286 17 neels
287
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.
288
289
When installed from debian or opkg feeds, you will find the systemd service files in /lib/systemd/system/.
290
291
Re/starting and stopping then works like this:
292
293
<pre>
294
systemctl restart osmo-hlr
295
systemctl stop osmo-hlr
296 1 neels
</pre>
297
298
For illustration, the manual command invocations for the components would look like this:
299
300
<pre>
301
osmo-hlr -l hlr.db -c osmo-hlr.cfg
302
osmo-msc -c osmo-msc.cfg
303
osmo-mgw -c osmo-mgw.cfg
304
osmo-stp -c osmo-stp.cfg
305
osmo-bsc -c osmo-bsc.cfg
306
osmo-hnbgw -c osmo-hnbgw.cfg
307
osmo-ggsn -c osmo-ggsn.cfg
308
osmo-sgsn -c osmo-sgsn.cfg
309
</pre>
310 18 neels
311
h1. Logging Examples
312
313
Osmocom programs have a common logging mechanism, configurable by the config files as well as the telnet VTY.
314
315
Depending on the system's logging configuration, logs may by default be visible in /var/log/daemon.log, or by using journalctl:
316
317
<pre>
318
journalctl -f -u osmo-hlr
319
</pre>
320
321
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'.
322
323 19 neels
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:
324
325
<pre>
326
$ telnet localhost 4254
327
OsmoMSC> logging enable 
328
OsmoMSC> logging level ?
329
  all      Global setting for all subsystems
330
  rll      A-bis Radio Link Layer (RLL)
331
  cc       Layer3 Call Control (CC)
332
  mm       Layer3 Mobility Management (MM)
333
  rr       Layer3 Radio Resource (RR)
334
  rsl      A-bis Radio Siganlling Link (RSL)
335
  nm       A-bis Network Management / O&M (NM/OML)
336
  mncc     MNCC API for Call Control application
337
  pag      Paging Subsystem
338
  meas     Radio Measurement Processing
339
  sccp     SCCP Protocol
340
  msc      Mobile Switching Center
341
  mgcp     Media Gateway Control Protocol
342
  ho       Hand-Over
343
  db       Database Layer
344
  ref      Reference Counting
345
  gprs     GPRS Packet Service
346
  ns       GPRS Network Service (NS)
347
  bssgp    GPRS BSS Gateway Protocol (BSSGP)
348
  llc      GPRS Logical Link Control Protocol (LLC)
349
  sndcp    GPRS Sub-Network Dependent Control Protocol (SNDCP)
350
  nat      GSM 08.08 NAT/Multiplexer
351
  ctrl     Control interface
352
  smpp     SMPP interface for external SMS apps
353
  filter   BSC/NAT IMSI based filtering
354
  ranap    Radio Access Network Application Part Protocol
355
  sua      SCCP User Adaptation Protocol
356
  pcu      PCU Interface
357
  vlr      Visitor Location Register
358
  iucs     Iu-CS Protocol
359
  sigtran  SIGTRAN Signalling Transport
360
  lglobal  Library-internal global log family
361
  llapd    LAPD in libosmogsm
362
  linp     A-bis Intput Subsystem
363
  lmux     A-bis B-Subchannel TRAU Frame Multiplex
364
  lmi      A-bis Input Driver for Signalling
365
  lmib     A-bis Input Driver for B-Channels (voice)
366
  lsms     Layer3 Short Message Service (SMS)
367
  lctrl    Control Interface
368
  lgtp     GPRS GTP library
369
  lstats   Statistics messages and logging
370
  lgsup    Generic Subscriber Update Protocol
371
  loap     Osmocom Authentication Protocol
372
  lss7     libosmo-sigtran Signalling System 7
373
  lsccp    libosmo-sigtran SCCP Implementation
374
  lsua     libosmo-sigtran SCCP User Adaptation
375
  lm3ua    libosmo-sigtran MTP3 User Adaptation
376
  lmgcp    libosmo-mgcp Media Gateway Control Protocol
377
OsmoMSC> logging level mm ?
378
everything debug      info       notice     error      fatal      
379
OsmoMSC> logging level mm debug 
380
OsmoMSC> logging level rr debug
381
OsmoMSC> logging filter all 1
382
</pre>
383 20 neels
384
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)