本文以Ubuntu 16.04.3 LTS 为例,硬件环境为core i7 6500U,16GB DDR3@1600
…广告:…
2019年OAI workshop将在北京举办,会议注册现已开放:http://oaiws2019.mikecrm.com/ESouuhz
欢迎参加本次峰会。
OAI接入网搭建:https://blog.csdn.net/BUPTOctopus/article/details/81561607
srsLTE搭建:https://blog.csdn.net/BUPTOctopus/article/details/82997806
OAI核心网最新(2019.1)develop分支搭建:
https://blog.csdn.net/BUPTOctopus/article/details/85932474
(已支持多MME,多基站及X2切换等)
OAI接入网5G NR分支(2019.3,暂未完善)搭建:
sudo apt-get install linux-lowlatency
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
sudo apt-get install cpufrequtils
sudo vi /etc/default/cpufrequtils
添加:GOVERNOR="performance"
sudo update-rc.d ondemand disable
sudo /etc/init.d/cpufrequtils restart
cpufreq-info
#查看睿频是否成功关闭(频率变动极小)
sudo vi /etc/default/grub
#在末尾添加:
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 vi /etc/modprobe.d/blacklist.conf
#在末未添加:(将Intel的电源管理加入黑名单)
blacklist intel_powerclamp
sudo reboot
2018.9更新:
./check_mme_s6a_certificate /usr/local/etc/oai/freeDiameter/ hostname.openair4G.eur
需要修改hostname2018.12更新:
接入网连接核心网出现sctp refused 111 错误的原因:linux内核bug,更换4.15.2.*内核可解决。
cat /etc/hostname
sudo vim /etc/hosts
127.0.0.1 localhost
127.0.1.1 yourhostname.openair4G.eur yourhostname
127.0.1.1 hss.openair4G.eur hss
sudo apt-get update
sudo apt-get install subversion git
echo -n | openssl s_client -showcerts -connect gitlab.eurecom.fr:443 2>/dev/null | sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p' | sudo tee -a /etc/ssl/certs/ca-certificates.crt
git config --global http.sslverify false
//新版
sudo git clone https://github.com/OPENAIRINTERFACE/openair-cn.git
//史前的旧版
#git clone https://gitlab.eurecom.fr/oai/openair-cn.git
//2018.08.16测试可用的版本,但不推荐使用
#sudo git clone https://github.com/herlesupreeth/openair-cn-new
### ↑使用develop分支,手动安装apache2和php7.0,并用openair-cn分支的配置文件和run_hss来装数据库。对接华为基站测试完成。
cd openair-cn
sudo git checkout v0.5.0
//较老,功能少,但稳定,develop分支见另一篇
sudo git pull
sudo mkdir -p /usr/local/etc/oai/freeDiameter
sudo cp ~/openair-cn/etc/mme.conf /usr/local/etc/oai
sudo cp ~/openair-cn/etc/hss.conf /usr/local/etc/oai
sudo cp ~/openair-cn/etc/spgw.conf /usr/local/etc/oai
sudo cp ~/openair-cn/etc/acl.conf /usr/local/etc/oai/freeDiameter
sudo cp ~/openair-cn/etc/mme_fd.conf /usr/local/etc/oai/freeDiameter
sudo cp ~/openair-cn/etc/hss_fd.conf /usr/local/etc/oai/freeDiameter
cd ~/openair-cn/scripts
sudo ./check_hss_s6a_certificate /usr/local/etc/oai/freeDiameter/ hss.openair4G.eur
sudo ./check_mme_s6a_certificate /usr/local/etc/oai/freeDiameter/ hostname.openair4G.eur
注意:
1、修改hostname
2、在某些服务器上可能出现这两个check脚本并没有正确执行的问题,将导致证书错误无法运行hss和mme,请检查/usr/local/etc/oai/freeDiameter目录下hss.cert.pem和mme.cert.pem等文件是否是新生成的,如果不是手动删除掉这两个文件然后再次执行上述./check命令。
cd openair-cn
sudo git checkout v0.5.0 #新版
sudo git pull
cd scripts
sudo ./build_hss -i
注1: -i 表示安装missing packages,一般运行一次 -i即可
注2: 可以在openair-cn/build/tools/build_helper 中添加对于Ubuntu18.04的支持
注3: 在运行./build_hss -i 时会安装MySQL和pypmyadmin。一般设置MySQL的用户名为 root ,密码为 linux ; phpmyadmin 的用户名为 root ,密码为 linux.安装成功后在浏览器中输入: http://127.0.0.1/phpmyadmin
如果成功安装MySQL和phpmyadmin的话,便可以输入phpmyadmin的用户名和密码访问数据库。
如果访问不成功,运行命令:
sudo apt-get install phpmyadmin
sudo ln -s /etc/phpmyadmin/apache.conf /etc/apache2/conf-available/phpmyadmin.conf
sudo a2enconf phpmyadmin
sudo /etc/init.d/apache2 reload
此时,应该就能访问了。
sudo vim /usr/local/etc/oai/hss.conf
@MYSQL_user@改为你的用户名(比如root)
@MYSQL_pass@改为你的密码(比如linux)
cd ~/openair-cn
cd scripts
sudo ./build_hss -c
sudo ./run_hss -i ~/openair-cn/src/oai_hss/db/oai_db.sql
(上面这步会安装数据库,不要多次运行,再次运行会重装数据库)
mmeidentity 里添加yourhostname.openair4G.eur项
users里修改imsi=208930100001111的key值为8baf473f2f8fd09487cccbd7097c6862
users里修改OPc为e734f8734007d6c5ce7a0508809e7e9c
同时修改它的mmeidentity_idmmeidentity为你刚刚在mmeidentity里添加的新项的ID。
或者用命令行:(key是mysql的关键字,好奇前辈是怎么写进去的……)
sudo mysql -u root -p
use oai_db;
select * from mmeidentity;
update mmeidentity set mmehost="kujou.openair4G.eur" where idmmeidentity=6;
update users set mmeidentity_idmmeidentity=6 where imsi=208930100001111;
sudo vim /usr/local/etc/oai/mme.conf
在NETWORK_INTERFACS
中将MME_INTERFACE_NAME_FOR_S1_MME
网卡和IP改为自己的;
下面的MME_INTERFACE_NAME_FOR_S11_MME
网卡用lo
,地址改为自己的。
sudo vim /usr/local/etc/oai/freeDiameter/mme_fd.conf
将identity
的yang.openair4G.eur 改为yourhostname
.openair4G.eur
sudo ./build_mme -i
sudo ./build_mme -c
sudo ./run_mme
MME运行结果:
注意,如果mme的IP没有配置正确,会报以下错误:
sudo vim /usr/local/etc/oai/spgw.conf
同理,SGW_IPV4_ADDRESS_FOR_S1U_S12_S4_UP改成自己的。
PGW_INTERFACE改成自己的。
PGW_MASQUERADE_SGI改为yes。
注意: 172.16.0.0/12自己可以不用修改,这是用来后面给UE动态分配IP用的
sudo ./build_spgw -i
sudo ./build_spgw -c
sudo ./run_spgw
SPGW运行结果(得先运行HSS)
#!/bin/sh
YOURNAME='kujou'
while :
do
stillRunning=$(ps -A | grep "run_hss" |grep -v "grep")
if [ "$stillRunning" ] ; then
echo "HSS was already started by another way"
else
pkill -9 hss
pkill -9 mme
pkill -9 spgw
echo "HSS was not started"
echo "Starting service ..."
/home/$YOURNAME/openair-cn/scripts/run_hss &
fi
sleep 2
stillRunning=$(ps -A | grep "run_mme" |grep -v "grep")
if [ "$stillRunning" ] ; then
echo "MME was already started by another way"
else
pkill -9 hss
pkill -9 mme
pkill -9 spgw
echo "MME was not started"
echo "Starting service ..."
/home/$YOURNAME/openair-cn/scripts/run_mme &
fi
sleep 2
stillRunning=$(ps -A | grep "run_spgw" |grep -v "grep")
if [ "$stillRunning" ] ; then
echo "SPGW was already started by another way"
else
pkill -9 hss
pkill -9 mme
pkill -9 spgw
echo "SPGW was not started"
echo "Starting service ..."
/home/$YOURNAME/openair-cn/scripts/run_spgw &
fi
sleep 6
done
一键关闭核心网的脚本
#!/bin/bash
sudo pkill -9 hss
sudo pkill -9 mme
sudo pkill -9 spgw
sudo ps -A | grep hss
sudo ps -A | grep mme
sudo ps -A | grep spgw