Project

General

Profile

Getting Started with 3G » History » Version 28

neels, 04/19/2017 10:47 AM

1 1 neels
{{>toc}}
2
3
h1. Getting Started with 3G
4
5 14 neels
_This reflects the state of Osmocom 3G development on 2017-03-04_
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
h1. Core Network
45
46
To get your 3G core network up and running, you need to manually build specific
47 2 neels
branches from various Osmocom projects:
48 1 neels
49
* libosmocore: master
50
* libosmo-abis: master
51 26 neels
* libosmo-netif: master
52 28 neels
* libosmo-sccp: *old-sua* (tag)
53 1 neels
* libsmpp34: master
54 22 neels
* asn1c: *aper-prefix-onto-upstream*
55 1 neels
* libasn1c: master
56
* osmo-iuh: master
57
* openggsn: master
58 25 neels
* openbsc: *vlr_3G*
59 1 neels
* osmo-hlr: master
60
61 11 neels
The git command to get onto a branch other than 'master' is:
62 1 neels
<pre>
63
git checkout the_branch_name
64
</pre>
65
66 14 neels
See [[Build from Source]] on build instructions
67
(remember to pass _--enable-iu_ for openbsc's _./configure_ step).
68 11 neels
69 1 neels
Once the CN stack is built, set up the configuration and launch the core
70
network components. Find further below example configuration files and a run
71
script that may help to get you started. Here are some details explained:
72
73
Tell the osmo-hnbgw which local IP address to use to listen for Iuh
74
connections. This needs to be on an interface reachable by the hNodeB. The IuCS
75 4 neels
and IuPS links towards the osmo-msc and osmo-sgsn default to 127.0.0.1 and
76
127.0.0.2, respectively, i.e. it's easiest to run osmo-msc and osmo-sgsn on
77 1 neels
the same machine as the osmo-hnbgw. These will listen on the proper port
78
(14001) without further configuration.
79
80
Also tell the MGCPGW (osmo-bsc_mgcp) which local IP address to bind to, which
81 4 neels
has to be reachable both by the hNodeB as well as the osmo-msc process. The
82
osmo-msc.cfg is then told where to reach the MGCPGW.
83 1 neels
84
A notable detail for 3G data is that the GGSN has to be reachable by the
85
hNodeB. Since the GTP standard defines fixed port numbers which both SGSN and
86 20 blobb
GGSN have to use, the SGSN may not bind on the same IP address as the GGSN!
87 1 neels
88
Typically this requires to add another IP address to your ethernet interface.
89
On linux this is achieved, for example, by:
90
91
<pre>
92
sudo ip addr add 10.9.1.13/32 dev eth0
93
</pre>
94
95
The above adds the address 10.9.1.13 to eth0, which works e.g. when your
96
machine is in a 10.9.1.0/24 net and the address 10.9.1.13 is not yet taken by
97
anyone else. (You probably want to use something like 192.168.0.222 instead.)
98
99
Also, IP forwarding and masquerading must be enabled for your GGSN to be able
100
to connect to your mobile phones to the internet uplink. On linux, that can be
101
done for eth0 by:
102
103
<pre>
104
sudo sh -c "echo 1 > /proc/sys/net/ipv4/ip_forward"
105
sudo iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
106
</pre>
107
108
You may need a different interface, possibly a wildcard like 'eth*'.
109
110 5 neels
The GGSN needs permissions to create a @tun@ device, which @sudo@ will allow.
111
It may be safer though to allow your user to create tunnels instead of running
112
the GGSN as root.
113
114
If programs complain about missing library @.so@ files, you will probably need
115
to @export LD_LIBRARY_PATH=/usr/local/lib@. With sudo that would be @sudo
116
LD_LIBRARY_PATH=/usr/local/lib ggsn ...@, and you may need to add "SETENV" to
117
your sudoers config -- see the sudo documentation.
118
119 1 neels
Once you have configured the IP addresses, start up your core network: launch
120 4 neels
osmo-msc, osmo-bsc_mgcp, osmo-sgsn, ggsn and osmo-hnbgw. You should see log
121
messages indicating established IuCS and IuPS links (HNBGW, MSC and SGSN).
122 1 neels
123
h2. Core Network Configuration Example
124
125
Here is a specific 3G core network configuration example, including a highly
126
specialized launcher script that configures the network (on a linux system) and
127
runs all the programs needed for a 3G core network -- but be aware:
128
129
*config:*
130
131
* This was run in a 192.168.0.1/24 subnet, yours may vary.
132
* Your femto cell will get itself an IP address from your DHCP server, which
133
  will almost certainly differ from this example. You (so far still) need to
134
  set this address in the mgcp.cfg.
135
* The ggsn.conf 'listen' address here is the additional interface (ala 'ip addr
136
  add' above) and needs to match whichever address you picked there.
137
* Make sure all the other IP addresses in the config files match yours.
138
* Make sure the MCC and MNC match the ones configured in the femto cell.
139
140
*run.sh*:
141
142
* It assumes the Osmocom libs and programs to be installed in /usr/local/*.
143
* It launches each component in a separate X terminal.
144
* It uses rxvt-unicode, you may want to change the @urxvt@ call to your favorite xterm instead.
145
* Make sure the ethernet interface makes sense.
146
* Make sure the IP address makes sense.
147
* Run it in a directory where it will find the various configuration files.
148
* It runs most of the processes in a gdb for easier debugging.
149
* Once you hit Enter in the original terminal where you started, all the other
150
  terminals will be torn down in one fell swoop (hopefully).
151
152
Now that you've taken notice of the points above, here are the config and
153 15 neels
script: attachment:3G-config-example-v3.tar
154 5 neels
155 1 neels
h1. Femto Config
156
157
With your CN up and running, configure the hNodeB to contact osmo-hnbgw via
158 4 neels
Iuh. Also make sure the PLMN ID matches the MCC and MNC in the osmo-msc.cfg --
159 1 neels
otherwise the hNodeB may reject all attach requests.
160
161
Depending on your femto cell, the steps to configure it will be radically
162
different:
163
164
* [[Configuring the ip.access nano3G]]
165
* ...
166
167
h1. Subscriber Configuration
168
169
For your phone loaded with your USIM to be able to subscribe to your network,
170
the IMSI needs to be authorized to enter and the authentication keys need to be
171
added to the HLR.
172
173 19 neels
Configure your femto cell to authorize your IMSIs, refer to your specific model's configuration documentation.
174 17 neels
175
Update the HLR database to add your IMSIs
176
<pre>
177
$ sqlite3 hlr.db 
178
sqlite> insert into subscriber (imsi, msisdn) values ('901700000099999', '999');
179
sqlite> select id, imsi from subscriber;
180
2342|901700000099999
181
sqlite> insert into auc_3g values (2342,5, '0102030405060708090a0b0c0d0e0f00',NULL,'f0e0d0c0b0a090807060504030201000',32);
182
</pre>
183
The numbers (except '5') are freely chosen and will all differ for you:
184
* 901700000099999: IMSI of your USIM.
185
* 999: MSISDN, i.e. the subscriber's telephone number. Your choice.
186
* 2342: the automatically created subscriber id, probably 1 for you.
187 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
188 17 neels
* '0102030405060708090a0b0c0d0e0f00': KI, you got it with your USIM
189
* 'f0e0d0c0b0a090807060504030201000': OPC, you got it with your USIM
190
* 32: first SQN used for authentication
191
192 1 neels
*NOTE*: *sysmoUSIM-SJS1 will work only from SQN=32 onwards.*
193 17 neels
(see https://osmocom.org/issues/1965#note-13 #1965-13)
194
To set all SQN to >= 32 in your hlr.db:
195 16 neels
<pre>
196
$ sqlite3 hlr.db
197
sqlite3> update auc_3g set sqn = 32 where sqn < 32;
198
</pre>
199
(Also remember to set sqn = 32 for any new subscriber you add to your db.)
200
As soon as we resolved #1968 and #1969, this will work automatically,
201 1 neels
but so far you need to set sqn = 32 manually to get started.
202 5 neels
203 1 neels
h1. APN for Data Service
204 6 neels
205 5 neels
For the 3G data service to work, phones generally need an APN added to their
206
configuration, or they will not even attempt to establish a data connection.
207
For the Osmocom 3G CN, any arbitrary APN name will do.
208
209
The APN configuration steps are usually similar to:
210
211
* Navigate to APN settings:
212
** 'Settings'
213
** 'Wireless & Networks'
214
** 'Mobile networks'
215
** 'Access Point Names'
216
* You should see the list of APNs (possibly empty)
217
* Press the Menu button
218
* Choose 'New APN'
219
* Enter values for 'Name' as well as 'APN'
220
** For both, any nonempty value is sufficient, e.g. "test".
221
* Again press the Menu button
222
* Choose 'Save'
223
* The APN should now appear in the list of APNs.
224
* Possibly tap the bullet icon to select the APN as default.
225 1 neels
226
h1. Further Links
227
228
The "3G Voice Works" blog post from 2016 has some explanations:
229
https://osmocom.org/news/59
230 9 neels
231
With almost any question, you can go back to the 3GPP specs. Here is a list of which is for what:
232
* [[GSMStandards]]
233
* and [[Interesting3GPPSpecsForDevelopers]]
234 3 neels
235
h1. Tips and Facts
236
237
h3. Analyzing RTP streams in wireshark
238
239
IuCS actually uses UP over RTP. See 3GPP TS 25.414, and 25.415 6.6.2.
240
(an interesting insight is https://www.ietf.org/mail-archive/web/avt/current/msg05907.html )
241
242 1 neels
In the wireshark preferences, go to protocol IuUP, enable it and enter the dynamic protocol
243
number that you see in the RTP frames (e.g. 96).
244 5 neels
245
h1. Help
246
247
If you experience problems you may ask for assistance on our
248
"mailing list":https://lists.osmocom.org/mailman/listinfo/openbsc.
249
250
------
251
252
fn1. For details on obtaining suitable 3G hardware, you can ask at info@sysmocom.de
253 1 neels
or on our "mailing list":https://lists.osmocom.org/mailman/listinfo/openbsc.
Add picture from clipboard (Maximum size: 48.8 MB)