Getting Started with 3G » History » Revision 46
Revision 45 (neels, 05/16/2017 02:01 PM) → Revision 46/52 (neels, 07/03/2017 05:30 PM)
{{>toc}} h1. Getting Started with 3G _This reflects the state of Osmocom 3G development on 2017-05-14_ 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. Build Core Network Programs To get your 3G core network up and running, you need to manually build specific branches from various Osmocom projects. The attachment:3G-config-example.tar contains a script to clone and build -- refer to the README.txt enclosed in the tar. In detail, this is what needs to be built: * libosmocore: master * libosmo-abis: master * libosmo-netif: master * libosmo-sccp: *old_sua* (tag) * libsmpp34: master * libasn1c: master * osmo-iuh: *old_sua* (tag) master * openggsn: master * openbsc: *vlr_3G* * osmo-hlr: master (In the unlikely case the asn.1 definitions changed, you also need asn1c, branch aper-prefix-onto-upstream) 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). h1. Configure Core Network 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. * 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. * 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.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. Once off, the HLR database needs to be created using the file @osmo-hlr/sql/hlr.sql@: <pre> sqlite3 hlr.db < osmo-hlr/sql/hlr.sql </pre> 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. 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 (subscriber_id, algo_id_3g, k, opc) values (2342, 5, '0102030405060708090a0b0c0d0e0f00', 'f0e0d0c0b0a090807060504030201000'); </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 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. Troubleshooting h2. My phone doesn't register / the MSC sees no messages Make sure that you start the OsmoHNBGW only *after* the MSC and SGSN have started up and are ready. Best stop all programs, then first launch in this order: * osmo-hlr, osmo-bsc_mgcp * osmo-msc, osmo-sgsn -- give it time to listen for IuCS/IuPS * osmo-hnbgw #2264 h2. My phone is rejected * is your hNodeB cell configured for open access or to allow this IMSI? * do the MCC+MNC configured in the hNodeB match osmo-msc.cfg's "network country code" and "mobile network code"? * did you enter the subscriber in the HLR database? ** does the subscriber have an auc_3g entry? ** if you got an OPC value for your USIM, is this key entered in the OPC column (vs. the OP column which would not work then)? Or vice versa, did you put the OP key in the OPC column? ** make sure only one of OP or OPC are entered. h2. I have no phone number If dialling '*#100#' returns a message lacking a phone number ("Your extension is "), then add an MSISDN in the hlr.db's subscriber table. h2. Voice calls don't go through Does the MGCP gateway (aka osmo-bsc_mgcp) have your hNodeB's IP address configured as "mgcp" / "bts ip"? #2262 h2. Phone is registered, but is usually not receiving any SMS / voice calls In open access mode, it seems the nano3G sometimes fails to page a phone -- it looks like it didn't store the subscriber's IMSI. Try to register the phone that should receive a call to a different network (being rejected suffices, just to get the TMSI out of the phone's state) and then re-register to the hNodeB. h2. Data service is not working Try to go to flight mode and back online... #1977 h1. Tips and Facts h2. 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). h2. Launch GGSN with root priviliges 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: <pre> echo "$USER ALL= NOPASSWD:SETENV: /usr/local/bin/ggsn *" > ~/ggsn_sudoers chmod go-w ~/ggsn_sudoers sudo chown root: ~/ggsn_sudoers sudo mv ~/ggsn_sudoers /etc/sudoers.d/ </pre> 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. 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.