使用OpenBTS搭建GSM测试网络

1. 环境搭建

下载ubuntu-16.04.4-desktop-amd64.iso,安装使用一台全新的机器,防止因依赖问题导致的报错。

SDR硬件,usrp B210

1.1 更新

sudo apt-get install software-properties-common python-software-properties
sudo add-apt-repository ppa:git-core/ppa
sudo apt-get update
sudo apt-get install git

1.2 搭建OpenBTS开发环境

mkdir sdr  //新建sdr文件夹
cd sdr  //进入该文件夹
git clone https://github.com/RangeNetworks/dev.git
cd dev
./clone.sh  //从GitHub克隆代码
./switchto.sh master  //切到master分支
./build.sh B210 

编译下载的源码,因为使用的是USRP B210 build脚本后加SDR硬件 ,如果使用的是USRP N200 则执行./build.sh N200(过程中需从谷歌下载源码,建议全程翻墙,否则会报错!)

编译过程根据网络、机器性能而异,通常在30-45分钟左右,编译完成后,ubuntu自动安装GnuRadio、USRP的UHD驱动等相关SDR环境,但USRP的固件还需手动下载:

$sudo python /usr/lib/uhd/utils/uhd_images_downloader.py
Images destination:      /usr/share/uhd/images
Downloading images from: http://files.ettus.com/binaries/images/uhd-images_003.009.002-release.zip
Downloading images to:   /tmp/tmpEplLOD/uhd-images_003.009.002-release.zip
26296 kB / 26296 kB (100%)

Images successfully installed to: /usr/share/uhd/images
nano@nano:~/sdr/dev/openbts/Transceiver52M$ uhd_usrp_probe 
linux; GNU C++ version 5.3.1 20151219; Boost_105800; UHD_003.009.002-0-unknown


-- Detected Device: B210
-- Operating over USB 3.
-- Initialize CODEC control...
-- Initialize Radio control...
-- Performing register loopback test... pass
-- Performing register loopback test... pass
-- Performing CODEC loopback test... pass
-- Performing CODEC loopback test... pass
-- Asking for clock rate 16.000000 MHz... 
-- Actually got clock rate 16.000000 MHz.
-- Performing timer loopback test... pass
-- Performing timer loopback test... pass
-- Setting master clock rate selection to 'automatic'.
  _____________________________________________________
 /
|       Device: B-Series Device
|     _____________________________________________________
|    /
|   |       Mboard: B210
|   |   revision: 4
|   |   product: 2
|   |   serial: 30AA06B
|   |   name: 2000501894107
|   |   FW Version: 8.0
|   |   FPGA Version: 13.0
|   |   
|   |   Time sources: none, internal, external, gpsdo
|   |   Clock sources: internal, external, gpsdo
|   |   Sensors: ref_locked
|   |     _____________________________________________________
|   |    /
|   |   |       RX DSP: 0
|   |   |   Freq range: -8.000 to 8.000 MHz
|   |     _____________________________________________________
|   |    /
|   |   |       RX DSP: 1
|   |   |   Freq range: -8.000 to 8.000 MHz
|   |     _____________________________________________________
|   |    /
|   |   |       RX Dboard: A
|   |   |     _____________________________________________________
|   |   |    /
|   |   |   |       RX Frontend: A
|   |   |   |   Name: FE-RX2
|   |   |   |   Antennas: TX/RX, RX2
|   |   |   |   Sensors: temp, rssi, lo_locked
|   |   |   |   Freq range: 50.000 to 6000.000 MHz
|   |   |   |   Gain range PGA: 0.0 to 76.0 step 1.0 dB
|   |   |   |   Bandwidth range: 200000.0 to 56000000.0 step 0.0 Hz
|   |   |   |   Connection Type: IQ
|   |   |   |   Uses LO offset: No
|   |   |     _____________________________________________________
|   |   |    /
|   |   |   |       RX Frontend: B
|   |   |   |   Name: FE-RX1
|   |   |   |   Antennas: TX/RX, RX2
|   |   |   |   Sensors: temp, rssi, lo_locked
|   |   |   |   Freq range: 50.000 to 6000.000 MHz
|   |   |   |   Gain range PGA: 0.0 to 76.0 step 1.0 dB
|   |   |   |   Bandwidth range: 200000.0 to 56000000.0 step 0.0 Hz
|   |   |   |   Connection Type: IQ
|   |   |   |   Uses LO offset: No
|   |   |     _____________________________________________________
|   |   |    /
|   |   |   |       RX Codec: A
|   |   |   |   Name: B210 RX dual ADC
|   |   |   |   Gain Elements: None
|   |     _____________________________________________________
|   |    /
|   |   |       TX DSP: 0
|   |   |   Freq range: -8.000 to 8.000 MHz
|   |     _____________________________________________________
|   |    /
|   |   |       TX DSP: 1
|   |   |   Freq range: -8.000 to 8.000 MHz
|   |     _____________________________________________________
|   |    /
|   |   |       TX Dboard: A
|   |   |     _____________________________________________________
|   |   |    /
|   |   |   |       TX Frontend: A
|   |   |   |   Name: FE-TX2
|   |   |   |   Antennas: TX/RX
|   |   |   |   Sensors: temp, lo_locked
|   |   |   |   Freq range: 50.000 to 6000.000 MHz
|   |   |   |   Gain range PGA: 0.0 to 89.8 step 0.2 dB
|   |   |   |   Bandwidth range: 200000.0 to 56000000.0 step 0.0 Hz
|   |   |   |   Connection Type: IQ
|   |   |   |   Uses LO offset: No
|   |   |     _____________________________________________________
|   |   |    /
|   |   |   |       TX Frontend: B
|   |   |   |   Name: FE-TX1
|   |   |   |   Antennas: TX/RX
|   |   |   |   Sensors: temp, lo_locked
|   |   |   |   Freq range: 50.000 to 6000.000 MHz
|   |   |   |   Gain range PGA: 0.0 to 89.8 step 0.2 dB
|   |   |   |   Bandwidth range: 200000.0 to 56000000.0 step 0.0 Hz
|   |   |   |   Connection Type: IQ
|   |   |   |   Uses LO offset: No
|   |   |     _____________________________________________________
|   |   |    /
|   |   |   |       TX Codec: A
|   |   |   |   Name: B210 TX dual DAC
|   |   |   |   Gain Elements: None

编译完成后也会在BUILD目录下生成一个以编译时间为名的文件,如果系统为32bit编译后则在该目录下生成i386.deb的软件包,如果系统为64bit则生成amd64.deb :

1.3 更新&安装依赖包

sudo apt-get install software-properties-common python-software-properties
sudo add-apt-repository ppa:chris-lea/zeromq
sudo apt-get update

1.4 安装编译完成的DEB软件包

需注意是否有报错:

cd dev/BUILD/2018-03-02--15-29-38
sudo dpkg -i libcoredumper1_1.2.1-1_i386.deb libcoredumper-dev_1.2.1-1_i386.deb
sudo dpkg -i  liba53_0.1_i386.deb
sudo dpkg -i range-configs_5.0_all.deb
sudo dpkg -i range-asterisk*.deb
sudo dpkg -i sipauthserve_5.0_i386.deb
sudo dpkg -i smqueue_5.0_i386.deb
sudo dpkg -i openbts_5.0_i386.deb如遇到安装失败运行下面安装依赖指令:
sudo apt-get install -f

2. 开启数据转发、配置iptables

因为OpenBTS基站的GPRS网络流量是基于PC机,所以在开启基站GPRS功能前,需要开启数据包转发以及配置Iptables防火墙规则。

2.1 开启数据包转发:

ubuntu开数据转发需以root身份执行,如果不是root用户,即使使用sudo也无法开启:

sudo su 
echo 1 >> /proc/sys/net/ipv4/ip_forward

2.2 配置iptables规则:

/etc/OpenBTS/iptables.rules 配置规则文件内容如下:

# Generated by iptables-save v1.4.4
*nat
:PREROUTING ACCEPT [0:0]
:POSTROUTING ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
-A POSTROUTING -o eth0 -j MASQUERADE
COMMIT
# Generated by iptables-save v1.4.4
*filter
:INPUT ACCEPT [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
COMMIT

某些情况下机器的网卡并非eth0 ,所以需要根据自身实际情况,灵活地修改配置文件。


sudo iptables-restore < /etc/OpenBTS/iptables.rules
iptables -t nat -L -n -v


3.3 加载数据库

cd sdr/dev/openbts/apps
sudo sqlite3 -init OpenBTS.example.sql /etc/OpenBTS/OpenBTS.db ".quit"

cd sdr/dev/subscriberRegistry/apps
sudo sqlite3 -init sipauthserve.example.sql /etc/OpenBTS/sipauthserve.db ".quit"

cd sdr/dev/smqueue/smqueue
sudo sqlite3 -init smqueue.example.sql /etc/OpenBTS/smqueue.db ".quit"

3.4 配置asterisk

Asterisk是运行在Linux上来实现用户电话交换的IP-PBX系统开源软件,支持各种的VOIP协议。Asterisk提供了很多以前只有昂贵、专业的PBX系统才支持的功能,如:会议电话、语音信箱、交互式语音应答、自动电话转接。

在/etc/asterisk/目录中需要修改sip.conf、extensions.conf 具体方法:将手机的IMSI国际用户识别码和分配的号码登记数据asterisk中,也就是将数据写入sip.conf、extensions.conf两个配置文件。

sip.conf:

[general]
bindport=5060                   ; asterisk 1.6
                                ; UDP Port to bind to (SIP standard port for unencrypted UDP 
                                ; and TCP sessions is 5060)
                                ; bindport is the local UDP port that Asterisk will listen on
bindaddr=0.0.0.0                ; asterisk 1.6
                                ; IP address to bind UDP listen socket to (0.0.0.0 binds to all)
                                ; You can specify port here too, like 123.123.123.123:5080
udpbindaddr=0.0.0.0             ; asterisk 1.8
                                ; IP address to bind UDP listen socket to (0.0.0.0 binds to all)
                                ; Optionally add a port number, 192.168.1.1:5062 (default is port 5060)


tos_sip=cs3                     ; Sets TOS for SIP packets.
tos_audio=ef                    ; Sets TOS for RTP audio packets.
tos_video=af41                  ; Sets TOS for RTP video packets.
tos_text=af41                   ; Sets TOS for RTP text packets.


cos_sip=3                       ; Sets 802.1p priority for SIP packets.
cos_audio=5                     ; Sets 802.1p priority for RTP audio packets.
cos_video=4                     ; Sets 802.1p priority for RTP video packets.
cos_text=3                      ; Sets 802.1p priority for RTP text packets.


maxexpiry=3600                  ; Maximum allowed time of incoming registrations
                                ; and subscriptions (seconds)
minexpiry=60                    ; Minimum length of registrations/subscriptions (default 60)
defaultexpiry=3600              ; Default length of incoming/outgoing registration
dynamic_exclude_static=yes      ; Disallow all dynamic hosts from registering
                                ; as any IP address used for staticly defined
                                ; hosts.  This helps avoid the configuration
                                ; error of allowing your users to register at
                                ; the same address as a SIP provider.
use_q850_reason=yes             ; Set to yes add Reason header and use Reason header if it is available.


;t1min=100                      ; Minimum roundtrip time for messages to monitored hosts
                                ; Defaults to 100 ms
;timert1=500                    ; Default T1 timer
                                ; Defaults to 500 ms or the measured round-trip
                                ; time to a peer (qualify=yes).
;timerb=32000                   ; Call setup timer. If a provisional response is not received
                                ; in this amount of time, the call will autocongest
                                ; Defaults to 64*timert1
rtptimeout=60                   ; Terminate call if 60 seconds of no RTP or RTCP activity
                                ; on the audio channel
                                ; when we're not on hold. This is to be able to hangup
                                ; a call in the case of a phone disappearing from the net,
                                ; like a powerloss or grandma tripping over a cable.
rtpholdtimeout=300              ; Terminate call if 300 seconds of no RTP or RTCP activity
                                ; on the audio channel
                                ; when we're on hold (must be > rtptimeout)


allowguest=no                   ; Allow or reject guest calls (default is yes)
autocreatepeer=no               ; The Autocreatepeer option allows, 
                                ; if set to Yes, any SIP ua to register with your Asterisk PBX as a peer. 
                                ; This peer's settings will be based on global options. 
                                ; The peer's name will be based on the user part of the Contact: header field's URL. 


context=from-openBTS                    ; Default context for incoming calls
;context=phones                 ; Default context for incoming calls
allowoverlap=no                 ; Disable overlap dialing support. (Default is yes)


disallow=all                    ; need to disallow=all before we can use allow=
allow=gsm                       ; GSM
allow=ulaw                      ; ISDN US
allow=alaw                      ; ISDN EU


relaxdtmf=yes                   ; Relax dtmf handling (only to be used for connecting to aserisk 1.2 and INDBAND)
dtmfmode=rfc2833                ; Set default dtmfmode for sending DTMF. Default: rfc2833
                                ; Other options:
                                ; info : SIP INFO messages (application/dtmf-relay)
                                ; shortinfo : SIP INFO messages (application/dtmf)
                                ; inband : Inband audio (requires 64 kbit codec -alaw, ulaw)
                                ; auto : Use rfc2833 if offered, inband otherwise


canreinvite=no                  ; no reinvites from Asterisk


directmedia=no                  ; Asterisk by default tries to redirect the
                                ; RTP media stream to go directly from
                                ; the caller to the callee.  Some devices do not
                                ; support this (especially if one of them is behind a NAT).
                                ; The default setting is YES. If you have all clients
                                ; behind a NAT, or for some other reason want Asterisk to
                                ; stay in the audio path, you may want to turn this off.


                                ; This setting also affect direct RTP
                                ; at call setup (a new feature in 1.4 - setting up the
                                ; call directly between the endpoints instead of sending
                                ; a re-INVITE).


callcounter=yes                 ; Enable call counters on devices. This can be set per
                                ; device too.
#include sip-custom-register.conf




[CodecBTS](!)
        disallow=all            ; need to disallow=all before we can use allow
        allow=gsm               ; GSM
        allow=ulaw              ; ISDN US
        allow=alaw              ; ISDN EU


[optionsBTS](!)
        type=peer
        context=from-openBTS
        dtmfmode=rfc2833
        canreinvite=no
        qualify=no              ; openbts do not support OPTION
        insecure=port,invite


;If you need to make any changes please add them to sip-custom-contexts.conf 
#include sip-custom-contexts.conf

;openbts
[IMSI460010100001101]
callerid=1101
canreinvite=no
type=friend
context=sip-external
allow=gsm
host=dynamic
dtmfmode=info

[IMSI460010100001102]
callerid=1102
canreinvite=no
type=friend
context=sip-external
allow=gsm
host=dynamic
dtmfmode=info

callerid=1102,表示将IMSI为460010100001102的手机分配号码1102;

canreinvite=no,表示被呼叫的手机一旦建立连接后OpenBTS将不再发送重新邀请的指令;

context=sip-external,表示允许外部未分配号码的匿名电话呼入。

extensions.conf:

[globals](+)
GW1=voipms-LosAngeles                                                           ;Primary sip account used for handeling calls to the PSTN, change the name to match sip.conf
GW2=voipms-Seattle                                                              ;Secondary sip account for handelig calls to the PSTN, change the name to match sip.conf
emergency=911                                                                   ;Change this number to what your PSTN provider use for emergency number
DialIMSITimeoutVM=30                                                            ;how long to ring before going to voicemail
DialIMSITimeout=180                                                             ;how long to ring before indicating no answer
DialPSTNTimeout=3600                                                            ;how long to ring before indicating no answer (must be high as the timer is also used dureing early media)
AnswerDelay=4000                                                                ;how long to wait in order to allow the channel to be establish (give the MS time to establish the voice channel)




[emergency](+)                                                                  ;Here you define the number that must be treatet as an emertency call http://en.wikipedia.org/wiki/emergency_telephone_number
exten => _[sS][oO][sS], 1,Set(CDR(B-Number)=${emergency})                               ;Defined by the GSM standard
exten => _112!,         1,Set(CDR(B-Number)=${emergency})                               ;EU
exten => _911!,         1,Set(CDR(B-Number)=${emergency})                               ;US
;exten => _999!,        1,Set(CDR(B-Number)=${emergency})                               ;UK




[to-e164](HangupCause)                                                          ;Here you can change how dialing patterns is handled for when you recice a call from openBTS
exten => _011!,         1,Return(+${EXTEN:3})                                   ;US international dialing prefix
exten => _00!,          1,Return(+${EXTEN:2})                                   ;EU international dialing prefix
exten => _1NXXNXXXXXX,  1,Return(+${EXTEN})                                     ;US NANP8
exten => _NXXNXXXXXX,   1,Return(+1${EXTEN})                                    ;US NANP7
exten => _X!,           1,Return(${EXTEN})                                      ;Unknown local call
exten => _+!,           1,Return(${EXTEN})                                      ;E.164
exten => _[*#a-zA-Z]!,  1,Return(${EXTEN})                                      ;Unknown




[to-pstn](+)                                                                    ;Here you can change how dialing patterns is handled for when you send a call to the PSTN http://www.voip-info.org/wiki/view/Asterisk+Dialplan+Patterns
exten => _011!,         1,Set(CDR(B-Number)=+${EXTEN:3})                                ;US international dialing prefix
exten => _00!,          1,Set(CDR(B-Number)=+${EXTEN:2})                                ;EU international dialing prefix
exten => _1NXXNXXXXXX,  1,Set(CDR(B-Number)=+${EXTEN})                          ;US NANP8
exten => _NXXNXXXXXX,   1,Set(CDR(B-Number)=+1${EXTEN})                         ;US NANP7




[from-pstn](+)                                                                  ;Here you can change how dialing patterns is handled for when you recice a call from the PSTN
exten => _011!,         1,Set(CDR(B-Number)=+${EXTEN:3})                                ;US international dialing prefix
exten => _00!,          1,Set(CDR(B-Number)=+${EXTEN:2})                                ;EU international dialing prefix
exten => _1NXXNXXXXXX,  1,Set(CDR(B-Number)=+${EXTEN})                          ;US NANP8
exten => _NXXNXXXXXX,   1,Set(CDR(B-Number)=+1${EXTEN})                         ;US NANP7


[default](+)                                                                    ;Here you can add any dialplan the phones must be able to call internaly
exten => 111,           1,Goto(VoicemailMain,${CDR(A-Number)},1)                ;extension used for accessing the voicemail




#include extensions-range-test.conf                                             ;Test numbers, should be removed in a production system




[sip-external]
exten => 100,1,Dial(SIP/0000FFFF0001) ; Replace 0000FFFF0001 with your device name


exten => 101,1,Dial(SIP/0000FFFF0002) ; Replace 0000FFFF0002 with your device name


exten => 200,1,Answer()
   same => n,Playback(hello-world)
   same => n,Hangup()


exten => 201,1,Goto(TestMenu,start,1) ; add this to the end of the
                                      ; [LocalSets] context
exten => 1101,1,Dial(SIP/[email protected]:5062) ; Replace 0000FFFF0002 with your device name
exten => 1102,1,Dial(SIP/[email protected]:5062) ; Replace 0000FFFF0002 with your device name

3. 启动基站:

3.1 执行 transceiver连接SDR硬件

cd sdr/dev/openbts/Transceiver52M
sudo ./transceiver


3.2 执行OpenBTS启动基站

cd sdr/dev/openbts/apps/
sudo ./OpenBTS


3.3 执行smqueue,启用短信服务

cd sdr/dev/smqueue/smqueue
sudo ./smqueue


3.4 执行sipauthserve,启用鉴权服务

cd sdr/dev/subscriberRegistry/apps
sudo ./sipauthserve


3.5 asterisk -vvvc or asterisk -r


3.6 启动OpenBTS终端控制台:

cd sdr/dev/openbts/apps
sudo ./OpenBTSCLI


nano@nano:~/sdr/dev/openbts/apps$ sudo ./OpenBTSCLI 
OpenBTS Command Line Interface (CLI) utility
Copyright 2012, 2013, 2014 Range Networks, Inc.
Licensed under GPLv2.
Includes libreadline, GPLv2.
Connecting to 127.0.0.1:49300...
Remote Interface Ready.
Type:
 "help" to see commands,
 "version" for version information,
 "notices" for licensing information,
 "quit" to exit console interface.
OpenBTS> help


Type "help" followed by the command name for help on that command.


alarms		audit		calls		
cbs		cellid		chans		
config		crashme		devconfig	
endcall		freqcorr	gprs		
handover	help		load		
memstat		neighbors	noise		
notices		page		power		
rawconfig	regperiod	restart		
rmconfig	rxgain		sendsimple	
sendsms		sgsn		shutdown	
stats		sysinfo		tmsis		
trxfactory	txatten		unconfig	
uptime		version		


OpenBTS> version
release 5.0-master+646bb6e79f CommonLibs:76b71d509b+GPRS P built 2018-03-02T15:33:24 


OpenBTS> 


4. 配置基站

刚搭建完成的基站由于天线功率过大以及手机跟基站的距离太近等原因,可能会导致手机不能正常加入到基站,这时需要配置加入基站的条件以及设置天线功率:

命令:

 help:查看命令;

               version:查看版本信息;

               notices:查看license信息;

               quit:退出命令行界面;

        运行help,查看运行命令:




允许任意机器接入:

OpenBTS> config Control.LUR.OpenRegistration .*
Control.LUR.OpenRegistration changed from "" to ".*"

设置天线功率:

OpenBTS> devconfig GSM.Radio.RxGain 18
GSM.Radio.RxGain changed from "50" to "18"
GSM.Radio.RxGain is static; change takes effect on restart

设置基站频段:

OpenBTS> config GSM.Radio.Band 900
GSM.Radio.Band changed from "850" to "900"
GSM.Radio.Band is static; change takes effect on restart 

设置欢迎短信:

config Control.LUR.NormalRegistration.Message Welcome to BTS 1

设置基站名:

config GSM.Identity.ShortName GroundControl

将基站设置为测试网络:

config Identity config GSM.Identity.MCC 001

将基站设置为国内: MCC460 为中国

config GSM.Identity.MCC 460

设置运营商为联通:

config GSM.Identity.MNC 01 

设置运营商为移动:

config GSM.Identity.MNC 00 

设置ARFCN、LAC、BCC

网络色码,NCC,一般用于标识运营商;基站色码,BCC,区分同一运营商下的相同BCCH的不同基站。

一般采用BCCH频点和BSIC来联合标识小区,BSIC=NCC+BCC。在TD和WCDMA里,存在PLMN,PLMN=MCC+MNC,其中MCC为移动国家码,MNC为移动网络码标识运营商。

基站切换的时候,主要是通过CI、BCCHBSIC等信息寻找目标小区,当同时检测到邻区列表里出现同BCCH同扰码组的小区时,容易出现切换失败。

OpenBTS> config GSM.Radio.C0 168
GSM.Radio.C0 changed from "151" to "168"
GSM.Radio.C0 is static; change takes effect on restart
OpenBTS> config GSM.Identity.BSIC.BCC 3
GSM.Identity.BSIC.BCC changed from "2" to "3"
OpenBTS> config GSM.Identity.LAC 1001
GSM.Identity.LAC changed from "1000" to "1001"
OpenBTS> config GSM.Identity.CI 11
GSM.Identity.CI changed from "10" to "11"

用户管理

在3.4配置asterisk再我们给部分用户配置了callerid号码,启动OpenBTS后可通过NodeManager目录下的nmcli.py脚本进行用户管理:

cd sdr/dev/openbts/NodeManager/

添加用户示例:

nmcli.py脚本是Range提供的另外一种配置方式,其基于Json,而且据说商业版OpenBTS的Web管理界面就是使用这种方式来对OpenBTS进行配置的.


./nmcli.py sipauthserve subscribers create name imsi msisdn

将123456 (MSISDN码)分配到IMSI 码为46001658*****19的LG G3设备中

./nmcli.py sipauthserve subscribers create "LG G3" IMSI46001658*****19 123456

读取已录入信息:


nano@nano:~/sdr/dev/openbts/NodeManager$ ./nmcli.py sipauthserve subscribers read
raw request: {"command":"subscribers","action":"read","key":"","value":""}
raw response: {
	"code" : 200,
	"data" : [
		{
			"imsi" : "IMSI460010100001101",
			"msisdn" : "1101",
			"name" : "1101"
		},
		{
			"imsi" : "IMSI460010100001102",
			"msisdn" : "1102",
			"name" : "1102"
		}
	]
}

两台手机可以互相收发短信和语音拨打

查看接入的手机:


语音拨打后asterisk截图如下:




OpenBTS Usage

        对于OpenBTS的使用场景,大致有伪基站、安全研究以及系统原型的开发等,目前看到也有用来搭建OpenBTS来作为网关,进行GSM/GPRS来进行网络测试的,下面就简单介绍一下使用GSM手机注册入网以及短信、电话的功能。根据以上配置,将基站配置为900M频段,且ARCFN为1,开放注册,之后通过写卡器将测试白卡写信息,之后就可以使用手机注册入网了。
      手机开机首先进入设置->网络设置->移动网络->手动,搜寻网络,一般会搜索到PLMN所标识的网络或者基站所配置的名字:

        点击测试网络,然后会提示注册入网,然后会收到101所发送的短信,内容默认为:

                  Welcome to the test network,your IMSI is :<imsi>

        之后你可以回复想要为该手机使用的手机号码,比如1234567,要求为7-10位,这样相当于在基站侧注册完成,即phone number与IMSI绑定并写入了数据库;

       然后即可进行短信的发送以及电话的通信了:



OpenBT SIntroduction

        相信大家在启动OpenBTS的时候都在想“为什么OpenBTS需要使用以下的命令来进行启动与停止?”

               OpenBTS启动:

                   sudo start sipauthserve

                   sudo start smqueue

                   sudo start openbts

                   sudo start asterisk

              OpenBTS 停止:

                   sudo stop sipauthserve

                   sudo stop smqueue

                   sudo stop openbts

                   sudo stop asterisk

        原因很简单,那就是OpenBTS本身就是由几个开源软件共同组成的,而其中的openbts只是来根据3GPP标准进行几个软件功能的整合,如smqueue负责短信的发送,asterisk负责语音通话,而sipauthserve负责鉴权以及数据库的存储、sip协议等。


(1)       Asterisk 是负责处理SIM INVITE请求的VOIP 网关,其能够建立通话的各个分支,并将它们连接在一起

(2)       SIPAuthServe,即SIP Authorization Server,当手机试图接入OpenBTS时,由SIPAuthServe 处理SIP REGISTER请求;

(3)       SMQueue ,即SIP MESSAGE Queue,当手机发送短信的时候,由SMQueue 来处理SIP MESSAGE请求;

(4)       OpenBTS 首先负责和GSM空中接口的连接,即其余GSM终端通过空中接口进行通信,其次,OpenBTS将信息转化为SIP以及RTP信息,通过IP网络与以上几个部分进行通信,共同实现核心网的功能。

Summary

       好了,基于SDR系统的OpenBTS的安装、使用以及总体架构基本就讲完了,如果有问题,可以评论以及私下交流哦!2017年最后一天,记录我的分享!

程序运行命令集:

启动基站
执行 transceiver连接SDR硬件
cd sdr/dev/openbts/Transceiver52M
sudo ./transceiver

执行OpenBTS启动基站
cd sdr/dev/openbts/apps/
sudo ./OpenBTS


执行smqueue,启用短信服务
cd sdr/dev/smqueue/smqueue
sudo ./smqueue


执行sipauthserve,启用鉴权服务
cd sdr/dev/subscriberRegistry/apps
sudo ./sipauthserve


启动asterisk
sudo asterisk -vvvc or asterisk -r


启动OpenBTS终端控制台:
cd sdr/dev/openbts/apps
sudo ./OpenBTSCLI


允许任意机器接入:
OpenBTS> config Control.LUR.OpenRegistration .*
Control.LUR.OpenRegistration changed from "" to ".*"


设置天线功率:
OpenBTS> devconfig GSM.Radio.RxGain 18
GSM.Radio.RxGain changed from "50" to "18"
GSM.Radio.RxGain is static; change takes effect on restart


设置基站频段:
OpenBTS> config GSM.Radio.Band 900
GSM.Radio.Band changed from "850" to "900"
GSM.Radio.Band is static; change takes effect on restart


设置欢迎短信:
config Control.LUR.NormalRegistration.Message Welcome to BTS 1


设置基站名:
config GSM.Identity.ShortName GroundControl


将基站设置为测试网络:
config Identity config 
config GSM.Identity.MCC 001


将基站设置为国内: MCC460 为中国
config GSM.Identity.MCC 460


设置运营商为联通:
config GSM.Identity.MNC 01 
设置运营商为移动:
config GSM.Identity.MNC 00


用户管理
在3.4配置asterisk再我们给部分用户配置了callerid号码,启动OpenBTS后可通过NodeManager目录下的nmcli.py脚本进行用户管理:


cd sdr/dev/openbts/NodeManager/
添加用户示例:


./nmcli.py sipauthserve subscribers create name imsi msisdn
将123456 (MSISDN码)分配到IMSI 码为46001658*****19的LG G3设备中


./nmcli.py sipauthserve subscribers create "LG G3" IMSI46001658*****19 123456
读取已录入信息:
root@0xroot:/home/init3/sdr/dev/openbts/NodeManager#./nmcli.py sipauthserve subscribers read


Reference

[1] http://www.cnblogs.com/k1two2/p/6272278.html

[2] http://10.3.200.202/cache/6/03/openbts.org/8ee39f4e2a2b1f95faa515e6aff2e1ee/OpenBTS-4.0-Manual.pdf

[3]  http://10.3.200.202/cache/12/03/openbts.org/a12b56e1612327060d6f3567cbc676da/Getting_Started_with_OpenBTS_Range_Networks.pdf
[4] https://cn0xroot.com/tag/openbts/
[5] http://blog.sina.com.cn/s/blog_d2d340970102vffo.html


猜你喜欢

转载自blog.csdn.net/xrh003/article/details/79447468
今日推荐