Project

General

Profile

Getting Started with 3G » History » Version 48

neels, 07/26/2017 01:39 PM

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