Project

General

Profile

Osmocom Network In The Box » History » Version 115

duo_kali, 05/25/2018 05:08 AM

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 68 neels
h1. 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 68 neels
h1. Part of this Complete Network
16 2 neels
17 32 neels
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" or CS) and data ("packet-switched" or PS) services.
18 2 neels
19 32 neels
Here is a table of the components you need:
20 1 neels
21 32 neels
|\4. *Required for*  |/3. *Program* |/3. *Description* |
22
|\2. *2G*  |\2. *3G* |
23
| *CS* | *PS* | *CS* | *PS* |
24 92 neels
| ✔ | ✔ | ✔ | ✔ | [[Osmocom Network In The Box#OsmoHLR|OsmoHLR]] | Home Location Register, stores subscriber IMSI, phone number and auth tokens. |
25 99 neels
| ✔ | (1) | ✔ (3) | (1) | [[Osmocom Network In The Box#OsmoMSC|OsmoMSC]] | Mobile Switching Center, handles signalling, i.e. attach/detach of subscribers, call establishment, messaging (SMS and USSD). |
26 92 neels
| ✔ |   | ✔ |   | [[Osmocom Network In The Box#OsmoMGW|OsmoMGW]] | Media Gateway, is instructed by the MSC and/or the BSC to direct RTP streams for active voice calls. |
27
| ✔ | ✔ | ✔ | ✔ | [[Osmocom Network In The Box#OsmoSTP|OsmoSTP]] | Signal Transfer Point, routes SCCP messages between MSC, BSC, HNBGW and for 3G also the SGSN. |
28
| ✔ | (1) |   |   | [[Osmocom Network In The Box#OsmoBSC|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". |
29
|   |   | ✔ | ✔ | [[Osmocom Network In The Box#OsmoHNBGW|OsmoHNBGW]] | 3G HomeNodeB Gateway, receives the Iuh protocol from a 3G femto cell and forwards to MSC and SGSN by SCCP/M3UA via OsmoSTP. |
30
|   | ✔ (2) |   | ✔ (2) | [[Osmocom Network In The Box#OsmoGGSN|OsmoGGSN]] | Gateway GPRS Support Node, "opens" GTP tunnels received from SGSNs to internet uplink. |
31 99 neels
|   | ✔ |   | ✔ (3) | [[Osmocom Network In The Box#OsmoSGSN|OsmoSGSN]] | Serving GPRS Support Node, handles signalling, i.e. attach/detach of subscribers and PDP contexts. |
32 92 neels
| ✔ | (1) |   |   | [[Osmocom Network In The Box#OsmoBTS|OsmoBTS]] | for 2G networks, drives the TRX and ties to the BSC via Abis-interface. |
33
|   | ✔ |   |   | [[Osmocom Network In The Box#OsmoPCU|OsmoPCU]] | for 2G networks, a component closely tied to the BTS, drives the TRX for PS timeslots and ties to the SGSN via Gb-interface. |
34 37 neels
|   |   | ✔ | ✔ | hNodeb | 3rd party 3G femto cell hardware to connect to OsmoHNBGW via Iuh |
35 5 neels
36 99 neels
1: PS is always an _addition_ to CS: even though these components do not handle PS requests, you need to have these to be able to setup and register with a network, which is a prerequisite for data services. That is mostly due to policy by the mobile phones, theoretically they could accept a network without voice service.
37 1 neels
38 32 neels
2: For the GGSN to successfully route packets to an internet uplink, it needs a tun device set up and usually IP masquerading/forwarding enabled. Please refer to the OsmoGGSN manual for more details.
39 99 neels
40
3: If building from source, remember to build with --enable-iu. (Our binary packages are built with --enable-iu.)
41 18 neels
42 68 neels
h2. Topology
43 55 neels
44
{{graphviz_link()
45
digraph G {
46
  rankdir = LR;
47 56 neels
  
48
  MS [label="MS\n(2G phone)"]
49
  UE [label="UE\n(3G phone)"]
50 1 neels
51 56 neels
  subgraph cluster_bts {
52
    BTS [rank="min"]
53
    PCU [rank="min"]
54
  }
55
56
  subgraph cluster_msc_mgw {
57 59 neels
    label=MGCP;style=dotted
58 56 neels
    MSC
59 57 neels
    MGW1 [label="MGW"]
60 56 neels
  }
61
62
  subgraph cluster_bsc_mgw {
63 59 neels
    label=MGCP;style=dotted
64 56 neels
    BSC
65 57 neels
    MGW2 [label="MGW"]
66 1 neels
  }
67
68 59 neels
  hNodeB [shape="box",label="hNodeB\n(3G femto cell)"]
69
70 61 neels
  MS -> BTS [label="Um"]
71 65 neels
  MS -> PCU [style="dashed"]
72 60 neels
 
73 56 neels
  BTS -> BSC [label="Abis/IP"]
74
  STP [label="STP\n(SCCP/M3UA)"]
75
  BSC -> STP -> MSC [label="A"]
76 70 neels
  MSC -> HLR [label="GSUP"]
77
  SGSN -> HLR [label="GSUP",style="dashed"]
78 62 neels
  UE -> hNodeB [label="Uu"]
79 65 neels
  UE -> hNodeB [style="dashed"]
80 56 neels
  hNodeB -> HNBGW [label="Iuh"]
81 1 neels
  HNBGW -> STP -> SGSN [label="IuPS",style="dashed"]
82 104 neels
  HNBGW -> STP -> MSC [label="IuCS"]
83 61 neels
  PCU -> SGSN [label="Gb",style="dashed"]
84 58 neels
  SGSN -> GGSN [label="GTP-C",style="dashed"]
85
  SGSN -> GGSN [label="GTP-U(2G)",style="dashed"]
86
  hNodeB -> GGSN [label="GTP-U(3G)",style="dashed"]
87
  GGSN -> internet [label="tun",style="dashed"]
88 56 neels
89 73 neels
  BTS -> MGW2 -> MGW1 [label="RTP"]
90 59 neels
  MGW1 -> MGW1 [label="RTP"]
91 1 neels
  hNodeB -> MGW1 [label="IuUP/RTP"]
92 59 neels
93
  A, B, C, D [style="invisible"]
94 63 neels
  A -> B [label="data (PS)",style="dashed"]
95 103 neels
  C -> D [label="voice/SMS/USSD (CS)"]
96 56 neels
97 55 neels
}
98
}}
99
100 5 neels
h1. Have to Know
101 10 neels
102
Each program features a detailed [[Osmocom Manuals|user manual]], your primary source of information to expand on the setup described here.
103 24 laforge
104 5 neels
Osmocom offers [[Binary_Packages|compiled packages for various distributions]]. If you're up to it, you may also [[Build from Source]].
105
106
Each Osmocom program typically has
107
108 1 neels
* a distinct configuration file;
109 25 neels
* a VTY telnet console for live interaction;
110 1 neels
* a CTRL interface for live interaction from 3rd party programs.
111 18 neels
112 102 neels
See [[Port Numbers]] to find out which program runs what services on which port.
113 18 neels
114
h1. Configuration Examples
115 5 neels
116 83 neels
Here is a tarball of the config files discussed below: attachment:nitb.tar
117
118 6 neels
h2. OsmoHLR
119
120 93 neels
[[OsmoHLR:]] is the Home Location Register: it stores subscriber IMSI, phone number and auth tokens. This is where you configure who is allowed on your network and who has which phone number.
121 67 neels
122 72 neels
osmo-hlr will automatically bootstrap an empty subscriber database. See the [[Osmocom Manuals|manual]] on how to add one or more subscribers -- if you don't know your IMSI, it can be useful to attempt a connection and watch the OsmoHLR log for a rejected IMSI. To migrate subscribers from an older OsmoNITB database, see the [[OsmoNITB migration guide]].
123 6 neels
124 50 neels
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 with MSC and SGSN on the same machine as the HLR.
125 6 neels
126 108 neels
*osmo-hlr.cfg* (download: attachment:nitb.tar)
127 48 neels
<pre>
128 71 neels
# empty, the defaults are sufficient
129 48 neels
</pre>
130
131 97 neels
Once your HLR is running, you will want to add subscribers with authentication keys to the HLR database. Please refer to the OsmoHLR [[Osmocom Manuals]], section "Managing Subscribers".
132
133 6 neels
h2. OsmoMSC
134 1 neels
135 93 neels
[[OsmoMSC:]] is the Mobile Switching Center: it handles signalling, i.e. attach/detach of subscribers, call establishment, messaging (SMS and USSD). The OsmoMSC is your central "manager" of the network.
136 66 neels
137 6 neels
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.
138 26 neels
139 6 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.
140 7 neels
141 86 neels
* There is a default point code, currently 0.23.1 (in 8.8.3 point code format, see [[Point Codes]]).
142 6 neels
* OsmoMSC will by default look for OsmoSTP on localhost's M3UA port, 2905.
143 7 neels
144 51 neels
To direct RTP streams, OsmoMSC needs an OsmoMGW instance (see OsmoMGW below).
145 38 neels
146 51 neels
You only need to set up your MCC, MNC, and how to reach/use the MGW.
147 43 neels
148 108 neels
*osmo-msc.cfg* (download: attachment:nitb.tar)
149 1 neels
<pre>
150 38 neels
network
151
 network country code 901
152 53 neels
 mobile network code 70
153
msc
154 82 neels
 mgw remote-ip 192.168.0.9
155 38 neels
</pre>
156 47 neels
157 1 neels
h2. OsmoMGW
158
159 93 neels
[[OsmoMGW:]] is the Media Gateway: it is instructed by the MSC and/or the BSC to direct RTP streams for active voice calls. The Media Gateway receives instructions in the form of MGCP messages from OsmoMSC/OsmoBSC. It forwards RTP streams directly between BTS, femto cells and remote endpoints, e.g. other MGW instances, and its job is to transcode between codecs (future).
160 52 neels
161 47 neels
You need an OsmoMGW to serve OsmoMSC's MGCP requests, and an OsmoMGW to serve OsmoBSC's MGCP requests. In fact, these two can be served by one single OsmoMGW instance. If you would like to keep two separate OsmoMGW instances, you need to take care that they don't attempt to bind to identical ports on the same IP address (for MGCP, but also for VTY and CTRL interfaces).
162
163
Consider that you have a 2G network with an external BTS (say a sysmoBTS), which means that you need your OsmoBSC's MGW instance to be reachable on a public interface. So far the MSC's MGW can be on a local loopback interface, it only needs to be reachable by the BSC's MGW and by the MSC.
164
165
If you also have a 3G femto cell, then the MSC's MGW instance also needs to be on a public interface. At this point you either need two public interface addresses, or you need to put one of the MGWs on a different MGCP port.
166
167 105 neels
You may decide to use one OsmoMGW for both BSC and MSC, if your network topology allows.
168
(There used to be the need to separate the endpoint config for BSC and MSC, but now the MGW takes care of that automatically.)
169 47 neels
170 105 neels
To increase the likelihood that your first setup will work out, below examples pick distinct MGCP ports and VTY interfaces, which allows running two MGWs on the same public IP address.
171 47 neels
172
h3. OsmoMGW for OsmoMSC
173 1 neels
174 101 neels
OsmoMGW listens for MGCP connections, by default on port 2427.
175
176 1 neels
* 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), which is the default, and your config file may omit the 'bind ip'.
177 9 neels
* With a separate BTS and/or RNC (e.g. 3G femto cell or nanoBTS), make sure to configure an IP address that is reachable by the hNodeB and BTS:
178 1 neels
179 108 neels
*osmo-mgw-for-msc.cfg* (download: attachment:nitb.tar)
180 48 neels
<pre>
181 82 neels
mgcp
182 40 neels
 bind ip 192.168.0.9
183 82 neels
line vty
184
 bind 127.0.0.1
185 1 neels
</pre>
186
187 47 neels
h3. OsmoMGW for OsmoBSC
188 1 neels
189
OsmoBSC also requires an OsmoMGW instance to run alongside it. In a setup where OsmoBSC and OsmoMGW run on the same box, they may in fact share the same OsmoMGW instance, as long as BSC and MSC use different endpoint identifiers.
190
191 47 neels
It is semantically more clear to run a separate OsmoMGW instance for the OsmoBSC, which then needs to not interfere with the other MGW's ports, for example:
192 1 neels
193 108 neels
*osmo-mgw-for-bsc.cfg* (download: attachment:nitb.tar)
194 1 neels
<pre>
195 40 neels
mgcp
196 82 neels
 bind ip 192.168.0.9
197 47 neels
 # default port is 2427 (is used for MSC's MGW)
198
 bind port 12427
199 41 neels
line vty
200 1 neels
 # default VTY interface is on 127.0.0.1 (used for MSC's MGW)
201 41 neels
 bind 127.0.0.2
202 40 neels
</pre>
203
204 105 neels
Note that osmo-bsc.cfg below sets the 'mgw remote-port' to the 'bind port' configured here; if they run on distinct interfaces, the default ports will do in both cases.
205 1 neels
206 9 neels
h2. OsmoSTP
207
208 93 neels
[[OsmoSTP:]] is the Signal Transfer Point: it acts as a server for routing SCCP 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.
209 9 neels
210
The basic configuration that permits dynamic routing is:
211
212 108 neels
*osmo-stp.cfg* (download: attachment:nitb.tar)
213 9 neels
<pre>
214
cs7 instance 0
215
 xua rkm routing-key-allocation dynamic-permitted
216
 listen m3ua 2905
217 11 neels
  accept-asp-connections dynamic-permitted
218
</pre>
219 1 neels
220
h2. OsmoBSC
221 11 neels
222 93 neels
[[OsmoBSC:]] is the 2G Base Station Controller: it manages logical channels and other lower level aspects for one or more 2G BTS. The BSC tells the MSC what the phones would like to do, and in turn the MSC tells the BSC to establish channels, page phones, and take care of the lower level BTS maintenance.
223 67 neels
224 87 neels
OsmoBSC needs to register with OsmoSTP, and contact the MSC by its point code. If not configured otherwise, it will use OsmoMSC's default point code to contact it, see [[Point Codes]].
225 11 neels
226 48 neels
OsmoBSC needs to contact an OsmoMGW to direct RTP streams between BTS and the MSC's MGW, as discussed above under "OsmoMGW".
227 42 neels
228 11 neels
OsmoBSC also needs complete configuration of all connected BTS. This example shows configuration for a sysmoBTS.
229 15 neels
230
Furthermore, some network properties need to be set.
231 1 neels
232 83 neels
The 'gprs mode' determines whether packet switched access will be enabled. 'gprs mode none' switches off data services, it tells osmo-bts not to contact osmo-pcu to establish data service.
233 15 neels
234 83 neels
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 voice-and-data service based on Osmocom style dynamic timeslots:
235 15 neels
236 108 neels
*osmo-bsc.cfg* for voice and data service (download: attachment:nitb.tar)
237 48 neels
<pre>
238 75 neels
network
239
 network country code 901
240 1 neels
 mobile network code 70
241 75 neels
 bts 0
242
  type sysmobts
243
  band GSM-1800
244
  location_area_code 23
245
  ip.access unit_id 1800 0
246
  gprs mode gprs
247 82 neels
  gprs nsvc 0 remote ip 192.168.0.9
248 75 neels
  gprs nsvc 0 remote udp port 23000
249
  gprs nsvc 0 local udp port 23000
250
  gprs nsvc 0 nsvci 1800
251
  gprs nsei 1800
252
  gprs cell bvci 1800
253
  trx 0
254
   rf_locked 0
255
   arfcn 868
256
   nominal power 23
257
   timeslot 0
258
    phys_chan_config CCCH+SDCCH4
259
   timeslot 1
260
    phys_chan_config SDCCH8
261
   timeslot 2
262
    phys_chan_config TCH/F_TCH/H_PDCH
263
   timeslot 3
264 1 neels
    phys_chan_config TCH/F_TCH/H_PDCH
265 75 neels
   timeslot 4
266
    phys_chan_config TCH/F_TCH/H_PDCH
267
   timeslot 5
268
    phys_chan_config TCH/F_TCH/H_PDCH
269
   timeslot 6
270
    phys_chan_config TCH/F_TCH/H_PDCH
271
   timeslot 7
272
    phys_chan_config PDCH
273
e1_input
274 1 neels
 e1_line 0 driver ipa
275 75 neels
msc 0
276 82 neels
 mgw remote-ip 192.168.0.9
277 75 neels
 mgw remote-port 12427
278 1 neels
 allow-emergency deny
279
 codec-list hr3
280
</pre>
281
282
h2. OsmoHNBGW
283
284 93 neels
[[OsmoHNBGW:]] is the 3G HomeNodeB Gateway, found in the osmo-iuh.git repository: it receives the Iuh protocol from a 3G femto cell, separates it into IuCS and IuPS and forwards to the MSC and SGSN.
285 1 neels
286 89 neels
OsmoHNBGW needs to connect to OsmoSTP for routing, and needs to know the MSC and SGSN point codes. If omitted, it assumes OsmoSTP on 127.0.0.1 and uses the point codes that are default in OsmoMSC and OsmoSGSN, see [[Point Codes]].
287 1 neels
288
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.
289
290 108 neels
*osmo-hnbgw.cfg* (download: attachment:nitb.tar)
291 1 neels
<pre>
292 82 neels
hnbgw
293
 iuh
294
  local-ip 192.168.0.9
295 98 neels
  hnbap-allow-tmsi 1
296 82 neels
</pre>
297
298 96 neels
*NOTE:* To connect your femto cell to the HNBGW, see for example [[Configuring_the_ipaccess_nano3G]]
299
300 95 neels
*NOTE:* this minimal config is not yet possible in the "latest" packages, only in the nightly packages (20170-12-29, http://git.osmocom.org/osmo-iuh/commit/?id=2af648f443257284d994ea6d79d9554ed866dfa6 )
301 1 neels
302 98 neels
*NOTE:* The 'hnbap-allow-tmsi' option is just a workaround for the nano3G passing a TMSI as UE-Register identity, which would normally have to be an IMSI.
303 95 neels
304 1 neels
h2. OsmoGGSN
305
306 93 neels
[[OpenGGSN:|OsmoGGSN]] is the Gateway GPRS Support Node: it "opens" GTP tunnels received from SGSNs to internet uplink. To provide packet switched service, OsmoGGSN must offer GTP service to the OsmoSGSN.
307 1 neels
308 82 neels
Notably, both OsmoGGSN and OsmoSGSN must use identical port numbers, which is an intrinsic requirement of the GTP protocol. Hence they must not run on the same IP address. Furthermore, for 2G networks, the SGSN must be reachable by the PCU and thus needs to be on a public interface if the BTS is a separate box; for 3G networks, the GGSN must be reachable by the hNodeB and thus needs to be on a public interface. So, to cover both, you need to have *two* public interfaces; this example uses 192.168.0.42, made available by
309 12 neels
310 82 neels
<pre>
311
sudo ip addr add 192.168.0.42/32 dev eth0
312
</pre>
313
314
This is of course blatantly ignoring the local DHCP server's authority, just a quick hack.
315
316 1 neels
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.
317 13 neels
318 82 neels
It also needs access to a tun device with an address range available to subscribers' PDP contexts. 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 'apn0' device has been created ahead of time, with:
319 13 neels
320 82 neels
<pre>
321
sudo ip tuntap add dev apn0 mode tun user $USER group $USER
322
sudo ip addr add 192.168.42.0/24 dev apn0
323
sudo ip link set apn0 up
324
</pre>
325
326
IPv4 operation is enabled by default, but for future compatibility, it is good to indicate that explicitly.
327
328 76 neels
OsmoGGSN furthermore indicates DNS servers, as well as an IPv4 address range to assign to subscribers' PDP contexts.
329 13 neels
330 85 neels
Note that the APN named in this config file (here "internet") needs to be configured on your phone, see [[Osmocom Network In The Box#APN-for-Data-Service|APN for Data Service]] below. With the @default-apn@ command, any unknown APN name will use that default APN instead, but still you usually have to define _some_ APN on your phone so that it even tries to connect to the data service.
331 13 neels
332 85 neels
A profound part of GGSN configuration is the network setup of your system: you need to allow the packets to be routed between the subscribers and your internet uplink. See the [[Osmocom Manuals|OsmoGGSN User Manual]], section _Running OsmoGGSN_ / _Routing_.
333 84 neels
334 108 neels
*osmo-ggsn.cfg* (download: attachment:nitb.tar)
335 13 neels
NOTE: this configuration requires running osmo-ggsn with root privileges, as well as IP-forwarding and masquerading to be enabled
336
<pre>
337
ggsn ggsn0
338 82 neels
 gtp bind-ip 192.168.0.42
339 76 neels
 apn internet
340 82 neels
  tun-device apn0
341 1 neels
  type-support v4
342
  ip dns 0 192.168.0.1
343 76 neels
  ip dns 1 8.8.8.8
344
  ip prefix dynamic 192.168.42.0/24
345 82 neels
  no shutdown
346
 default-apn internet
347 14 neels
 no shutdown ggsn
348
</pre>
349 67 neels
350
h2. OsmoSGSN
351 14 neels
352 93 neels
[[OsmoSGSN:]] is the Serving GPRS Support Node: it handles signalling, i.e. attach/detach of subscribers and PDP contexts for data services.
353 14 neels
354
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.
355
356
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).
357
358 88 neels
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.
359
360
For 3G IuPS, the SGSN must sign up at OsmoSTP with a point code that the HNBGW knows. If not configured explicitly, the respective defaults are used, see [[Point Codes]].
361 14 neels
362 1 neels
Finally, OsmoSGSN needs access to OsmoHLR to access subscriber data. Set 'auth-policy remote' to use the HLR for subscriber authorization. The default 
363
364 108 neels
*osmo-sgsn.cfg* (download: attachment:nitb.tar)
365 14 neels
<pre>
366 77 neels
sgsn
367 82 neels
 gtp local-ip 192.168.0.9
368
 ggsn 0 remote-ip 192.168.0.42
369 79 neels
 ggsn 0 gtp-version 1
370 14 neels
 auth-policy remote
371 1 neels
 gsup remote-ip 127.0.0.1
372
ns
373
 encapsulation udp local-ip 192.168.0.9
374
 encapsulation udp local-port 23000
375
 encapsulation framerelay-gre enabled 0
376
</pre>
377
378
The @auth-policy remote@ requires that you have the SIM cards' authentication tokens in your OsmoHLR database. Instead, you can use @auth-policy accept-all@, but be aware that this will only work for 2G. 3G networks _require_ successful authentication, and @auth-policy remote@ is your _only_ option for a 3G SGSN.
379 93 neels
380
h1. OsmoBTS
381
382
[[OsmoBTS:]] operates 2G radio hardware. OsmoBTS supports various hardware platforms including sysmoBTS and USRP. Instead, you may choose BTS vendors like ip.access or Siemens, which can also directly operate with OsmoBSC without OsmoBTS being involved.
383
384
The BTS needs to know where to reach OsmoBSC's Abis interface, and its unit id needs to match one of the BTS unit ids configured at OsmoBSC.
385
386
An example configuration for a sysmoBTS is:
387
388
<pre>
389
phy 0
390
 instance 0
391
bts 0
392
 band 1800
393
 ipa unit-id 1800 0
394
 oml remote-ip 192.168.0.9
395
 trx 0
396
  phy 0 instance 0
397
</pre>
398
399
h1. OsmoPCU
400
401
[[OsmoPCU:]] operates the packet-switched part of 2G radio hardware. Timeslots used for data transmission are controlled by the PCU instead of the BTS. OsmoPCU is typically configured from the @gprs@ config items in OsmoBSC, which is communicated to the PCU via OML and OsmoBTS (via the PCU socket). An example configuration for OsmoPCU would be:
402
403
<pre>
404
pcu
405
 flow-control-interval 10
406
 cs 2
407
 alloc-algorithm dynamic
408
 alpha 0
409
 gamma 0
410
 two-phase-access
411
</pre>
412 17 neels
413
h1. Running Examples
414
415
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.
416
417
When installed from debian or opkg feeds, you will find the systemd service files in /lib/systemd/system/.
418
419
Re/starting and stopping then works like this:
420
421
<pre>
422 1 neels
systemctl restart osmo-hlr
423
systemctl stop osmo-hlr
424
</pre>
425 36 neels
426
It can be useful to have an @osmo-all@ script to re/start or stop all components at once, edit to pick yours:
427
428
*osmo-all* script
429
<pre>
430
#!/bin/sh
431
cmd="${1:-start}"
432
set -ex
433
systemctl $cmd osmo-hlr osmo-msc osmo-mgw osmo-ggsn osmo-sgsn osmo-stp osmo-bsc osmo-hnbgw osmo-bts-sysmo osmo-pcu 
434
</pre>
435
436
which allows
437
438
<pre>
439 1 neels
./osmo-all restart
440
./osmo-all status
441 36 neels
./osmo-all stop
442
</pre>
443
444 1 neels
For illustration, the manual command invocations for the components would look like this:
445
446
<pre>
447
osmo-hlr -l hlr.db -c osmo-hlr.cfg
448
osmo-msc -c osmo-msc.cfg
449
osmo-mgw -c osmo-mgw-for-msc.cfg
450
osmo-mgw -c osmo-mgw-for-bsc.cfg
451 48 neels
osmo-ggsn -c osmo-ggsn.cfg
452
osmo-sgsn -c osmo-sgsn.cfg
453 36 neels
osmo-stp -c osmo-stp.cfg
454 1 neels
osmo-bsc -c osmo-bsc.cfg
455
osmo-hnbgw -c osmo-hnbgw.cfg
456
# on a 2G sysmoBTS:
457 36 neels
osmo-bts-sysmo -c osmo-bts.cfg -s -M
458
osmo-pcu -c osmo-pcu.cfg
459
</pre>
460 18 neels
461
h1. Logging Examples
462
463
Osmocom programs have a common logging mechanism, configurable by the config files as well as the telnet VTY.
464
465 82 neels
h2. System Logging
466
467 18 neels
Depending on the system's logging configuration, logs may by default be visible in /var/log/daemon.log, or by using journalctl:
468
469 1 neels
<pre>
470
journalctl -f -u osmo-hlr
471
</pre>
472
473
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'; you may also need to 'systemctl unmask systemd-journald.service systemd-jounald.socket'. Logging will only start appearing for components that were restarted after these changes.
474
475 82 neels
h2. telnet VTY logging
476
477 1 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:
478
479
<pre>
480
$ telnet localhost 4254
481
OsmoMSC> logging enable 
482
OsmoMSC> logging level ?
483
  all      Global setting for all subsystems
484
  rll      A-bis Radio Link Layer (RLL)
485 18 neels
  cc       Layer3 Call Control (CC)
486
  mm       Layer3 Mobility Management (MM)
487
  [...]
488 35 neels
OsmoMSC> logging level all ?
489 19 neels
everything debug      info       notice     error      fatal      
490
OsmoMSC> logging level all debug 
491
OsmoMSC> logging filter all 1
492 1 neels
</pre>
493
494
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.
495
496
h2. stderr logging
497
498
A common configuration you can add to any of the above configuration files to show *all* logging on stderr is:
499
500
<pre>
501
log stderr
502
 logging filter all 1
503
 logging color 1
504
 logging print category 1
505
 logging timestamp 1
506
 logging print extended-timestamp 1
507
 logging level all debug
508
</pre>
509
510
The @filter all 1@ switches on logging, read "do not discard all logging". The amount of logging seen is determined by @logging level ...@ commands, here all categories are set to level @debug@, to show absolutely all logging. You will probably want to refine that.
511 90 neels
512
h1. Point Codes
513
514
If you'd like to configure non-default point-codes, see this example for OsmoHNBGW on the general approach:
515
516
<pre>
517
cs7 instance 0
518
 # HNBGW's local point code
519
 point-code 0.23.5
520
 # Address book entries, used below
521
 sccp-address my_msc
522
  point-code 0.23.1
523
 sccp-address my_sgsn
524
  point-code 0.23.4
525
hnbgw
526
 iucs
527
  remote-addr my_msc
528
 iups
529
  remote-addr my_sgsn
530
</pre>
531 76 neels
532
h1. Troubleshooting
533
534
h2. APN for Data Service
535
536
For the data service to work, phones generally need an APN added to their
537
configuration, or they will not even attempt to establish a data connection.
538
The APN should match the name configured in osmo-ggsn.conf.
539
540
The APN configuration steps are usually similar to:
541
542
* Navigate to APN settings:
543
** 'Settings'
544
** 'Wireless & Networks'
545
** 'Mobile networks'
546
** 'Access Point Names'
547
* You should see the list of APNs (possibly empty)
548
* Press the Menu button
549
* Choose 'New APN'
550
* Enter values for 'Name' as well as 'APN'
551
* Again press the Menu button
552
* Choose 'Save'
553
* The APN should now appear in the list of APNs.
554 1 neels
* Possibly tap the bullet icon to select the APN as default.
555 109 duo_kali
556
</pre>
557
558 110 duo_kali
559 115 duo_kali
 
560
h1. +****HOW TO BUILD OSMOCOM STACK NETWORK IN THE BOX****+
561 109 duo_kali
562 112 duo_kali
#MAKE SURE ALL DEPENDENCY IS COMPLETE!
563
sudo apt install libpcsclite-dev libtalloc-dev libortp-dev libsctp-dev libmnl-dev libdbi-dev libdbd-sqlite3 libsqlite3-dev sqlite3 libc-ares-dev 
564 109 duo_kali
565 114 duo_kali
> 
566 109 duo_kali
mkdir osmobsc
567 1 neels
568 112 duo_kali
cd osmobsc
569 109 duo_kali
git clone git://git.osmocom.org/libosmocore
570
cd libosmocore
571
autoreconf -fi
572
./configure
573
make -j5
574
make check
575
sudo make install
576
sudo ldconfig
577
578
cd osmobsc
579
git clone git://git.osmocom.org/libosmo-abis
580
cd libosmo-abis
581
autoreconf -fi
582
./configure
583
make -j5
584
make check
585
sudo make install
586
sudo ldconfig
587
588
cd osmobsc
589
git clone git://git.osmocom.org/libosmo-netif
590
cd libosmo-netif
591
autoreconf -fi
592
./configure
593
make -j5
594
make check
595
sudo make install
596
sudo ldconfig
597
598
cd osmobsc
599
git clone git://git.osmocom.org/libosmo-sccp
600
cd libosmo-sccp
601
autoreconf -fi
602
./configure
603
make -j5
604
make check
605
sudo make install
606
sudo ldconfig
607
608
cd osmobsc
609
git clone git://git.osmocom.org/libsmpp34
610
cd libsmpp34
611
autoreconf -fi
612
./configure
613
make
614
make check
615
sudo make install
616
sudo ldconfig
617
618
cd osmobsc
619
git clone git://git.osmocom.org/osmo-mgw
620
cd osmo-mgw
621
autoreconf -fi
622
./configure
623
make -j5
624
make check
625
sudo make install
626
sudo ldconfig
627
628
cd osmobsc
629
git clone git://git.osmocom.org/libasn1c
630
cd libasn1c
631
autoreconf -fi
632
./configure
633
make
634
make check
635
sudo make install
636
sudo ldconfig
637
638
cd osmobsc
639
git clone git://git.osmocom.org/osmo-iuh
640
cd osmo-iuh
641
autoreconf -fi
642
./configure
643
make -j5
644
make check
645
sudo make install
646
sudo ldconfig
647
648
cd osmobsc
649
git clone git://git.osmocom.org/osmo-msc
650
cd osmo-msc
651
autoreconf -fi
652
./configure --enable-iu
653
make -j5
654
make check
655
sudo make install
656
sudo ldconfig
657
658
cd osmobsc
659
git clone git://git.osmocom.org/osmo-sgsn
660
cd osmo-sgsn
661
autoreconf -fi
662
./configure --enable-iu
663
make -j5
664
make check
665
sudo make install
666
sudo ldconfig
667
668
cd osmobsc
669
git clone git://git.osmocom.org/osmo-ggsn
670
cd osmo-ggsn
671
autoreconf -fi
672
./configure
673
make -j5
674
make check
675
sudo make install
676
sudo ldconfig
677
678
cd osmobsc
679
git clone git://git.osmocom.org/osmo-bts
680
cd osmo-bts
681
autoreconf -fi
682
./configure --enable-trx
683
make
684
make check
685
sudo make install
686
sudo ldconfig
687
688
cd osmobsc
689
git clone git://git.osmocom.org/osmo-bsc
690
cd osmo-bsc
691
autoreconf -fi
692
./configure 
693
make -j5
694
make check
695
sudo make install
696
sudo ldconfig
697
698
cd osmobsc
699
git clone git://git.osmocom.org/osmo-hlr
700
cd osmo-hlr
701
autoreconf -fi
702
./configure 
703
make -j5
704
make check
705
sudo make install
706
sudo ldconfig
707
708
cd osmobsc
709
git clone git://git.osmocom.org/osmo-stp
710
cd osmo-stp
711
autoreconf -fi
712
./configure 
713
make -j5
714
make check
715
sudo make install
716
sudo ldconfig
717
718
cd osmobsc
719
git clone git://git.osmocom.org/osmo-pcu
720
cd osmo-pcu
721
autoreconf -fi
722
./configure 
723
make -j5
724
make check
725
sudo make install
726
sudo ldconfig
727
728
cd osmobsc
729
git clone git://git.osmocom.org/osmo-sip-connector
730
cd osmo-sip-connector
731
autoreconf -fi
732
./configure
733
make
734
sudo make install 
735
sudo ldconfig
736
737
738
#STARTING 2G NETWORK ONLY (NO GPRS)
739
740
osmo-bsc -c ~/osmobsc/osmo-bsc.cfg
741
osmo-hlr -l hlr.db -c ~/osmobsc/osmo-hlr.cfg
742
osmo-msc -c ~/osmobsc/osmo-msc.cfg -M /tmp/bsc_mncc
743
osmo-stp -c ~/osmobsc/osmo-stp.cfg
744
osmo-mgw -c ~/osmobsc/osmo-mgw.cfg
745
osmo-bts-trx -c ~/osmobsc/osmo-bts.cfg
746
osmo-sip-connector -c ~/osmobsc/osmo-sip-connector.cfg
747 113 duo_kali
748
-----then start your TRX (this one use LimeSDR)
749 109 duo_kali
osmo-trx-uhd -C ~/osmobsc/limesdr.cfg
750
751
(configuration file attached)
Add picture from clipboard (Maximum size: 48.8 MB)