Project

General

Profile

Osmocom Network In The Box » History » Version 25

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