Project

General

Profile

Osmocom Network In The Box » History » Version 20

neels, 10/20/2017 01:02 AM

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