单树莓派/双树莓派+srsLTE+USRP搭建4G LTE微基站

实验环境:

Name System UHD srsLTE
电脑1 Ubuntu18.04.4 LTS Desktop x86-64 3.15.LTS 20_04_01
树莓派3B Ubuntu18.04.4 LTS for Raspi3 arm64 3.15.LTS 20_04_01
树莓派4B Ubuntu18.04.4 LTS for Raspi3 arm64 3.15.LTS 20_04_01

一、添加SIM卡的配置信息

SIM卡的信息如下:

修改~/.config/srslte/user_db.csv文件:

在这里插入图片描述

格式为(ue_name),(imsi),(K),(OP/OPc_type),(OP/OPc_value),(AMF),(SQN),(QCI),仿照原文件中的例子进行修改,最后两持不变。倒数第三项被红色画笔涂亮的部分一开始我设置的是1234,后来在运行过程中被程序自动修改。

二、修改enb配置信息

sudo vim ~/.config/srslte/enb.conf

其中mccmnc与手机的接入点(APN)设置相同,mme_addr设置为树莓派的IP地址,gtp_bind_addrs1c_bind_addr改为电脑的IP地址,dl_earfcn需要根据具体情况设置不同的频点号,我这里设置为1500。
在这里插入图片描述
在这里插入图片描述

三、修改epc配置信息

sudo vim ~/.config/srslte/epc.conf

其中mccmnc与手机的接入点(APN)设置相同,mme_addr设置为树莓派的IP地址,gtpu_bind_addr改为树莓派上可以上网的IP地址。这里我通过sudo ifconfig eth0:gtp 192.168.2.111/24 up开启了一个虚拟网口,gtpu_bind_addr也可以直接改为与mme_bind_addr相同的IP地址。
在这里插入图片描述
在这里插入图片描述

四、修改手机SIM卡配置信息

此处以小米手机为例,进入设置->双卡和移动网络->选择对应的SIM卡->接入点名称(APN)->新建APN,名称APN都改为srsapnMCC 改为460MNC改为 11,修改完成后返回保存即可。

五、树莓派运行srsepc,电脑1运行srsenb

连接示意图

进行灌包测试,必要的设置如下:

#在树莓派(运行srsepc)上设置手机上网的接口
ifconfig  #查看网络接口
sudo srsepc_if_masq.sh eth0  #选择能上网的接口进行伪装,此处为eth0
#在电脑1(运行srsenb)上设置路由信息使得电脑1能ping到测试手机
sudo route add -host 172.16.0.2 gw 192.168.2.104  #临时添加路由信息,其中172.16.0.2为测试手机的IP地址,192.168.2.104为树莓派的IP地址
route -n #查看路由信息
#在测试手机上
设置->双卡和移动网络->SIM卡信息.中国电信->运营商网络设置.接入点名称(APN)->新建APN,名称:srsapn,APN:srsapn,MCC:460,MNC:11,设置好后保存,然后选择此APN。
在epc和enb建立连接后,打开飞行模式再关闭飞行模式,再打开数据流量。
测试手机和电脑2通过USB连接,需要在手机上开启USB网络共享,或者开启热点无线连接,只要电脑2能ping通电脑1就行。

1.下行灌包测试

电脑1选择Client模式,Server address填手机的IP,传输时间选择60s,传输层选择UDP,带宽100MB/s,包尺寸1KB。

本来应该是电脑1作为CLient,电脑2作为Server。然后手机连电脑2并且开启USB网络共享,然后电脑1的Server address填电脑2的IP,电脑2开启软件选择Server模式。这里由于电脑2驱动无法安装的问题无法通过USB共享网络,只能通过测试手机的热点进行连接。但是这样连接电脑2可以ping到电脑1,但是电脑1 ping不到电脑2,暂未解决。

在这里插入图片描述

2.上行灌包测试

电脑2作为Client,电脑1作为Server。

电脑2配置与下行灌包的Client设置相同;

电脑1选择Server模式,Output Format选择MBits,传输层选择UDP。

经测试,对于同一个手机Redmi 4,在电脑运行srsenb,树莓派运行srsepc的情况下,树莓派3B与4B的效果相同,在手机上测得的最高速率均为下行36.52Mbps,上行13.42Mbps。

六、树莓派4B运行srsenb,树莓派3B运行srsepc

使用新的参数后解决

开启性能模式:

sudo systemctl disable ondemand
nano /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor  #查看是否进入性能模式,若都为performance则成功

修改enb.conf:

sudo nano /root/.config/srslte/enb.conf

[enb]
mcc = <yourMCC>
mnc = <yourMNC>
mme_addr = 127.0.1.100     ## or IP for external MME, eg. 192.168.1.10
gtp_bind_addr = 127.0.1.1  ## or local interface IP for external S1-U, eg. 192.168.1.3
s1c_bind_addr = 127.0.1.1  ## or local interface IP for external S1-MME, eg. 192.168.1.3
n_prb = 15
tm = 2
nof_ports = 2

[rf]
dl_earfcn = 1934
tx_gain = 80               ## this power seems to work best
rx_gain = 40
device_name = UHD
device_args = auto         ## does not work with anything other than 'auto'

修改epc.conf:

sudo nano /root/.config/srslte/epc.conf

[mme]
mcc = <yourMCC>
mnc = <yourMNC>
mme_bind_addr = 127.0.1.100  ## or local interface IP for external S1-MME, eg. 192.168.1.10

修改user_db.csv

运行epc的设备需要打开进入防火墙的端口以允许srsenb进行S1-MME和S1-U连接:

S1-MME = sctp, port 36412 || S1-U = udp, port 2152

或者使用iptables命令:

sudo iptables -A INPUT -p sctp -m sctp --dport 36412 -j ACCEPT
sudo iptables -A INPUT -p udp -m udp --dport 2152 -j ACCEPT

1.下行灌包测试

2.上行灌包测试


七、LTE载波频率和载波频点号

参考:LTE Carrier Frequency and EARFCN

  • Fdownlink=FDLLow+0.1(NDL−NDLOffset)Fdownlink=FDLLow+0.1(NDL-NDLOffset)
  • Fuplink=FULLow+0.1(NUL−NULOffset)

where,

NDL = downlink EARFCN
NUL = uplink EARFCN
NDLoffset = offset used to calculate downlink EARFCN
NULoffset = offset used to calculate uplink EARFCN

EARFCN of carrier frequency can be calculated with Eq-(1) or Eq-(2) using FDL_low, NOffs-DL, FUL_low and NOffs-UL given in table below.

Downlink Uplink
Band FDL_low (MHz) NOffs-DL NDL Range FUL_low (MHz) NOffs-UL NUL Range
1 2110 0 0-599 1920 18000 18000-18599
2 1930 600 600-1199 1850 18600 18600-19199
3 1805 1200 1200-1949 1710 19200 19200-19949
4 2110 1950 1950-2399 1710 19950 19950-20399
5 869 2400 2400-2649 824 20400 20400-20649
6 875 2650 2650-2749 830 20650 20650-20749
7 2620 2750 2750-3449 2500 20750 20750-21449
8 925 3450 3450-3799 880 21450 21450-21799
9 1844.9 3800 3800-4149 1749.9 21800 21800-22149
10 2110 4150 4150-4749 1710 22150 22150-22749
11 1475.9 4750 4750-4949 1427.9 22750 22750-22949
12 729 5010 5010-5179 699 23010 23010-23179
13 746 5180 5180-5279 777 23180 23180-23279
14 758 5280 5280-5379 788 23280 23280-23379
17 734 5730 5730-5849 704 23730 23730-23849
18 860 5850 5850-5999 815 23850 23850-23999
19 875 6000 6000-6149 830 24000 24000-24149
20 791 6150 6150-6449 832 24150 24150-24449
21 1495.9 6450 6450-6599 1447.9 24450 24450-24599
22 3510 6600 6600-7399 3410 24600 24600-25399
23 2180 7500 7500-7699 2000 25500 25500-25699
24 1525 7700 7700-8039 1626.5 25700 25700-26039
25 1930 8040 8040-8689 1850 26040 26040-26689
26 859 8690 8690-9039 814 26690 26690-27039
27 852 9040 9040-9209 807 27040 27040-27209
28 758 9210 9210-9659 703 27210 27210-27659
292 717 9660 9660-9769 N/A
31 462.5 9870 9870-9919 452.5 27760 27760-27809
33 1900 36000 36000-36199 1900 36000 36000-36199
34 2010 36200 36200-36349 2010 36200 36200-36349
35 1850 36350 36350-36949 1850 36350 36350-36949
36 1930 36950 36950-37549 1930 36950 36950-37549
37 1910 37550 37550-37749 1910 37550 37550-37749
38 2570 37750 37750-38249 2570 37750 37750-38249
39 1880 38250 38250-38649 1880 38250 38250-38649
40 2300 38650 38650-39649 2300 38650 38650-39649
41 2496 39650 39650-41589 2496 39650 39650-41589
42 3400 41590 41590-43589 3400 41590 41590-43589
43 3600 43590 43590-45589 3600 43590 43590-45589
44 703 45590 45590-46589 703 45590 45590-46589

猜你喜欢

转载自blog.csdn.net/L_786795853/article/details/107684420