Project

General

Profile

Osmocom Network In The Box » History » Version 28

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