Project

General

Profile

Getting Started with 3G » History » Version 22

neels, 03/16/2017 07:13 PM

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 22 neels
* libosmo-netif: *sysmocom/sctp*
52
* libosmo-sccp: *sysmocom/iu*
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 22 neels
* openbsc: *vlr_3G* -- *Be aware that this branch may still be rebased frequently until things have settled.*
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
* *TODO* it doesn't launch osmo-hlr *TODO* (add once the 3G branch is rebased onto the VLR branch)
152
153
Now that you've taken notice of the points above, here are the config and
154 15 neels
script: attachment:3G-config-example-v3.tar
155 5 neels
156 1 neels
h1. Femto Config
157
158
With your CN up and running, configure the hNodeB to contact osmo-hnbgw via
159 4 neels
Iuh. Also make sure the PLMN ID matches the MCC and MNC in the osmo-msc.cfg --
160 1 neels
otherwise the hNodeB may reject all attach requests.
161
162
Depending on your femto cell, the steps to configure it will be radically
163
different:
164
165
* [[Configuring the ip.access nano3G]]
166
* ...
167
168
h1. Subscriber Configuration
169
170
For your phone loaded with your USIM to be able to subscribe to your network,
171
the IMSI needs to be authorized to enter and the authentication keys need to be
172
added to the HLR.
173
174 19 neels
Configure your femto cell to authorize your IMSIs, refer to your specific model's configuration documentation.
175 17 neels
176
Update the HLR database to add your IMSIs
177
<pre>
178
$ sqlite3 hlr.db 
179
sqlite> insert into subscriber (imsi, msisdn) values ('901700000099999', '999');
180
sqlite> select id, imsi from subscriber;
181
2342|901700000099999
182
sqlite> insert into auc_3g values (2342,5, '0102030405060708090a0b0c0d0e0f00',NULL,'f0e0d0c0b0a090807060504030201000',32);
183
</pre>
184
The numbers (except '5') are freely chosen and will all differ for you:
185
* 901700000099999: IMSI of your USIM.
186
* 999: MSISDN, i.e. the subscriber's telephone number. Your choice.
187
* 2342: the automatically created subscriber id, probably 1 for you.
188 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
189 17 neels
* '0102030405060708090a0b0c0d0e0f00': KI, you got it with your USIM
190
* 'f0e0d0c0b0a090807060504030201000': OPC, you got it with your USIM
191
* 32: first SQN used for authentication
192
193 1 neels
*NOTE*: *sysmoUSIM-SJS1 will work only from SQN=32 onwards.*
194 17 neels
(see https://osmocom.org/issues/1965#note-13 #1965-13)
195
To set all SQN to >= 32 in your hlr.db:
196 16 neels
<pre>
197
$ sqlite3 hlr.db
198
sqlite3> update auc_3g set sqn = 32 where sqn < 32;
199
</pre>
200
(Also remember to set sqn = 32 for any new subscriber you add to your db.)
201
As soon as we resolved #1968 and #1969, this will work automatically,
202 1 neels
but so far you need to set sqn = 32 manually to get started.
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
h1. Tips and Facts
237
238
h3. Analyzing RTP streams in wireshark
239
240
IuCS actually uses UP over RTP. See 3GPP TS 25.414, and 25.415 6.6.2.
241
(an interesting insight is https://www.ietf.org/mail-archive/web/avt/current/msg05907.html )
242
243 1 neels
In the wireshark preferences, go to protocol IuUP, enable it and enter the dynamic protocol
244
number that you see in the RTP frames (e.g. 96).
245 5 neels
246
h1. Help
247
248
If you experience problems you may ask for assistance on our
249
"mailing list":https://lists.osmocom.org/mailman/listinfo/openbsc.
250
251
------
252
253
fn1. For details on obtaining suitable 3G hardware, you can ask at info@sysmocom.de
254 1 neels
or on our "mailing list":https://lists.osmocom.org/mailman/listinfo/openbsc.
Add picture from clipboard (Maximum size: 48.8 MB)