Project

General

Profile

OpenBSC GPRS » History » Revision 11

Revision 10 (Anonymous, 02/19/2016 10:47 PM) → Revision 11/37 (Anonymous, 02/19/2016 10:47 PM)

[[PageOutline]] 

 = OpenBSC GPRS/EDGE Setup page = 

 == Pre-requisites == 

  * SDR transceiver: SysmoBTS, USRP, UmTRX, A nano BTS with GPRS or EDGE support. BS-11 are not supported. supported (yet?) 
  * A compiled GGSN from OpenGGSN (make sure to use the osmocom version. git://git.osmocom.org/openggsn.git ) 
  * A working and up-to-date OpenBSC (see [wiki:Building_OpenBSC]) 
    * You will need to (re-)build it after having installed OpenGGSN so that the `libgtp` is detected and the SGSN binary `osmo-sgsn` built. 
  * A custom SIM for your network 
    * Currently osmo-sgsn refuses all roaming, so you need a SIM that matches your custom MCC/MNC network 

 == Setup == 

 First a little picture to illustrate the different elements and their interactions : 

 [[Image(gprs.2.png)]] 

 === Compiling OpenBSC with [E]GPRS === 

 The guide below was tested on Ubuntu 15.10 11.10 but should work on Debian as well. This guide uses /root for everything. 

 First you need to download all dependencies: 

 {{{ 
 apt apt-get install libdbi0-dev libdbd-sqlite3 libtool autoconf git-core pkg-config make libortp-dev 
 }}} 

 Next, download the OpenGGSN source code: 
 {{{ 
 cd /root 
 git clone git://git.osmocom.org/openggsn.git 
 }}} 

 Compile OpenGGSN: 
 {{{ 
 cd openggsn /root/openggsn 
 dpkg-buildpackage -tc -uc -us autoreconf; automake --add-missing; autoreconf; autoconf; automake; ./configure --prefix=/usr/local; make -j 2; make install 
 sudo dpkg -i ../*.deb 
 }}} 

 Now download everything else: 
 {{{ 
 cd /root 
 git clone git://git.osmocom.org/libosmocore; git://git.osmocom.org/libosmocore.git; git clone git://git.osmocom.org/libosmo-abis; git://git.osmocom.org/libosmo-abis.git; git clone git://git.osmocom.org/libosmo-netif; git://git.osmocom.org/libosmo-netif.git; git clone git://git.osmocom.org/openbsc git://git.osmocom.org/openbsc.git 
 }}} 

 Compile the rest: 
 {{{ 
 cd libosmocore; dpkg-buildpackage -tc -uc -us; sudo dpkg -i ../*.deb /root/libosmocore; autoreconf -fi; ./configure; make; make install; ldconfig 
 cd libosmo-abis; dpkg-buildpackage -tc -uc -us; sudo dpkg -i ../*.deb /root/libosmo-abis; autoreconf -fi; ./configure; make; make install; ldconfig 
 cd libosmo-netif; dpkg-buildpackage -tc -uc -us; sudo dpkg -i ../*.deb /root/libosmo-netif; autoreconf -fi; ./configure; make; make install; ldconfig 
 cd openbsc/openbsc; dpkg-buildpackage -tc -uc -us; sudo dpkg -i ../*.deb /root/openbsc/openbsc; autoreconf -fi; export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig; ./configure; make 
 }}} 

 You should now have a working copy of ggsn, osmo-sgsn and osmo-nitb on your machine. You will also need OsmoPCU: 
 {{{ 
 git clone git://git.osmocom.org/osmo-pcu  
 autoreconf -if 
 ./configure 
 make 
 }}} 

 It can be executed in-place - no installation necessary. 

 === OpenBSC configuration === 

 The first step is to configure OpenBSC for gprs support. Add this to the `network/bts` node in `openbsc.cfg`: 
 {{{ 
 gprs mode gprs 
 gprs routing area 0 
 gprs cell bvci 2 
 gprs nsei 101 
 gprs nsvc 0 nsvci 101 
 gprs nsvc 0 local udp port 23000 
 gprs nsvc 0 remote udp port 23000 
 gprs nsvc 0 remote ip 192.168.0.128 
 }}} 

 The `gprs nsvc 0 remote` entries `192.168.0.128:23000` is the IP/port of the machine running the SGSN as seen from the BTS. It will be sent by OpenBSC to the BTS in the configration phase and the BTS will connect back to the SGSN. 

 The second step is to allocate some timeslots to packet data. For this, just change the 1 or more `network/bts/trx/timeslot` nodes using : 
 {{{ 
 phys_chan_config PDCH 
 }}} 


 === Osmocom SGSN configuration === 

 Here's a sample SGSN configuration file `osmo-sgsn.cfg` with some explanations : 

 {{{ 
 ! 
 ! Osmocom SGSN configuration 
 ! 
 ! 
 line vty 
  no login 
 ! 
 sgsn 
  gtp local-ip 192.168.1.128 
  ggsn 0 remote-ip 192.168.1.129 
  ggsn 0 gtp-version 1 
 ! 
 ns 
  timer tns-block 3 
  timer tns-block-retries 3 
  timer tns-reset 3 
  timer tns-reset-retries 3 
  timer tns-test 30 
  timer tns-alive 3 
  timer tns-alive-retries 10 
  encapsulation udp local-ip 192.168.0.128 
  encapsulation udp local-port 23000 
  encapsulation framerelay-gre enabled 0 
 ! 
 bssgp 
 ! 
 }}} 

  * The `gtp local-ip` entry is the local IP the SGSN will bind to. 
  * The `ggsn 0 remote-ip` entry if the remote IP of the GGSN. The SGSN will connect to it. 
  * Those two IPs '''must''' be different even if you're running both processes on the same machine. A solution for that is to put several IP aliases on the same network interface or use the loopback interface. 
  * The `encapsulation` settings must be the same IP/port than you've setup in `openbsc.cfg` 

 === OpenGGSN configuration === 

 The ggsn.conf file is pretty well documented. What is mostly of interest here is : 

  * The configuration of the GTP link. (Must match the `ggsn 0 remote-ip` entry in `osmo-sgsn.cfg`) 

 {{{ 
 # TAG: listen 
 # Specifies the local IP address to listen to 
 listen 192.168.1.129 
 }}} 

  * The configuration given to phones, IP pool & DNS. 

 {{{ 
 # TAG: dynip 
 # Dynamic IP address pool. 
 # Used for allocation of dynamic IP address when address is not given 
 # by HLR. 
 # If this option is not given then the net option is used as a substitute. 
 # dynip 192.168.254.0/24 

 # TAG: pcodns1/pcodns2 
 # Protocol configuration option domain name system server 1 & 2. 
 pcodns1 208.67.222.222 
 pcodns2 208.67.220.220 
 }}} 

 === OsmoPCU configuration === 

 {{{ 
 pcu 
  flow-control-interval 10 
  cs 2 
  alloc-algorithm dynamic 
  alpha 0 
  gamma 0 
 }}} 

 === Network configuration === 

 You will also need to configure some networking rules to allow connectivity from `tun0`. Look up linux networking/nat howtos on google. 
 The basic setup for testing only in a safe environment would be : 

 {{{ 
 bash# echo 1 > /proc/sys/net/ipv4/ip_forward 
 bash# iptables -A POSTROUTING -s 192.168.254.0/24 -t nat -o eth0 -j MASQUERADE 
 }}}  

 (replace `eth0` by the interface providing your machine connectivity) 

 == Running == 

 Sample startup sequence (adjust logging and configuration files location as you see fit): 
 {{{ 
 osmo-nitb -s -c ~/.config/osmocom/open-bsc.cfg -l ~/.config/osmocom/hlr.sqlite3 -P -m -C -T --debug=DSQL:DLSMS:DRLL:DCC:DMM:DRR:DMSC:DHO:DGPRS:DNS:DLLC:DCTRL 2>&1 | tee /tmp/openbsc.log 
 sudo ggsn -c ~/.config/osmocom/ggsn.conf -f -d 
 osmo-sgsn -c ~/.config/osmocom/osmo-sgsn.cfg -d DRLL:DCC:DMM:DRR:DNM:DMSC:DHO:DGPRS:DNS:DLLC:DCTRL 

 cd osmo-trx/Transceiver52M 
 sudo chrt 20 ./osmo-trx 
 cd osmo-bts/src/osmo-bts-trx 
 sudo chrt 15 ./osmobts-trx -c ~/.config/osmocom/osmo-bts.cfg -i 224.0.0.1 -d DRLL:DCC:DMM:DRR:DNM:DMSC:DHO:DGPRS:DNS:DLLC:DCTRL 

 osmo-pcu/src 
 sudo ./osmo-pcu -c ~/.config/osmocom/osmo-pcu.cfg 
 }}} 

 Note: OsmoTRX is only necessary with USRP/UmTRX transceivers (At Just start the time of writing 201509-fairwaves-rebase branch of OsmoBTS is necessary as well for compatibility). Once you're done with experimenting and ready for production setup it might be convenient to create systemd units so all the parts are started automatically. 

 == Troubleshooting == 

 three processes : 
  * double-check that your phones have APN set to something. "Internet" will do for example. The value of APN is not checked but if it's unset the phones' baseband might not even try to initiate GPRS connection. 
 `ggsn` 
  * check that NAT and packet forwarding works properly. Something like this: 

 {{{ 
 [Match] 
 Name=tun* 

 [Network] 
 Description=Expose GGSN's connected mobiles to Internet 
 IPForward=ipv4 
 IPMasquerade=yes 
 Address=192.168.0.1 
 }}} 
 might be necessary for systemd-networkd. `osmo-sgsn` 
  * `osmo-nitb` 

 You can access vty from  
  * OpenBSC on port 4242 See [wiki:osmo-nitb_VTY] 
  * SGSN on port 4245. See [wiki:osmo-sgsn_VTY] 


Add picture from clipboard (Maximum size: 48.8 MB)