Project

General

Profile

Osmocom Network In The Box » History » Version 22

neels, 10/20/2017 01:07 AM

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