Project

General

Profile

Getting Started with 3G » History » Revision 28

Revision 27 (daniel, 04/11/2017 09:47 AM) → Revision 28/52 (neels, 04/19/2017 10:47 AM)

{{>toc}} 

 h1. Getting Started with 3G 

 _This reflects the state of Osmocom 3G development on 2017-03-04_ 

 If you have your 3G femto cell[1], this is how to get started: 

 The physical setup is: 

 <pre> 
   _____________                _____________ 
   |             |                |             | 
   | femto       |<--Ethernet-->| Laptop/PC | 
   |___________|                |___________| 

 </pre> 

 On the protocol layer, the femto cell is the hNodeB and talks to various core 
 network elements over the ethernet cable, typically all located on your 
 computer, and talks to the phone (UE) over the air: 

 <pre> 
                                  +--------+ 
                              ,-->| Osmo     | 
                             /      | MGCPGW | 
                             |      |          |<--MGCP 
                             |      +--------+         \ 
                             /                       | 
         +------------+<--RTP       +--------+         `->+----------+ 
  UE <-->| hNodeB       |             | Osmo     |            | OsmoMSC    |          +------+ 
  UE <-->|              |<--Iuh---->| HNB-GW |<--IuCS-->|            |          | Osmo | 
         |              |             |          |            |       (VLR)|<-GSUP->| HLR    | 
         |              |             |          |            +----------+    GSUP->+------+ 
         +------------+<--GTP-U     |          |                         / 
                               \    |          |            +------+<---'         +------+ 
                               |    |          |<--IuPS-->| Osmo |<--GTP-C--->| Open | 
                               |    +--------+            | SGSN |     GTP-U--->| GGSN | 
                               |                        +------+    /           +------+ 
                               \_______________________________/ 

 </pre> 

 h1. Core Network 

 To get your 3G core network up and running, you need to manually build specific 
 branches from various Osmocom projects: 

 * libosmocore: master 
 * libosmo-abis: master 
 * libosmo-netif: master 
 * libosmo-sccp: *old-sua* old-sua (tag) 
 * libsmpp34: master 
 * asn1c: *aper-prefix-onto-upstream* 
 * libasn1c: master 
 * osmo-iuh: master 
 * openggsn: master 
 * openbsc: *vlr_3G* 
 * osmo-hlr: master 

 The git command to get onto a branch other than 'master' is: 
 <pre> 
 git checkout the_branch_name 
 </pre> 

 See [[Build from Source]] on build instructions 
 (remember to pass _--enable-iu_ for openbsc's _./configure_ step). 

 Once the CN stack is built, set up the configuration and launch the core 
 network components. Find further below example configuration files and a run 
 script that may help to get you started. Here are some details explained: 

 Tell the osmo-hnbgw which local IP address to use to listen for Iuh 
 connections. This needs to be on an interface reachable by the hNodeB. The IuCS 
 and IuPS links towards the osmo-msc and osmo-sgsn default to 127.0.0.1 and 
 127.0.0.2, respectively, i.e. it's easiest to run osmo-msc and osmo-sgsn on 
 the same machine as the osmo-hnbgw. These will listen on the proper port 
 (14001) without further configuration. 

 Also tell the MGCPGW (osmo-bsc_mgcp) which local IP address to bind to, which 
 has to be reachable both by the hNodeB as well as the osmo-msc process. The 
 osmo-msc.cfg is then told where to reach the MGCPGW. 

 A notable detail for 3G data is that the GGSN has to be reachable by the 
 hNodeB. Since the GTP standard defines fixed port numbers which both SGSN and 
 GGSN have to use, the SGSN may not bind on the same IP address as the GGSN! 

 Typically this requires to add another IP address to your ethernet interface. 
 On linux this is achieved, for example, by: 

 <pre> 
 sudo ip addr add 10.9.1.13/32 dev eth0 
 </pre> 

 The above adds the address 10.9.1.13 to eth0, which works e.g. when your 
 machine is in a 10.9.1.0/24 net and the address 10.9.1.13 is not yet taken by 
 anyone else. (You probably want to use something like 192.168.0.222 instead.) 

 Also, IP forwarding and masquerading must be enabled for your GGSN to be able 
 to connect to your mobile phones to the internet uplink. On linux, that can be 
 done for eth0 by: 

 <pre> 
 sudo sh -c "echo 1 > /proc/sys/net/ipv4/ip_forward" 
 sudo iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE 
 </pre> 

 You may need a different interface, possibly a wildcard like 'eth*'. 

 The GGSN needs permissions to create a @tun@ device, which @sudo@ will allow. 
 It may be safer though to allow your user to create tunnels instead of running 
 the GGSN as root. 

 If programs complain about missing library @.so@ files, you will probably need 
 to @export LD_LIBRARY_PATH=/usr/local/lib@. With sudo that would be @sudo 
 LD_LIBRARY_PATH=/usr/local/lib ggsn ...@, and you may need to add "SETENV" to 
 your sudoers config -- see the sudo documentation. 

 Once you have configured the IP addresses, start up your core network: launch 
 osmo-msc, osmo-bsc_mgcp, osmo-sgsn, ggsn and osmo-hnbgw. You should see log 
 messages indicating established IuCS and IuPS links (HNBGW, MSC and SGSN). 

 h2. Core Network Configuration Example 

 Here is a specific 3G core network configuration example, including a highly 
 specialized launcher script that configures the network (on a linux system) and 
 runs all the programs needed for a 3G core network -- but be aware: 

 *config:* 

 * This was run in a 192.168.0.1/24 subnet, yours may vary. 
 * Your femto cell will get itself an IP address from your DHCP server, which 
   will almost certainly differ from this example. You (so far still) need to 
   set this address in the mgcp.cfg. 
 * The ggsn.conf 'listen' address here is the additional interface (ala 'ip addr 
   add' above) and needs to match whichever address you picked there. 
 * Make sure all the other IP addresses in the config files match yours. 
 * Make sure the MCC and MNC match the ones configured in the femto cell. 

 *run.sh*: 

 * It assumes the Osmocom libs and programs to be installed in /usr/local/*. 
 * It launches each component in a separate X terminal. 
 * It uses rxvt-unicode, you may want to change the @urxvt@ call to your favorite xterm instead. 
 * Make sure the ethernet interface makes sense. 
 * Make sure the IP address makes sense. 
 * Run it in a directory where it will find the various configuration files. 
 * It runs most of the processes in a gdb for easier debugging. 
 * Once you hit Enter in the original terminal where you started, all the other 
   terminals will be torn down in one fell swoop (hopefully). 

 Now that you've taken notice of the points above, here are the config and 
 script: attachment:3G-config-example-v3.tar 

 h1. Femto Config 

 With your CN up and running, configure the hNodeB to contact osmo-hnbgw via 
 Iuh. Also make sure the PLMN ID matches the MCC and MNC in the osmo-msc.cfg -- 
 otherwise the hNodeB may reject all attach requests. 

 Depending on your femto cell, the steps to configure it will be radically 
 different: 

 * [[Configuring the ip.access nano3G]] 
 * ... 

 h1. Subscriber Configuration 

 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. 

 Configure your femto cell to authorize your IMSIs, refer to your specific model's configuration documentation. 

 Update the HLR database to add your IMSIs 
 <pre> 
 $ sqlite3 hlr.db  
 sqlite> insert into subscriber (imsi, msisdn) values ('901700000099999', '999'); 
 sqlite> select id, imsi from subscriber; 
 2342|901700000099999 
 sqlite> insert into auc_3g values (2342,5, '0102030405060708090a0b0c0d0e0f00',NULL,'f0e0d0c0b0a090807060504030201000',32); 
 </pre> 
 The numbers (except '5') are freely chosen and will all differ for you: 
 * 901700000099999: IMSI of your USIM. 
 * 999: MSISDN, i.e. the subscriber's telephone number. Your choice. 
 * 2342: the automatically created subscriber id, probably 1 for you. 
 * 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 
 * '0102030405060708090a0b0c0d0e0f00': KI, you got it with your USIM 
 * 'f0e0d0c0b0a090807060504030201000': OPC, you got it with your USIM 
 * 32: first SQN used for authentication 

 *NOTE*: *sysmoUSIM-SJS1 will work only from SQN=32 onwards.* 
 (see https://osmocom.org/issues/1965#note-13 #1965-13) 
 To set all SQN to >= 32 in your hlr.db: 
 <pre> 
 $ sqlite3 hlr.db 
 sqlite3> update auc_3g set sqn = 32 where sqn < 32; 
 </pre> 
 (Also remember to set sqn = 32 for any new subscriber you add to your db.) 
 As soon as we resolved #1968 and #1969, this will work automatically, 
 but so far you need to set sqn = 32 manually to get started. 

 h1. APN for Data Service 

 For the 3G data service to work, phones generally need an APN added to their 
 configuration, or they will not even attempt to establish a data connection. 
 For the Osmocom 3G CN, any arbitrary APN name will do. 

 The APN configuration steps are usually similar to: 

 * Navigate to APN settings: 
 ** 'Settings' 
 ** 'Wireless & Networks' 
 ** 'Mobile networks' 
 ** 'Access Point Names' 
 * You should see the list of APNs (possibly empty) 
 * Press the Menu button 
 * Choose 'New APN' 
 * Enter values for 'Name' as well as 'APN' 
 ** For both, any nonempty value is sufficient, e.g. "test". 
 * Again press the Menu button 
 * Choose 'Save' 
 * The APN should now appear in the list of APNs. 
 * Possibly tap the bullet icon to select the APN as default. 

 h1. Further Links 

 The "3G Voice Works" blog post from 2016 has some explanations: 
 https://osmocom.org/news/59 

 With almost any question, you can go back to the 3GPP specs. Here is a list of which is for what: 
 * [[GSMStandards]] 
 * and [[Interesting3GPPSpecsForDevelopers]] 

 h1. Tips and Facts 

 h3. Analyzing RTP streams in wireshark 

 IuCS actually uses UP over RTP. See 3GPP TS 25.414, and 25.415 6.6.2. 
 (an interesting insight is https://www.ietf.org/mail-archive/web/avt/current/msg05907.html ) 

 In the wireshark preferences, go to protocol IuUP, enable it and enter the dynamic protocol 
 number that you see in the RTP frames (e.g. 96). 

 h1. Help 

 If you experience problems you may ask for assistance on our 
 "mailing list":https://lists.osmocom.org/mailman/listinfo/openbsc. 

 ------ 

 fn1. For details on obtaining suitable 3G hardware, you can ask at info@sysmocom.de 
 or on our "mailing list":https://lists.osmocom.org/mailman/listinfo/openbsc.
Add picture from clipboard (Maximum size: 48.8 MB)