基于OAI平台的核心网+gNB+UE的搭建

核心网搭建:

视频OAI(Open Air Interface)开源5G核心网部署方案_哔哩哔哩_bilibili
资料:含有核心网部署PDF,UERANSIM,WpcapSrc压缩包等,视频中测试需要的工具。
链接https://pan.baidu.com/s/1SMQ2Kwo7-pSpXLwxctG3zg
提取码:y6gp

gNB和UE搭建:

1. 系统准备

参考网址:https://gitlab.eurecom.fr/oai/openairinterface5g/-/blob/develop/doc/BUILD.md

  1. 安装ubuntu18.04
  2. 安装设置低延时内核
sudo apt-get install linux-image-`uname -r | cut -d- -f1-2`-lowlatency 
sudo apt-get install linux-headers-`uname -r | cut -d- -f1-2`-lowlatency
sudo reboot
  1. CPU超频设置
    (1) 安装运维工具方便后续对配置文件修改等操作
sudo apt-get install git vim openssh-server i7z subversion cmake

(2) 检查是否加载了 GTP 内核模块

uname -a

#临时加载 gtp 模块

sudo modprobe gtp
dmesg | tail # You should see something that says about GTP kernel module
  # e.g.
  # [  111.364332] gtp: GTP module loaded (pdp ctx size 104 bytes)

(3) 禁用 Intel CPUP-state 驱动,这个是 Intel CPU 专用的频率调节器驱动

sudo gedit /etc/default/grub 
#修改以下内容
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"
GRUB_CMDLINE_LINUX_DEFAULT="quiet intel_pstate=disable"
GRUB_CMDLINE_LINUX_DEFAULT="quiet processor.max_cstate=1 intel_idle.max_cstate=0 idle=poll"
  
#更新
sudo update-grub

(4) 将 intel_powerclamp(Intel 电源管理驱动程序)加入黑名单:

sudo gedit /etc/modprobe.d/blacklist.conf
末尾添加
blacklist intel_powerclamp
reboot

(5) 关闭 CPU 睿频

sudo apt-get install cpufrequtils
sudo gedit /etc/default/cpufrequtils
  ...
GOVERNOR="performance"

sudo update-rc.d ondemand disable

sudo /etc/init.d/cpufrequtils restart

查看睿频是否成功关闭,会看到所有频率都在 C0%

如果出现错误:update-rc.d: error: cannot find a LSB script for ondemand

则用下面代码:

sudo /etc/init.d/cpufrequtils restart

systemd reboot

sudo /etc/init.d/cpufrequtils restart

查看是否成功:

sudo cat /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor

显示performance则设置成功。

2. 安装和构建gNB

下载OAI开源代码到当前目录

sudo git clone https://gitlab.eurecom.fr/oai/openairinterface5g.git

进入代码目录

cd  <your oai installation directory>/openairinterface5g/

确保当前位于develop分支 git checkout -f develop

sudo git checkout develop

激活虚拟环境

source oaienv
cd cmake_targets

编译USRP驱动和依赖,此步骤可能需要科学上网

#for OAI first time installation only to install software dependencies
sudo ./build_oai -I -w USRP

成功截图:
在这里插入图片描述

参考网址:https://gitlab.eurecom.fr/oai/openairinterface5g/-/blob/develop/doc/NR_SA_Tutorial_OAI_nrUE.md

gNB端:

修改gnb配置文件

cd openairinterface5g/targets/PROJECTS/GENERIC-NR-5GC/CONF
sudo gedit gnb.sa.band78.fr1.106PRB.usrpb210.conf

#修改tracking_area_codemccmnc为核心网对应数据,核心网数据在

oai-cnfg-fed/docker-compose/ docker-compose-mini-nrf.yuml

在这里插入图片描述

#修改amf_ip_addressNETWORK_INTERFACES参数
在这里插入图片描述

amf_ip_addressIPV4amf的地址
NETWORK_INTERFACES下面是基站的网口名字和IP地址

修改UE参数

修改 ue.conf 参数,同时在核心网端要执行对应操作(这个核心网操作每一次都重启了核心网后都需要执行),注意参数要匹配。
在这里插入图片描述

参考网址:https://gitlab.eurecom.fr/oai/cn5g/oai-cn5g-fed/-/blob/robot_based_tutorial_check/docs/DEPLOY_SA5G_MINI_DEPLOYMENT.md

编译:

cd OAI/openairinterface5g/cmake_targets
sudo ./build_oai --gNB --nrUE -w SIMU

运行:

  1. 首先需要保证核心网主机和gNB主机在同一个局域网下,比如连在同一个路由器或者交换机下,即两台主机之间可以互相ping通,建议使用网线链接主机和路由器。
  2. 如果能够ping通之后,就要在gNB的主机上添加路由转发
    gNB侧增加路由:sudo ip route add 192.168.70.128/26 via 192.168.105.179 dev enps20;

其中192.168.70.128/26是核心网通过docker 创建的网桥的地址,一般如果不修改docker file的参数,这个不用改.
192.168.105.179是核心网主机的地址
enps20是有线网卡的名字
另外注意一下添加路由的命令是一次性,即在关机重启之后就失效了,需要重新添加。

  1. 在核心网主机上设置网络参数
sudo sysctl net.ipv4.conf.all.forwarding=1
sudo iptables -P FORWARD ACCEPT

#同样要注意以上的命令也是一次性的,重启之后就需要重新添加。

  1. 分别设置完两台主机的参数后就可以测试一下,先把核心网主机的核心网启动起来,之后通过gNB主机来ping核心网中的各个容器。
    在这里插入图片描述

  2. 以上没有问题后启动gNB

cd OAI/openairinterface5g/cmake_targets/ran_build/build/

sudo ./nr-softmodem -O ../../../targets/PROJECTS/GENERIC-NR-5GC/CONF/my-gnb.sa.band78.fr1.106PRB.usrpb210.conf --gNBs.[0].min_rxtxtime 6 --sa -E --continuous-tx

成功截图:
在这里插入图片描述

  1. 启动UE
sudo ./nr-uesoftmodem -r 106 --band 78 -C 3619200000 --ue-fo-compensation --sa -E -O ../../../targets/PROJECTS/GENERIC-NR-5GC/CONF/my-ue.conf --nokrnmod 1 --numerology 1

在这里插入图片描述

  1. 在UE端检测虚拟网口

在这里插入图片描述

具体的流程和他的功能可以查看下面链接:
https://gitlab.eurecom.fr/oai/openairinterface5g

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值