上次我写了 osmocombb配合c118嗅探短信 的文章,很多朋友留言让我写搭建openbts的,对于openbts其实很简单,官方文档就可以,主要是很多的环境依赖对于新手来说不好安装。所以今天我就出一个详细的openbts搭建基站。
安装所需:ubuntu12.0.4(系统)
openbts2.8
osmocom
libosmo-dsp
安装步骤: 一、安装libosmo-dsp分之:对于osmocom的libosmo-dsp分之,首先需要先安装osmocom,对于osmocom我之前写的文章很详细的写到了
http://www.CodeSec.Net/sectool/107755.html
在这篇文章的“六:下载并编译osmocomBB”,请安装下面的步骤来安装
下载所需要的
$ git clone git://git.osmocom.org/libosmocore.git $ git clone git://git.osmocom.org/osmocom-bb.git $ git clone git://git.osmocom.org/libosmo-dsp.git (openbts要用的)在安装libosmocore执行./configure 的时候很多人会遇到No package ‘talloc’ found 这种错误,因为找不到talloc,下面是解决办法
$ wget https://www.samba.org/ftp/talloc/talloc-2.1.7.tar.gz $ tar -zxvf talloc-2.1.7.tar.gz $ cd talloc-2.1.7/ $ ./configure $ make $ sudo make install安装libosmocore
$cdlibosmocore/
$autoreconf-i
$./configure
$make
$sudomakeinstall
$cd..
安装libosmo-dsp
$ cdlibosmo-dsp/
$ autoreconf-i
$ ./configure
$ make
$ sudomakeinstall
$ cd..
安装osmocom-bb
$ cdosmocom-bb/
$ gitcheckoutsylvain/testing
$ cdsrc
$ makeHOST_layer23_CONFARGS=--enable-transceiver
执行下面命令,刷入c118(如果刷入失败。。请检查你的c118是否接好)
$ sudo ./osmocon -p /dev/ttyUSB0 -m c123xor ../../target/firmware/board/compal_e88/trx.compalram.bin 二、下载安装openbts下面所有操作都在root权限下所以获取root权限
$ su下载openbts2.8
$svncohttp://wush.net/svn/range/software/public
(如果提示没有svn的话现在安装一下svn)
$apt-getinstallsubversion
(安装svn)
Image may be NSFW.
Clik here to view.

安装需要的依赖(很多人安装openbts各种错误就是因为环境依赖的问题)
$sudoapt-getinstallautoconflibtoollibosip2-devlibortp-devlibusb-1.0-0-devg++sqlite3libsqlite3-deverlanglibreadline6-devlibncurses5-dev
安装openbts(进入刚才下载openbts的目录里面有一个public目录)
Image may be NSFW.
Clik here to view.

$cdpublic
$cda53/trunk
$makeinstall
$cdopenbts/trunk
$autoreconf-i
$./configure
$make
$cdapps
$ln-s../TransceiverRAD1/transceiver.
$mkdir/etc/OpenBTS
(在etc下面创建目录存放openbts的配置文件)
$cd..
$sqlite3-init./apps/OpenBTS.example.sql/etc/OpenBTS/OpenBTS.db".quit"
(openbts的配置文件)
$sudomkdir-p/var/lib/asterisk/sqlite3dir
$sqlite3/etc/OpenBTS/OpenBTS.db.dump
(查看数据库文件是否成功)
Image may be NSFW.
Clik here to view.

如果成功显示配置文件的内容那就成功了
安装sipauthserve(SIP鉴权服务)
然后我们在回到public目录安装 sipauthserve
$cdsubscriberRegistry/trunk
$make
$sudosqlite3-initsubscriberRegistry.example.sql/etc/OpenBTS/sipauthserve.db".quit"
(sipauthserve的配置文件同样在刚才openbts配置文件的目录)
安装smqueue(短信服务)
回到public目录
$cdsmqueue/trunk
$autoreconf-i
$./configure
$make
$sudosqlite3-initsmqueue/smqueue.example.sql/etc/OpenBTS/smqueue.db".quit" (同样的 smqueue 配置文件)
好了现在全部都安装好了,咱们来开始启动openbts
第一步先刷入c118(注意下面的操作依然是root权限)
$ osmocom-bb/src/host/osmocon/osmocon -p /dev/ttyUSB0 -m c123xor ../../target/firmware/board/compal_e88/trx.compalram.binImage may be NSFW.
Clik here to view.

第二步利用c118做openbts的收发器,ARFCN是基站信息,你可以扫描附近的基站,利用cell可以先扫描基站信息,找个最强的
$ osmocom-bb/src/host/layer23/src/transceiver/transceiver ARFCNImage may be NSFW.
Clik here to view.

第三步启动openbts(新手朋友注意。这里是打开4个新的终端。。不是在一个终端里面执行)
$smqueue/trunk/smqueue/smqueue
$subscriberRegistry/trunk/sipauthserve
$openbts/trunk/apps/OpenBTS
$openbts/trunk/apps/OpenBTSCLI
启动成功后,咱们还有一步就是配置OpenBTSCLI(修改openbts的配置,这一步很重要)
启动OpenBTSCLI后,我们需要修改几处配置
$ config (这条命令可以查看你的配置文件) https://1.bp.blogspot.com/-LiP6wODk3Dg/V381LDCynpI/AAAAAAAAAD4/c4pFA3rgdagmcitTcrm3N_ojicTetI7bACLcB/s1600/H%2529DXTU%257D%2529E%2529RHOXDBV%252875OI7.jpg $ config Control.LUR.OpenRegistration .* (修改Control.LUR.OpenRegistration可以让任何的手机加入基站) $ config GSM.Radio.C0 ARFCN (这里的ARFCN是 transceiver 监视的基站信息) $ config GSM.Identity.MCC 001 $ config GSM.Identity.MNC 01 (MCC MNC 移动国家码,这里用001 01这是测试网络)最后终于可以用手机搜索并连接bts
你手机应该会看见TestPLMH1-1(如果看不见就多试几次。。或者换基站。。毕竟是c118
最激动的时候到了测试短信
看到OpenBTSCLI终端窗口执行
$ tmsis (查看链接到基站的ismi) $ sendsms TMSIS number messege (TMSIS就是刚才tmsis查看到的ismi,number就是你要发送过去的电话号码,messege是短信内容)文档参考: http://gsmsuperben.blogspot.my/2016/07/osmocomc118openbts-send-sms.html
* 本文原创作者:diulei,本文属CodeSec原创奖励计划,未经许可禁止转载