Project

General

Profile

Getting Started with 3G » History » Version 38

neels, 05/15/2017 07:11 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 38 neels
The attachment:3G-config-example.tar contains a script to clone and build -- refer to the enclosed README.txt.
50 31 neels
51
In detail, this is what needs to be built:
52
53 1 neels
* libosmocore: master
54 26 neels
* libosmo-abis: master
55 30 theresa
* libosmo-netif: master
56 1 neels
* libosmo-sccp: *old_sua* (tag)
57 22 neels
* libsmpp34: master
58 1 neels
* libasn1c: master
59
* osmo-iuh: master
60
* openggsn: master
61
* openbsc: *vlr_3G*
62
* osmo-hlr: master
63 25 neels
64 31 neels
(In the unlikely case the asn.1 definitions changed, you also need asn1c, branch aper-prefix-onto-upstream)
65
66 11 neels
The git command to get onto a branch other than 'master' is:
67 1 neels
<pre>
68
git checkout the_branch_name
69
</pre>
70
71
See [[Build from Source]] on build instructions
72
(remember to pass _--enable-iu_ for openbsc's _./configure_ step).
73 31 neels
74
h1. Configure Core Network
75 11 neels
76 1 neels
Once the CN stack is built, set up the configuration and launch the core
77
network components. Find further below example configuration files and a run
78
script that may help to get you started. Here are some details explained:
79
80
Tell the osmo-hnbgw which local IP address to use to listen for Iuh
81
connections. This needs to be on an interface reachable by the hNodeB. The IuCS
82 4 neels
and IuPS links towards the osmo-msc and osmo-sgsn default to 127.0.0.1 and
83
127.0.0.2, respectively, i.e. it's easiest to run osmo-msc and osmo-sgsn on
84 1 neels
the same machine as the osmo-hnbgw. These will listen on the proper port
85
(14001) without further configuration.
86
87
Also tell the MGCPGW (osmo-bsc_mgcp) which local IP address to bind to, which
88 4 neels
has to be reachable both by the hNodeB as well as the osmo-msc process. The
89
osmo-msc.cfg is then told where to reach the MGCPGW.
90 1 neels
91
A notable detail for 3G data is that the GGSN has to be reachable by the
92
hNodeB. Since the GTP standard defines fixed port numbers which both SGSN and
93 20 blobb
GGSN have to use, the SGSN may not bind on the same IP address as the GGSN!
94 1 neels
95
Typically this requires to add another IP address to your ethernet interface.
96
On linux this is achieved, for example, by:
97
98
<pre>
99
sudo ip addr add 10.9.1.13/32 dev eth0
100
</pre>
101
102
The above adds the address 10.9.1.13 to eth0, which works e.g. when your
103
machine is in a 10.9.1.0/24 net and the address 10.9.1.13 is not yet taken by
104
anyone else. (You probably want to use something like 192.168.0.222 instead.)
105
106
Also, IP forwarding and masquerading must be enabled for your GGSN to be able
107
to connect to your mobile phones to the internet uplink. On linux, that can be
108
done for eth0 by:
109
110
<pre>
111
sudo sh -c "echo 1 > /proc/sys/net/ipv4/ip_forward"
112
sudo iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
113
</pre>
114
115
You may need a different interface, possibly a wildcard like 'eth*'.
116
117 5 neels
The GGSN needs permissions to create a @tun@ device, which @sudo@ will allow.
118
It may be safer though to allow your user to create tunnels instead of running
119
the GGSN as root.
120
121
If programs complain about missing library @.so@ files, you will probably need
122
to @export LD_LIBRARY_PATH=/usr/local/lib@. With sudo that would be @sudo
123
LD_LIBRARY_PATH=/usr/local/lib ggsn ...@, and you may need to add "SETENV" to
124
your sudoers config -- see the sudo documentation.
125
126 1 neels
Once you have configured the IP addresses, start up your core network: launch
127 4 neels
osmo-msc, osmo-bsc_mgcp, osmo-sgsn, ggsn and osmo-hnbgw. You should see log
128
messages indicating established IuCS and IuPS links (HNBGW, MSC and SGSN).
129 1 neels
130
h2. Core Network Configuration Example
131
132
Here is a specific 3G core network configuration example, including a highly
133
specialized launcher script that configures the network (on a linux system) and
134
runs all the programs needed for a 3G core network -- but be aware:
135
136
*config:*
137
138
* This was run in a 192.168.0.1/24 subnet, yours may vary.
139
* Your femto cell will get itself an IP address from your DHCP server, which
140
  will almost certainly differ from this example. You (so far still) need to
141
  set this address in the mgcp.cfg.
142
* The ggsn.conf 'listen' address here is the additional interface (ala 'ip addr
143
  add' above) and needs to match whichever address you picked there.
144
* Make sure all the other IP addresses in the config files match yours.
145
* Make sure the MCC and MNC match the ones configured in the femto cell.
146
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
sqlite> insert into auc_3g values (2342,5, '0102030405060708090a0b0c0d0e0f00',NULL,'f0e0d0c0b0a090807060504030201000',32);
195
</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
* 32: first SQN used for authentication
204
205 1 neels
*NOTE*: *sysmoUSIM-SJS1 will work only from SQN=32 onwards.*
206 17 neels
(see https://osmocom.org/issues/1965#note-13 #1965-13)
207
To set all SQN to >= 32 in your hlr.db:
208 16 neels
<pre>
209
$ sqlite3 hlr.db
210
sqlite3> update auc_3g set sqn = 32 where sqn < 32;
211
</pre>
212
(Also remember to set sqn = 32 for any new subscriber you add to your db.)
213
As soon as we resolved #1968 and #1969, this will work automatically,
214 1 neels
but so far you need to set sqn = 32 manually to get started.
215 5 neels
216 1 neels
h1. APN for Data Service
217 6 neels
218 5 neels
For the 3G data service to work, phones generally need an APN added to their
219
configuration, or they will not even attempt to establish a data connection.
220
For the Osmocom 3G CN, any arbitrary APN name will do.
221
222
The APN configuration steps are usually similar to:
223
224
* Navigate to APN settings:
225
** 'Settings'
226
** 'Wireless & Networks'
227
** 'Mobile networks'
228
** 'Access Point Names'
229
* You should see the list of APNs (possibly empty)
230
* Press the Menu button
231
* Choose 'New APN'
232
* Enter values for 'Name' as well as 'APN'
233
** For both, any nonempty value is sufficient, e.g. "test".
234
* Again press the Menu button
235
* Choose 'Save'
236
* The APN should now appear in the list of APNs.
237
* Possibly tap the bullet icon to select the APN as default.
238 1 neels
239
h1. Further Links
240
241
The "3G Voice Works" blog post from 2016 has some explanations:
242
https://osmocom.org/news/59
243 9 neels
244
With almost any question, you can go back to the 3GPP specs. Here is a list of which is for what:
245
* [[GSMStandards]]
246
* and [[Interesting3GPPSpecsForDevelopers]]
247 3 neels
248
h1. Tips and Facts
249
250 34 neels
h2. Analyzing RTP streams in wireshark
251 3 neels
252
IuCS actually uses UP over RTP. See 3GPP TS 25.414, and 25.415 6.6.2.
253
(an interesting insight is https://www.ietf.org/mail-archive/web/avt/current/msg05907.html )
254
255 1 neels
In the wireshark preferences, go to protocol IuUP, enable it and enter the dynamic protocol
256
number that you see in the RTP frames (e.g. 96).
257 5 neels
258 34 neels
h2. Launch GGSN with root priviliges
259 33 neels
260
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:
261
262
<pre>
263
echo "$USER ALL= NOPASSWD:SETENV: /usr/local/bin/ggsn *" > ~/ggsn_sudoers
264
chmod go-w ~/ggsn_sudoers
265
sudo chown root: ~/ggsn_sudoers
266
sudo mv ~/ggsn_sudoers /etc/sudoers.d/
267
</pre>
268
269
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.
270
271 5 neels
h1. Help
272
273
If you experience problems you may ask for assistance on our
274
"mailing list":https://lists.osmocom.org/mailman/listinfo/openbsc.
275
276
------
277
278
fn1. For details on obtaining suitable 3G hardware, you can ask at info@sysmocom.de
279 1 neels
or on our "mailing list":https://lists.osmocom.org/mailman/listinfo/openbsc.
Add picture from clipboard (Maximum size: 48.8 MB)