Project

General

Profile

Getting Started with 3G » History » Version 42

neels, 05/15/2017 07:35 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
* osmo-iuh: master
61
* 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
anyone else. (You probably want to use something like 192.168.0.222 instead.)
106
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
* This was run in a 192.168.0.1/24 subnet, yours may vary.
140
* Your femto cell will get itself an IP address from your DHCP server, which
141
  will almost certainly differ from this example. You (so far still) need to
142
  set this address in the mgcp.cfg.
143
* The ggsn.conf 'listen' address here is the additional interface (ala 'ip addr
144
  add' above) and needs to match whichever address you picked there.
145
* Make sure all the other IP addresses in the config files match yours.
146
* Make sure the MCC and MNC match the ones configured in the femto cell.
147
148
*run.sh*:
149
150
* It assumes the Osmocom libs and programs to be installed in /usr/local/*.
151
* It launches each component in a separate X terminal.
152
* It uses rxvt-unicode, you may want to change the @urxvt@ call to your favorite xterm instead.
153
* Make sure the ethernet interface makes sense.
154
* Make sure the IP address makes sense.
155
* Run it in a directory where it will find the various configuration files.
156 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.
157 1 neels
* Once you hit Enter in the original terminal where you started, all the other
158
  terminals will be torn down in one fell swoop (hopefully).
159
160
Now that you've taken notice of the points above, here are the config and
161 36 neels
script: attachment:3G-config-example.tar
162 5 neels
163 1 neels
h1. Femto Config
164
165
With your CN up and running, configure the hNodeB to contact osmo-hnbgw via
166 4 neels
Iuh. Also make sure the PLMN ID matches the MCC and MNC in the osmo-msc.cfg --
167 1 neels
otherwise the hNodeB may reject all attach requests.
168
169
Depending on your femto cell, the steps to configure it will be radically
170
different:
171
172
* [[Configuring the ip.access nano3G]]
173
* ...
174
175
h1. Subscriber Configuration
176
177 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.
178 1 neels
179
Configure your femto cell to authorize your IMSIs, refer to your specific model's configuration documentation.
180 29 neels
181
Once off, the HLR database needs to be created using the file @osmo-hlr/sql/hlr.sql@:
182
183
<pre>
184
sqlite3 hlr.db < osmo-hlr/sql/hlr.sql
185
</pre>
186
187
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.
188 17 neels
189
Update the HLR database to add your IMSIs
190
<pre>
191
$ sqlite3 hlr.db 
192
sqlite> insert into subscriber (imsi, msisdn) values ('901700000099999', '999');
193
sqlite> select id, imsi from subscriber;
194
2342|901700000099999
195 42 neels
sqlite> insert into auc_3g (subscriber_id, algo_id_3g, k, opc) values (2342, 5, '0102030405060708090a0b0c0d0e0f00', 'f0e0d0c0b0a090807060504030201000');
196 17 neels
</pre>
197
The numbers (except '5') are freely chosen and will all differ for you:
198
* 901700000099999: IMSI of your USIM.
199
* 999: MSISDN, i.e. the subscriber's telephone number. Your choice.
200
* 2342: the automatically created subscriber id, probably 1 for you.
201 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
202 17 neels
* '0102030405060708090a0b0c0d0e0f00': KI, you got it with your USIM
203
* 'f0e0d0c0b0a090807060504030201000': OPC, you got it with your USIM
204
* 32: first SQN used for authentication
205
206 1 neels
*NOTE*: *sysmoUSIM-SJS1 will work only from SQN=32 onwards.*
207 17 neels
(see https://osmocom.org/issues/1965#note-13 #1965-13)
208
To set all SQN to >= 32 in your hlr.db:
209 16 neels
<pre>
210
$ sqlite3 hlr.db
211
sqlite3> update auc_3g set sqn = 32 where sqn < 32;
212
</pre>
213
(Also remember to set sqn = 32 for any new subscriber you add to your db.)
214
As soon as we resolved #1968 and #1969, this will work automatically,
215 1 neels
but so far you need to set sqn = 32 manually to get started.
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
h1. Tips and Facts
250
251 34 neels
h2. Analyzing RTP streams in wireshark
252 3 neels
253
IuCS actually uses UP over RTP. See 3GPP TS 25.414, and 25.415 6.6.2.
254
(an interesting insight is https://www.ietf.org/mail-archive/web/avt/current/msg05907.html )
255
256 1 neels
In the wireshark preferences, go to protocol IuUP, enable it and enter the dynamic protocol
257
number that you see in the RTP frames (e.g. 96).
258 5 neels
259 34 neels
h2. Launch GGSN with root priviliges
260 33 neels
261
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:
262
263
<pre>
264
echo "$USER ALL= NOPASSWD:SETENV: /usr/local/bin/ggsn *" > ~/ggsn_sudoers
265
chmod go-w ~/ggsn_sudoers
266
sudo chown root: ~/ggsn_sudoers
267
sudo mv ~/ggsn_sudoers /etc/sudoers.d/
268
</pre>
269
270
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.
271
272 5 neels
h1. Help
273
274
If you experience problems you may ask for assistance on our
275
"mailing list":https://lists.osmocom.org/mailman/listinfo/openbsc.
276
277
------
278
279
fn1. For details on obtaining suitable 3G hardware, you can ask at info@sysmocom.de
280 1 neels
or on our "mailing list":https://lists.osmocom.org/mailman/listinfo/openbsc.
Add picture from clipboard (Maximum size: 48.8 MB)