Project

General

Profile

Getting Started with 3G » History » Version 50

neels, 11/12/2017 11:11 PM

1 1 neels
{{>toc}}
2
3 49 neels
h1. OUTDATED
4
5
*======================================*
6
7
*NOTE: we have split openbsc.git in smaller parts: osmo-{msc,mgw,sgsn,bsc}, and we have full 3G support in the master branches of those new repositories.*
8
9
*This wiki page still refers to an earlier development branch in the old openbsc.git. The main difference is that now 3G uses true M3UA, and you need to operate an OsmoSTP, as seen on the [[Osmocom Network In The Box]] wiki page.*
10
11
*======================================*
12
13
This wiki page shall soon be updated or merged with [[Osmocom Network In The Box]]
14
15 1 neels
h1. Getting Started with 3G
16
17 37 neels
_This reflects the state of Osmocom 3G development on 2017-05-14_
18 49 neels
19 1 neels
20 5 neels
If you have your 3G femto cell[1], this is how to get started:
21 1 neels
22
The physical setup is:
23
24
<pre>
25
  _____________              _____________
26
  |           |              |           |
27
  | femto     |<--Ethernet-->| Laptop/PC |
28
  |___________|              |___________|
29
30
</pre>
31
32
On the protocol layer, the femto cell is the hNodeB and talks to various core
33
network elements over the ethernet cable, typically all located on your
34
computer, and talks to the phone (UE) over the air:
35
36
<pre>
37
                                 +--------+
38
                             ,-->| Osmo   |
39
                            /    | MGCPGW |
40
                            |    |        |<--MGCP
41
                            |    +--------+       \
42
                            /                     |
43
        +------------+<--RTP     +--------+       `->+----------+
44 4 neels
 UE <-->| hNodeB     |           | Osmo   |          | OsmoMSC  |        +------+
45 1 neels
 UE <-->|            |<--Iuh---->| HNB-GW |<--IuCS-->|          |        | Osmo |
46
        |            |           |        |          |     (VLR)|<-GSUP->| HLR  |
47
        |            |           |        |          +----------+  GSUP->+------+
48
        +------------+<--GTP-U   |        |                       /
49
                              \  |        |          +------+<---'       +------+
50
                              |  |        |<--IuPS-->| Osmo |<--GTP-C--->| Open |
51
                              |  +--------+          | SGSN |   GTP-U--->| GGSN |
52
                              |                      +------+  /         +------+
53
                              \_______________________________/
54
55
</pre>
56
57 31 neels
h1. Build Core Network Programs
58 1 neels
59
To get your 3G core network up and running, you need to manually build specific
60 31 neels
branches from various Osmocom projects.
61 1 neels
62 41 neels
The attachment:3G-config-example.tar contains a script to clone and build -- refer to the README.txt
63
enclosed in the tar.
64 31 neels
65
In detail, this is what needs to be built:
66
67 1 neels
* libosmocore: master
68 26 neels
* libosmo-abis: master
69 30 theresa
* libosmo-netif: master
70 1 neels
* libosmo-sccp: *old_sua* (tag)
71 22 neels
* libsmpp34: master
72 1 neels
* libasn1c: master
73 46 neels
* osmo-iuh: *old_sua* (tag)
74 1 neels
* openggsn: master
75
* openbsc: *vlr_3G*
76
* osmo-hlr: master
77 25 neels
78 31 neels
(In the unlikely case the asn.1 definitions changed, you also need asn1c, branch aper-prefix-onto-upstream)
79
80 11 neels
The git command to get onto a branch other than 'master' is:
81 1 neels
<pre>
82
git checkout the_branch_name
83
</pre>
84
85
See [[Build from Source]] on build instructions
86
(remember to pass _--enable-iu_ for openbsc's _./configure_ step).
87 31 neels
88
h1. Configure Core Network
89 11 neels
90 1 neels
Once the CN stack is built, set up the configuration and launch the core
91
network components. Find further below example configuration files and a run
92
script that may help to get you started. Here are some details explained:
93
94
Tell the osmo-hnbgw which local IP address to use to listen for Iuh
95
connections. This needs to be on an interface reachable by the hNodeB. The IuCS
96 4 neels
and IuPS links towards the osmo-msc and osmo-sgsn default to 127.0.0.1 and
97
127.0.0.2, respectively, i.e. it's easiest to run osmo-msc and osmo-sgsn on
98 1 neels
the same machine as the osmo-hnbgw. These will listen on the proper port
99
(14001) without further configuration.
100
101
Also tell the MGCPGW (osmo-bsc_mgcp) which local IP address to bind to, which
102 4 neels
has to be reachable both by the hNodeB as well as the osmo-msc process. The
103
osmo-msc.cfg is then told where to reach the MGCPGW.
104 1 neels
105
A notable detail for 3G data is that the GGSN has to be reachable by the
106
hNodeB. Since the GTP standard defines fixed port numbers which both SGSN and
107 20 blobb
GGSN have to use, the SGSN may not bind on the same IP address as the GGSN!
108 1 neels
109
Typically this requires to add another IP address to your ethernet interface.
110
On linux this is achieved, for example, by:
111
112
<pre>
113
sudo ip addr add 10.9.1.13/32 dev eth0
114
</pre>
115
116
The above adds the address 10.9.1.13 to eth0, which works e.g. when your
117
machine is in a 10.9.1.0/24 net and the address 10.9.1.13 is not yet taken by
118 48 neels
anyone else.
119 1 neels
120
Also, IP forwarding and masquerading must be enabled for your GGSN to be able
121
to connect to your mobile phones to the internet uplink. On linux, that can be
122
done for eth0 by:
123
124
<pre>
125
sudo sh -c "echo 1 > /proc/sys/net/ipv4/ip_forward"
126
sudo iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
127
</pre>
128
129
You may need a different interface, possibly a wildcard like 'eth*'.
130
131 5 neels
The GGSN needs permissions to create a @tun@ device, which @sudo@ will allow.
132
It may be safer though to allow your user to create tunnels instead of running
133
the GGSN as root.
134
135
If programs complain about missing library @.so@ files, you will probably need
136
to @export LD_LIBRARY_PATH=/usr/local/lib@. With sudo that would be @sudo
137
LD_LIBRARY_PATH=/usr/local/lib ggsn ...@, and you may need to add "SETENV" to
138
your sudoers config -- see the sudo documentation.
139
140 1 neels
Once you have configured the IP addresses, start up your core network: launch
141 4 neels
osmo-msc, osmo-bsc_mgcp, osmo-sgsn, ggsn and osmo-hnbgw. You should see log
142
messages indicating established IuCS and IuPS links (HNBGW, MSC and SGSN).
143 1 neels
144
h2. Core Network Configuration Example
145
146
Here is a specific 3G core network configuration example, including a highly
147
specialized launcher script that configures the network (on a linux system) and
148
runs all the programs needed for a 3G core network -- but be aware:
149
150
*config:*
151
152 47 neels
* Make sure all IP addresses in the config files match your actual ones.
153
* The ggsn.conf 'listen' address is the additional interface (ala 'ip addr
154 1 neels
  add' above) and needs to match whichever address you picked there.
155
* Make sure the MCC and MNC match the ones configured in the femto cell.
156 47 neels
* The current mgcp.cfg allows any base station to take up a call's RTP stream.
157
  To limit to your specific femto cell address, set it as 'bts ip' in the mgcp.cfg.
158
* See also the README.txt enclosed in the tar.
159 1 neels
160
*run.sh*:
161
162
* It assumes the Osmocom libs and programs to be installed in /usr/local/*.
163
* It launches each component in a separate X terminal.
164
* It uses rxvt-unicode, you may want to change the @urxvt@ call to your favorite xterm instead.
165
* Make sure the ethernet interface makes sense.
166
* Make sure the IP address makes sense.
167
* Run it in a directory where it will find the various configuration files.
168 32 neels
* The GGSN needs to run with root privileges to be able to create a tun device for data services. The startup will ask you for your password because it is launched by sudo. See also "Tips" below to make this non-interactive.
169 1 neels
* Once you hit Enter in the original terminal where you started, all the other
170
  terminals will be torn down in one fell swoop (hopefully).
171
172
Now that you've taken notice of the points above, here are the config and
173 36 neels
script: attachment:3G-config-example.tar
174 5 neels
175 1 neels
h1. Femto Config
176
177
With your CN up and running, configure the hNodeB to contact osmo-hnbgw via
178 4 neels
Iuh. Also make sure the PLMN ID matches the MCC and MNC in the osmo-msc.cfg --
179 1 neels
otherwise the hNodeB may reject all attach requests.
180
181
Depending on your femto cell, the steps to configure it will be radically
182
different:
183
184
* [[Configuring the ip.access nano3G]]
185
* ...
186
187
h1. Subscriber Configuration
188
189 29 neels
For your phone loaded with your USIM to be able to subscribe to your network, the IMSI needs to be authorized to enter and the authentication keys need to be added to the HLR.
190 1 neels
191
Configure your femto cell to authorize your IMSIs, refer to your specific model's configuration documentation.
192 29 neels
193
Once off, the HLR database needs to be created using the file @osmo-hlr/sql/hlr.sql@:
194
195
<pre>
196
sqlite3 hlr.db < osmo-hlr/sql/hlr.sql
197
</pre>
198
199
This hlr.db needs to be found by the osmo-hlr binary -- either place it in the current working directory when launching osmo-hlr, or use the @osmo-hlr -l my/hlr.db@ commandline option to pass a specific path.
200 17 neels
201
Update the HLR database to add your IMSIs
202
<pre>
203
$ sqlite3 hlr.db 
204
sqlite> insert into subscriber (imsi, msisdn) values ('901700000099999', '999');
205
sqlite> select id, imsi from subscriber;
206
2342|901700000099999
207 42 neels
sqlite> insert into auc_3g (subscriber_id, algo_id_3g, k, opc) values (2342, 5, '0102030405060708090a0b0c0d0e0f00', 'f0e0d0c0b0a090807060504030201000');
208 17 neels
</pre>
209
The numbers (except '5') are freely chosen and will all differ for you:
210
* 901700000099999: IMSI of your USIM.
211
* 999: MSISDN, i.e. the subscriber's telephone number. Your choice.
212
* 2342: the automatically created subscriber id, probably 1 for you.
213 18 neels
* 5: use Milenage. see enum osmo_auth_algo in "libosmocore's crypt/auth.h":http://git.osmocom.org/libosmocore/tree/include/osmocom/crypt/auth.h
214 17 neels
* '0102030405060708090a0b0c0d0e0f00': KI, you got it with your USIM
215
* 'f0e0d0c0b0a090807060504030201000': OPC, you got it with your USIM
216 5 neels
217 1 neels
h1. APN for Data Service
218 6 neels
219 5 neels
For the 3G data service to work, phones generally need an APN added to their
220
configuration, or they will not even attempt to establish a data connection.
221
For the Osmocom 3G CN, any arbitrary APN name will do.
222
223
The APN configuration steps are usually similar to:
224
225
* Navigate to APN settings:
226
** 'Settings'
227
** 'Wireless & Networks'
228
** 'Mobile networks'
229
** 'Access Point Names'
230
* You should see the list of APNs (possibly empty)
231
* Press the Menu button
232
* Choose 'New APN'
233
* Enter values for 'Name' as well as 'APN'
234
** For both, any nonempty value is sufficient, e.g. "test".
235
* Again press the Menu button
236
* Choose 'Save'
237
* The APN should now appear in the list of APNs.
238
* Possibly tap the bullet icon to select the APN as default.
239 1 neels
240
h1. Further Links
241
242
The "3G Voice Works" blog post from 2016 has some explanations:
243
https://osmocom.org/news/59
244 9 neels
245
With almost any question, you can go back to the 3GPP specs. Here is a list of which is for what:
246
* [[GSMStandards]]
247
* and [[Interesting3GPPSpecsForDevelopers]]
248 3 neels
249 44 neels
h1. Troubleshooting
250
251
h2. My phone doesn't register / the MSC sees no messages
252
253
Make sure that you start the OsmoHNBGW only *after* the MSC and SGSN have started up and are ready.
254
255
Best stop all programs, then first launch in this order:
256
257
* osmo-hlr, osmo-bsc_mgcp
258
* osmo-msc, osmo-sgsn -- give it time to listen for IuCS/IuPS
259
* osmo-hnbgw
260
261
#2264
262
263
h2. My phone is rejected
264
265
* is your hNodeB cell configured for open access or to allow this IMSI?
266
* do the MCC+MNC configured in the hNodeB match osmo-msc.cfg's "network country code" and "mobile network code"?
267
* did you enter the subscriber in the HLR database?
268
** does the subscriber have an auc_3g entry?
269
** if you got an OPC value for your USIM, is this key entered in the OPC column (vs. the OP column which would not work then)? Or vice versa, did you put the OP key in the OPC column?
270
** make sure only one of OP or OPC are entered.
271
272
h2. I have no phone number
273
274
If dialling '*#100#' returns a message lacking a phone number ("Your extension is "), then add an MSISDN in the hlr.db's subscriber table.
275
276
h2. Voice calls don't go through
277
278
Does the MGCP gateway (aka osmo-bsc_mgcp) have your hNodeB's IP address configured as "mgcp" / "bts ip"?
279
#2262
280
281
h2. Phone is registered, but is usually not receiving any SMS / voice calls
282
283
In open access mode, it seems the nano3G sometimes fails to page a phone -- it looks like it didn't store the subscriber's IMSI. Try to register the phone that should receive a call to a different network (being rejected suffices, just to get the TMSI out of the phone's state) and then re-register to the hNodeB.
284
285 45 neels
h2. Data service is not working
286
287 50 neels
Did you setup an APN on your phone?
288
289 45 neels
Try to go to flight mode and back online...
290
#1977
291
292 3 neels
h1. Tips and Facts
293
294 34 neels
h2. Analyzing RTP streams in wireshark
295 3 neels
296
IuCS actually uses UP over RTP. See 3GPP TS 25.414, and 25.415 6.6.2.
297
(an interesting insight is https://www.ietf.org/mail-archive/web/avt/current/msg05907.html )
298
299 1 neels
In the wireshark preferences, go to protocol IuUP, enable it and enter the dynamic protocol
300
number that you see in the RTP frames (e.g. 96).
301 5 neels
302 34 neels
h2. Launch GGSN with root priviliges
303 33 neels
304
The GGSN needs to run with root privileges. This means you need to type your password when starting it for sudo to work. But sudo also allows you to put rules in place to make this password-less:
305
306
<pre>
307
echo "$USER ALL= NOPASSWD:SETENV: /usr/local/bin/ggsn *" > ~/ggsn_sudoers
308
chmod go-w ~/ggsn_sudoers
309
sudo chown root: ~/ggsn_sudoers
310
sudo mv ~/ggsn_sudoers /etc/sudoers.d/
311
</pre>
312
313
This places a NOPASSWD rule in /etc/sudoers.d which should allow you to start the GGSN without issuing a password when invoked via sudo.
314
315 5 neels
h1. Help
316
317
If you experience problems you may ask for assistance on our
318
"mailing list":https://lists.osmocom.org/mailman/listinfo/openbsc.
319
320
------
321
322
fn1. For details on obtaining suitable 3G hardware, you can ask at info@sysmocom.de
323 1 neels
or on our "mailing list":https://lists.osmocom.org/mailman/listinfo/openbsc.
Add picture from clipboard (Maximum size: 48.8 MB)