Getting Started with 3G » History » Version 6
neels, 02/24/2017 03:25 PM
1 | 1 | neels | {{>toc}} |
---|---|---|---|
2 | |||
3 | h1. Getting Started with 3G |
||
4 | |||
5 | 4 | neels | _This reflects the state of Osmocom 3G development on 2017-02-24_ |
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 | * libosmo-netif: sysmocom/sctp |
||
52 | * libosmo-sccp: sysmocom/iu |
||
53 | * libsmpp34: master |
||
54 | * asn1c: aper-prefix-onto-upstream |
||
55 | * libasn1c: master |
||
56 | * osmo-iuh: master |
||
57 | * openggsn: master |
||
58 | * openbsc: sysmocom/iu -- *DISCLAIMER!* This branch is not yet capable of talking to OsmoHLR and thus no true UMTS (3G) Authentication is possible yet; should be coming soon. |
||
59 | * osmo-hlr: master |
||
60 | |||
61 | See [[Build from Source]] on build instructions; the git command to get onto a |
||
62 | branch other than 'master' is: |
||
63 | <pre> |
||
64 | git checkout the_branch_name |
||
65 | </pre> |
||
66 | |||
67 | Once the CN stack is built, set up the configuration and launch the core |
||
68 | network components. Find further below example configuration files and a run |
||
69 | script that may help to get you started. Here are some details explained: |
||
70 | |||
71 | Tell the osmo-hnbgw which local IP address to use to listen for Iuh |
||
72 | connections. This needs to be on an interface reachable by the hNodeB. The IuCS |
||
73 | 4 | neels | and IuPS links towards the osmo-msc and osmo-sgsn default to 127.0.0.1 and |
74 | 127.0.0.2, respectively, i.e. it's easiest to run osmo-msc and osmo-sgsn on |
||
75 | 1 | neels | the same machine as the osmo-hnbgw. These will listen on the proper port |
76 | (14001) without further configuration. |
||
77 | |||
78 | Also tell the MGCPGW (osmo-bsc_mgcp) which local IP address to bind to, which |
||
79 | 4 | neels | has to be reachable both by the hNodeB as well as the osmo-msc process. The |
80 | osmo-msc.cfg is then told where to reach the MGCPGW. |
||
81 | 1 | neels | |
82 | A notable detail for 3G data is that the GGSN has to be reachable by the |
||
83 | hNodeB. Since the GTP standard defines fixed port numbers which both SGSN and |
||
84 | GGSN have to to use, the SGSN may not bind on the same IP address as the GGSN! |
||
85 | |||
86 | Typically this requires to add another IP address to your ethernet interface. |
||
87 | On linux this is achieved, for example, by: |
||
88 | |||
89 | <pre> |
||
90 | sudo ip addr add 10.9.1.13/32 dev eth0 |
||
91 | </pre> |
||
92 | |||
93 | The above adds the address 10.9.1.13 to eth0, which works e.g. when your |
||
94 | machine is in a 10.9.1.0/24 net and the address 10.9.1.13 is not yet taken by |
||
95 | anyone else. (You probably want to use something like 192.168.0.222 instead.) |
||
96 | |||
97 | Also, IP forwarding and masquerading must be enabled for your GGSN to be able |
||
98 | to connect to your mobile phones to the internet uplink. On linux, that can be |
||
99 | done for eth0 by: |
||
100 | |||
101 | <pre> |
||
102 | sudo sh -c "echo 1 > /proc/sys/net/ipv4/ip_forward" |
||
103 | sudo iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE |
||
104 | </pre> |
||
105 | |||
106 | You may need a different interface, possibly a wildcard like 'eth*'. |
||
107 | |||
108 | 5 | neels | The GGSN needs permissions to create a @tun@ device, which @sudo@ will allow. |
109 | It may be safer though to allow your user to create tunnels instead of running |
||
110 | the GGSN as root. |
||
111 | |||
112 | If programs complain about missing library @.so@ files, you will probably need |
||
113 | to @export LD_LIBRARY_PATH=/usr/local/lib@. With sudo that would be @sudo |
||
114 | LD_LIBRARY_PATH=/usr/local/lib ggsn ...@, and you may need to add "SETENV" to |
||
115 | your sudoers config -- see the sudo documentation. |
||
116 | |||
117 | 1 | neels | Once you have configured the IP addresses, start up your core network: launch |
118 | 4 | neels | osmo-msc, osmo-bsc_mgcp, osmo-sgsn, ggsn and osmo-hnbgw. You should see log |
119 | messages indicating established IuCS and IuPS links (HNBGW, MSC and SGSN). |
||
120 | 1 | neels | |
121 | h2. Core Network Configuration Example |
||
122 | |||
123 | Here is a specific 3G core network configuration example, including a highly |
||
124 | specialized launcher script that configures the network (on a linux system) and |
||
125 | runs all the programs needed for a 3G core network -- but be aware: |
||
126 | |||
127 | *config:* |
||
128 | |||
129 | * This was run in a 192.168.0.1/24 subnet, yours may vary. |
||
130 | * Your femto cell will get itself an IP address from your DHCP server, which |
||
131 | will almost certainly differ from this example. You (so far still) need to |
||
132 | set this address in the mgcp.cfg. |
||
133 | * The ggsn.conf 'listen' address here is the additional interface (ala 'ip addr |
||
134 | add' above) and needs to match whichever address you picked there. |
||
135 | * Make sure all the other IP addresses in the config files match yours. |
||
136 | * Make sure the MCC and MNC match the ones configured in the femto cell. |
||
137 | |||
138 | *run.sh*: |
||
139 | |||
140 | * It assumes the Osmocom libs and programs to be installed in /usr/local/*. |
||
141 | * It launches each component in a separate X terminal. |
||
142 | * It uses rxvt-unicode, you may want to change the @urxvt@ call to your favorite xterm instead. |
||
143 | * Make sure the ethernet interface makes sense. |
||
144 | * Make sure the IP address makes sense. |
||
145 | * Run it in a directory where it will find the various configuration files. |
||
146 | * It runs most of the processes in a gdb for easier debugging. |
||
147 | * Once you hit Enter in the original terminal where you started, all the other |
||
148 | terminals will be torn down in one fell swoop (hopefully). |
||
149 | * *TODO* it doesn't launch osmo-hlr *TODO* (add once the 3G branch is rebased onto the VLR branch) |
||
150 | |||
151 | Now that you've taken notice of the points above, here are the config and |
||
152 | script: attachment:3G-config-example.tar |
||
153 | |||
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 | |||
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 | *TODO* currently, the sysmocom/iu branch has a hardcoded Ki of |
||
175 | 000102030405060708090a0b0c0d0e0f, and you need a SIM card that offers only |
||
176 | non-UMTS pre-R99 authentication. We need to rebase the sysmocom/iu branch onto |
||
177 | the VLR development (neels/vlr) in order to enable full UMTS authentication and |
||
178 | so that sysmoUSIMs added to our OsmoHLR work with our 3G stack. |
||
179 | |||
180 | 5 | neels | h1. APN for Data Service |
181 | 1 | neels | |
182 | 6 | neels | For the 3G data service to work, phones generally need an APN added to their |
183 | 5 | neels | configuration, or they will not even attempt to establish a data connection. |
184 | For the Osmocom 3G CN, any arbitrary APN name will do. |
||
185 | |||
186 | The APN configuration steps are usually similar to: |
||
187 | |||
188 | * Navigate to APN settings: |
||
189 | ** 'Settings' |
||
190 | ** 'Wireless & Networks' |
||
191 | ** 'Mobile networks' |
||
192 | ** 'Access Point Names' |
||
193 | * You should see the list of APNs (possibly empty) |
||
194 | * Press the Menu button |
||
195 | * Choose 'New APN' |
||
196 | * Enter values for 'Name' as well as 'APN' |
||
197 | ** For both, any nonempty value is sufficient, e.g. "test". |
||
198 | * Again press the Menu button |
||
199 | * Choose 'Save' |
||
200 | * The APN should now appear in the list of APNs. |
||
201 | * Possibly tap the bullet icon to select the APN as default. |
||
202 | |||
203 | 1 | neels | h1. Further Links |
204 | |||
205 | The "3G Voice Works" blog post from 2016 has some explanations: |
||
206 | https://osmocom.org/news/59 |
||
207 | |||
208 | 5 | neels | |
209 | 3 | neels | h1. Tips and Facts |
210 | |||
211 | h3. Analyzing RTP streams in wireshark |
||
212 | |||
213 | IuCS actually uses UP over RTP. See 3GPP TS 25.414, and 25.415 6.6.2. |
||
214 | (an interesting insight is https://www.ietf.org/mail-archive/web/avt/current/msg05907.html ) |
||
215 | |||
216 | In the wireshark preferences, go to protocol IuUP, enable it and enter the dynamic protocol |
||
217 | 1 | neels | number that you see in the RTP frames (e.g. 96). |
218 | 5 | neels | |
219 | |||
220 | h1. Help |
||
221 | |||
222 | If you experience problems you may ask for assistance on our |
||
223 | "mailing list":https://lists.osmocom.org/mailman/listinfo/openbsc. |
||
224 | |||
225 | ------ |
||
226 | |||
227 | fn1. For details on obtaining suitable 3G hardware, you can ask at info@sysmocom.de |
||
228 | or on our "mailing list":https://lists.osmocom.org/mailman/listinfo/openbsc. |