OAI 搭建文档

[draft] 更新于2020年6月25日

0. OAI 项目结构

整个 OAI 系统分为如下三个部分,需要分别配置在不同机器上。

  1. EPC(官方文档也称为 Core Network)
  2. eNB(官方文档将其与 UE 合称为 RAN)
  3. UE(官方文档将其与 eNB 合称为 RAN)

最初三个组件位于同一 GitLab Eurecom server,后来 EPC 组件拆分出来,不再维护的旧版仍在 GitLab Eurecom server 且拆分为两个仓库,新版位于 GitHub。

EPC 组件文档:https://github.com/OPENAIRINTERFACE/openair-cn/wiki

RAN 组件文档:https://gitlab.eurecom.fr/oai/openairinterface5g/-/wikis/home

0.1. OAI 网络结构示意图

https://raw.githubusercontent.com/wiki/OPENAIRINTERFACE/openair-cn-cups/pictures/oai_epc_all_in_one_cups_spgw.png

oai_epc_all_in_one_cups_spgw

1. EPC 配置

对于 EPC(Core Network),旧版存在于 GitLab Eurecom server,由于不计划使用不再做介绍。新版存在于 GitHub:https://github.com/OPENAIRINTERFACE/openair-cn ,文档在该项目的 WiKi:https://github.com/OPENAIRINTERFACE/openair-cn/wiki

官方文档在 Ubuntu 主机上使用 uvtool 安装 Ubuntu 18.04 LTS 虚拟机进行部署( https://github.com/OPENAIRINTERFACE/openair-cn/wiki/OpenAirSoftwareSupport ),本文档在 macOS 主机上使用 Parallel Desktop 安装 Ubuntu 18.04 LTS 虚拟机进行部署测试。

注意硬件要求,官方文档中虚拟机是 2 CPU 4GB 内存。

EPC 组件版本:openair-cn 使用 commit d1d0e45,openair-cn-cups 使用 commit 5ca3839

1.1. Download EPC source code

1.1.1. Install curl git

sudo apt install curl git

1.1.2. Get source code

cd ~
git clone https://github.com/OPENAIRINTERFACE/openair-cn.git
git clone https://github.com/OPENAIRINTERFACE/openair-cn-cups.git

1.2. Install HSS

1.2.1. Modify script

sudo gedit ~/openair-cn/build/tools/build_helper.cassandra

$SUDO $INSTALLER install $OPTION curl oracle-java8-installer

改为

$SUDO $INSTALLER install $OPTION curl openjdk-8-jre

curl https://www.apache.org/dist/cassandra/KEYS | $SUDO apt-key add -

改为

curl https://downloads.apache.org/cassandra/KEYS | $SUDO apt-key add -

1.2.2. Build Cassandra

cd ~/openair-cn/scripts/
./build_cassandra --check-installed-software --force

1.2.3. Set the JRE version 8 as default

sudo service cassandra stop
sudo update-alternatives --config java
# select jre version 8
...
sudo service cassandra start

在其中第二行,有可能输出类似如下,则表示只有一个 JRE 版本,不需要再设置默认版本

There is only one alternative in link group java (providing /usr/bin/java): /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java
Nothing to configure.

1.2.4. Verify that Cassandra is installed and running

nodetool status

输出应类似如下:

Datacenter: datacenter1
=======================
Status=Up/Down
|/ State=Normal/Leaving/Joining/Moving
--  Address    Load       Tokens  Owns (effective)  Host ID                               Rack
UN  127.0.0.1  51.69 KB   256     100.0%            fa761e10-4118-4a99-9a2e-829e7cdd8e82  rack1

1.2.5. Modify Cassandra configuration

Stop Cassandra and cleanup the log files before modifying the configuration

sudo service cassandra stop
sudo rm -rf /var/lib/cassandra/data/system/*
sudo rm -rf /var/lib/cassandra/commitlog/*
sudo rm -rf /var/lib/cassandra/data/system_traces/*
sudo rm -rf /var/lib/cassandra/saved_caches/*

修改文件,也可以使用其他编辑器如 vim

sudo gedit /etc/cassandra/cassandra.yaml

改为如下所示,修改“…”间对应的部分, 替换为 HSS 将要连接的 Cassandra 服务器地址,在本教程情况下使用本机地址(127.0.0.1)

...
cluster_name: 'HSS Cluster'
...
# OAI Note: no to change Cassandra_Server_IP that is already 127.0.0.1
seed_provider:
- class_name: org.apache.cassandra.locator.SimpleSeedProvider
- seeds: "<Cassandra_Server_IP>"
...
listen_address: <Cassandra_Server_IP>
...
rpc_address: <Cassandra_Server_IP>
...
# OAI Note: seems to be this option that is working ()
# endpoint_snitch: SimpleSnitch
endpoint_snitch: GossipingPropertyFileSnitch
...

启动 Cassandra

sudo service cassandra start

确认 Cassandra 服务状态

sudo systemctl status cassandra

输出类似如下

● cassandra.service - LSB: distributed storage system for structured data
   Loaded: loaded (/etc/init.d/cassandra; generated)
   Active: active (running) since Thu 2019-05-23 10:26:51 UTC; 1h 54min ago
     Docs: man:systemd-sysv-generator(8)
    Tasks: 61 (limit: 4704)
   CGroup: /system.slice/cassandra.service
           └─23863 java -ea -javaagent:/usr/share/cassandra/lib/jamm-0.3.0.jar -XX:+CMSClassUnloadingEnabled -XX:+UseThreadPri

May 23 10:26:51 test-install-openair-cn systemd[1]: Starting LSB: distributed storage system for structured data...
May 23 10:26:51 test-install-openair-cn systemd[1]: Started LSB: distributed storage system for structured data.

确认完毕使用快捷键 ctrl + c 结束状态查询

1.2.6. Install HSS software dependancies

./build_hss_rel14 --check-installed-software --force

需要一些时间,成功输出类似如下:

...
-- Installing: /usr/local/lib/cmake/pistache/PistacheConfig.cmake
~/openair-cn/scripts
HSS software installation successful
HSS not compiled, to compile it, re-run build_hss without -i option

1.2.7. Build HSS

./build_hss_rel14 --clean

成功输出类似如下:

mkdir: created directory '/home/ubuntu/openair-cn/scripts/../build/hss_rel14/build'
~/openair-cn/build/hss_rel14/util ~/openair-cn/scripts
...
 g++  -g -pthread -std=c++11  -I ../../src/hss_rel14/include -I ../../src/hss_rel14/util/include -I ../../build/hss_rel14/../git_submodules/rapidjson/include -I /usr/local/include/freeDiameter -I ../../src/hss_rel14/hsssec/include -I /usr/local/include -MMD -c -o ../../build/hss_rel14/build/s6t_impl.o ../../src/hss_rel14/src/s6t_impl.cpp
 Linking...
 g++  -g -pthread -lpthread -Wl,-rpath,/usr/local/lib/x86_64-linux-gnu:/usr/local/lib ../../build/hss_rel14/build/s6t.o ../../build/hss_rel14/build/s6as6d_impl.o ../../build/hss_rel14/build/dataaccess.o ../../build/hss_rel14/build/s6as6d.o ../../build/hss_rel14/build/options.o ../../build/hss_rel14/build/s6c_impl.o ../../build/hss_rel14/build/fdhss.o ../../build/hss_rel14/build/s6c.o ../../build/hss_rel14/build/main.o ../../build/hss_rel14/build/util.o ../../build/hss_rel14/build/resthandler.o ../../build/hss_rel14/build/s6t_impl.o -o ../../build/hss_rel14/bin/hss ../../build/hss_rel14/util/lib/libc3po.a ../../build/hss_rel14/hsssec/lib/libhsssec.a /usr/local/lib/libpistache.a /usr/local/lib/libfdcore.so /usr/local/lib/libfdproto.so -L/usr/local/lib/x86_64-linux-gnu -lcassandra -lrt -lnettle -lgmp 
'/home/ubuntu/openair-cn/build/hss_rel14/bin/hss' -> '/usr/local/bin/oai_hss'
oai_hss installed

1.2.8. Populate users table

配置自己的用户参数,这里使用默认值,依次运行如下命令

Cassandra_Server_IP='127.0.0.1'

cqlsh --file ../src/hss_rel14/db/oai_db.cql $Cassandra_Server_IP

./data_provisioning_users --apn default.ng4T.com --apn2 internet --key fec86ba6eb707ed08905757b1bb44b8f --imsi-first 208931234561000 --msisdn-first 001011234561000 --mme-identity mme.ng4T.com --no-of-users 20 --realm ng4T.com --truncate True  --verbose True --cassandra-cluster $Cassandra_Server_IP

输出类似如下:

INFO:root:208931234561005 1011234561005 41 fec86ba6eb707ed08905757b1bb44b8f mme.ng4T.com 3 ng4T.com 2683b376d1056746de3b254012908e0e 96 &#123;"Subscription-Data":&#123;"Access-Restriction-Data":41,"Subscriber-Status":0,"Network-Access-Mode":2,"Regional-Subscription-Zone-Code":["0x0123","0x4567","0x89AB","0xCDEF","0x1234","0x5678","0x9ABC","0xDEF0","0x2345","0x6789"],"MSISDN":"0x1011234561005","AMBR":&#123;"Max-Requested-Bandwidth-UL":50000000,"Max-Requested-Bandwidth-DL":100000000&#125;,"APN-Configuration-Profile":&#123;"Context-Identifier":0,"All-APN-Configurations-Included-Indicator":0,"APN-Configuration":&#123;"Context-Identifier":0,"PDN-Type":0,"Service-Selection":"default.ng4T.com","EPS-Subscribed-QoS-Profile":&#123;"QoS-Class-Identifier":9,"Allocation-Retention-Priority":&#123;"Priority-Level":15,"Pre-emption-Capability":0,"Pre-emption-Vulnerability":0&#125;&#125;,"AMBR":&#123;"Max-Requested-Bandwidth-UL":50000000,"Max-Requested-Bandwidth-DL":100000000&#125;,"PDN-GW-Allocation-Type":0,"MIP6-Agent-Info":&#123;"MIP-Home-Agent-Address":["172.26.17.183"]&#125;&#125;,"APN-Configuration":&#123;"Context-Identifier":0,"PDN-Type":0,"Service-Selection":"internet","EPS-Subscribed-QoS-Profile":&#123;"QoS-Class-Identifier":9,"Allocation-Retention-Priority":&#123;"Priority-Level":13,"Pre-emption-Capability":1,"Pre-emption-Vulnerability":0&#125;&#125;,"AMBR":&#123;"Max-Requested-Bandwidth-UL":50000000,"Max-Requested-Bandwidth-DL":100000000&#125;,"PDN-GW-Allocation-Type":0,"MIP6-Agent-Info":&#123;"MIP-Home-Agent-Address":["172.26.17.183"]&#125;&#125;&#125;,"Subscribed-Periodic-RAU-TAU-Timer":0&#125;&#125;

...
INFO:root:1011234561007 208931234561007
INFO:root:1011234561002 208931234561002
INFO:root:1011234561009 208931234561009
INFO:root:1011234561005 208931234561005
INFO:root:1011234561014 208931234561014
INFO:root:1011234561011 208931234561011
INFO:root:1011234561003 208931234561003
INFO:root:1011234561016 208931234561016
INFO:root:1011234561015 208931234561015
INFO:root:1011234561010 208931234561010
INFO:root:1011234561008 208931234561008
INFO:root:1011234561013 208931234561013
INFO:root:1011234561018 208931234561018
INFO:root:1011234561017 208931234561017
INFO:root:1011234561006 208931234561006
INFO:root:1011234561019 208931234561019
INFO:root:1011234561012 208931234561012
INFO:root:1011234561001 208931234561001
INFO:root:1011234561000 208931234561000
INFO:root:1011234561004 208931234561004
DEBUG:cassandra.io.libevreactor:Closing connection (140287699882392) to 127.0.0.1
DEBUG:cassandra.io.libevreactor:Closed socket to 127.0.0.1
DEBUG:cassandra.io.libevreactor:Closing connection (140287699883512) to 127.0.0.1
DEBUG:cassandra.io.libevreactor:Closed socket to 127.0.0.1
DEBUG:cassandra.io.libevreactor:Waiting for event loop thread to join...
DEBUG:cassandra.io.libevreactor:All Connections currently closed, event loop ended
DEBUG:cassandra.io.libevreactor:Event loop thread was joined
DEBUG:cassandra.cluster:Shutting down Cluster Scheduler
DEBUG:cassandra.cluster:Shutting down control connection

运行如下命令

./data_provisioning_mme --id 3 --mme-identity mme.ng4T.com --realm ng4T.com --ue-reachability 1 --truncate True  --verbose True -C $Cassandra_Server_IP

输出类似如下:

vhss.mmeidentity truncated
vhss.mmeidentity_host truncated
3 mme-isdn mme.ng4T.com ng4T.com 1
3 mme-isdn mme.ng4T.com ng4T.com 1

1.2.9. Create HSS configuration files

# prompt has been removed for easier Ctrl+C Ctrl+V
# cd $OPENAIRCN_DIR/scripts

openssl rand -out $HOME/.rnd 128

PREFIX='/usr/local/etc/oai'
sudo mkdir -p $PREFIX
sudo chmod 777 $PREFIX
sudo mkdir $PREFIX/freeDiameter
sudo chmod 777 $PREFIX/freeDiameter

# freeDiameter configuration files
sudo cp ../etc/acl.conf ../etc/hss_rel14_fd.conf $PREFIX/freeDiameter
sudo chmod 666 $PREFIX/freeDiameter/acl.conf $PREFIX/freeDiameter/hss_rel14_fd.conf

# HSS configuration files
sudo cp ../etc/hss_rel14.conf ../etc/hss_rel14.json $PREFIX
sudo chmod 666 $PREFIX/hss_rel14.conf $PREFIX/hss_rel14.json

declare -A HSS_CONF
HSS_CONF[@PREFIX@]=$PREFIX
HSS_CONF[@REALM@]='ng4T.com'
HSS_CONF[@HSS_FQDN@]="hss.$&#123;HSS_CONF[@REALM@]&#125;"
HSS_CONF[@cassandra_Server_IP@]='127.0.0.1' 
HSS_CONF[@cassandra_IP@]='127.0.0.1' # TODO harmonize these 2
HSS_CONF[@OP_KEY@]='1006020f0a478bf6b699f15c062e42b3'
HSS_CONF[@ROAMING_ALLOWED@]='true'

for K in "$&#123;!HSS_CONF[@]&#125;"; do 
  egrep -lRZ "$K" $PREFIX | xargs -0 -l sed -i -e "s|$K|$&#123;HSS_CONF[$K]&#125;|g"
done

### freeDiameter certificate
../src/hss_rel14/bin/make_certs.sh hss $&#123;HSS_CONF[@REALM@]&#125; $PREFIX

# Finally customize the listen address of FD server (if necessary because FD binds by default on available interfaces)
# set in $PREFIX/freeDiameter/hss_rel14_fd.conf and uncomment the following line
sudo sed -i -e 's/#ListenOn/ListenOn/g' $PREFIX/freeDiameter/hss_rel14_fd.conf

1.2.10. Modify log file directory

修改配置中日志目录

sudo gedit /usr/local/etc/oai/hss_rel14.json

修改如下的四项内容的值为如下

"logname": "/var/log/hss.log"
"statlogname": "/var/log/hss_stat.log"
"auditlogname": "/var/log/hss_audit.log"
"ossfile": "~/openair-cn/etc/oss.json"

创建文件并授权

sudo touch /var/log/hss.log
sudo touch /var/log/hss_stat.log
sudo touch /var/log/hss_audit.log

sudo chmod 777 /var/log/hss.log
sudo chmod 777 /var/log/hss_stat.log
sudo chmod 777 /var/log/hss_audit.log

1.2.11. Update OPC Cassandra DB

运行

oai_hss -j $PREFIX/hss_rel14.json --onlyloadkey

输出应类似如下:

Options::jsonConfig            : /usr/local/etc/oai/hss_rel14.json
Options::diameterconfiguration : /usr/local/etc/oai/freeDiameter/hss_rel14_fd.conf
Options::cassserver            : 127.0.0.1
Options::cassuser              : root
Options::casspwd               : root
Options::cassdb                : vhss
Options::randvector            : 1
Options::roamallow             : 1
Options::optkey                : 1006020f0a478bf6b699f15c062e42b3
Options::reloadkey             : 0
Options::onlyloadkey           : 1
Options::gtwport               : 9080
Options::gtwhost               : *
Options::resthost              : 9081
Options::synchimsi             : 
Options::synchauts             : 
Initialized random


******************************************
IMSI:208931234561005
KEY :fec86ba6eb707ed08905757b1bb44b8f
OPC :
RijndaelKeySchedule: K FEC86BA6EB707ED08905757B1BB44B8F
Compute opc:
    K:    FEC86BA6EB707ED08905757B1BB44B8F
    In:    1006020F0A478BF6B699F15C062E42B3
    Rinj:    D4224B3931FD5BDDD0489A9573F93E72
    Out:    C42449363BBAD02B66D16BC975D77CC1
NEW OPC :c42449363bbad02b66d16bc975d77cc1
******************************************
UPDATE vhss.users_imsi SET OPc='c42449363bbad02b66d16bc975d77cc1' WHERE imsi='208931234561005';
******************************************
...
NEW OPC :c42449363bbad02b66d16bc975d77cc1
******************************************
UPDATE vhss.users_imsi SET OPc='c42449363bbad02b66d16bc975d77cc1' WHERE imsi='208931234561007';

输出不完全一致,可能由于官方文档没有同步更新?部分数值如 IMSI、KEY 等乱码,可能由于数据库编码问题?

1.3. Install MME

1.3.1. Install MME software dependencies

cd ~/openair-cn/scripts/
./build_mme --check-installed-software --force

输出类似如下

...
Processing triggers for mime-support (3.60ubuntu1) ...
Setting up unzip (6.0-21ubuntu1) ...
Processing triggers for man-db (2.8.3-2ubuntu0.1) ...
sh: 0: getcwd() failed: No such file or directory
MME software installation successful
MME not compiled, to compile it, re-run build_mme without -i option

1.3.2. Build MME

cd ~/openair-cn/scripts/
./build_mme --clean

输出类似如下

Clean the build generated files (build from scratch)
mkdir: created directory 'build'
Build type is Debug
Architecture is x86_64
git found: /usr/bin/git
NETTLE VERSION_INSTALLED  = 3.4
NETTLE_VERSION_MAJOR = 3
NETTLE_VERSION_MINOR = 4
Compilation log for /home/ubuntu/openair-cn/build/mme/build/mme is here: /home/ubuntu/openair-cn/build/log/mme.txt
mme compiled
'/home/ubuntu/openair-cn/build/mme/build/mme' -> '/usr/local/bin/mme'
mme installed

1.3.3. Create MME configuration files

安装 net-tools

sudo apt install net-tools

下面“创建 MME 配置文件”命令的第5行、第6行两个 ifconfig 的网卡名称根据自己实际情况修改冒号前部分,同时修改下面赋值语句中3处。共计5处。

使用命令 ifconfig -a 查看自己的网卡情况,例如如下显示情况则分别为 enp0s5:m11enp0s5:m1c

enp0s5: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
                ...
lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
                ...

创建 MME 配置文件

# prompt has been removed for easier Ctrl+C Ctrl+V
openssl rand -out $HOME/.rnd 128
# cd $OPENAIRCN_DIR/scripts
# S6a
sudo ifconfig enp0s5:m11 172.16.1.102 up
sudo ifconfig enp0s5:m1c 192.168.247.102 up
INSTANCE=1
PREFIX='/usr/local/etc/oai'
sudo mkdir -m 0777 -p $PREFIX
sudo mkdir -m 0777    $PREFIX/freeDiameter

# freeDiameter configuration file
cp ../etc/mme_fd.sprint.conf  $PREFIX/freeDiameter/mme_fd.conf

cp ../etc/mme.conf  $PREFIX

sudo chmod -R 777 $PREFIX

declare -A MME_CONF

MME_CONF[@MME_S6A_IP_ADDR@]="127.0.0.11"
MME_CONF[@INSTANCE@]=$INSTANCE
MME_CONF[@PREFIX@]=$PREFIX
MME_CONF[@REALM@]='ng4T.com'
MME_CONF[@PID_DIRECTORY@]='/var/run'
MME_CONF[@MME_FQDN@]="mme.$&#123;MME_CONF[@REALM@]&#125;"
MME_CONF[@HSS_HOSTNAME@]='hss'
MME_CONF[@HSS_FQDN@]="$&#123;MME_CONF[@HSS_HOSTNAME@]&#125;.$&#123;MME_CONF[@REALM@]&#125;"
MME_CONF[@HSS_IP_ADDR@]='127.0.0.1'
MME_CONF[@MCC@]='208'
MME_CONF[@MNC@]='93'
MME_CONF[@MME_GID@]='32768'
MME_CONF[@MME_CODE@]='3'
MME_CONF[@TAC_0@]='600'
MME_CONF[@TAC_1@]='601'
MME_CONF[@TAC_2@]='602'
MME_CONF[@MME_INTERFACE_NAME_FOR_S1_MME@]='enp0s5:m1c'
MME_CONF[@MME_IPV4_ADDRESS_FOR_S1_MME@]='192.168.247.102/24'
MME_CONF[@MME_INTERFACE_NAME_FOR_S11@]='enp0s5:m11'
MME_CONF[@MME_IPV4_ADDRESS_FOR_S11@]='172.16.1.102/24'
MME_CONF[@MME_INTERFACE_NAME_FOR_S10@]='enp0s5:m10'
MME_CONF[@MME_IPV4_ADDRESS_FOR_S10@]='192.168.10.110/24'
MME_CONF[@OUTPUT@]='CONSOLE'
MME_CONF[@SGW_IPV4_ADDRESS_FOR_S11_TEST_0@]='172.16.1.104/24'
MME_CONF[@SGW_IPV4_ADDRESS_FOR_S11_0@]='172.16.1.104/24'
MME_CONF[@PEER_MME_IPV4_ADDRESS_FOR_S10_0@]='0.0.0.0/24'
MME_CONF[@PEER_MME_IPV4_ADDRESS_FOR_S10_1@]='0.0.0.0/24'

#implicit MCC MNC 001 01
TAC_SGW_TEST='7'
tmph=`echo "$TAC_SGW_TEST / 256" | bc`
tmpl=`echo "$TAC_SGW_TEST % 256" | bc`
MME_CONF[@TAC-LB_SGW_TEST_0@]=`printf "%02x\n" $tmpl`
MME_CONF[@TAC-HB_SGW_TEST_0@]=`printf "%02x\n" $tmph`

MME_CONF[@MCC_SGW_0@]=$&#123;MME_CONF[@MCC@]&#125;
MME_CONF[@MNC3_SGW_0@]=`printf "%03d\n" $(echo $&#123;MME_CONF[@MNC@]&#125; | sed 's/^0*//')`
TAC_SGW_0='600'
tmph=`echo "$TAC_SGW_0 / 256" | bc`
tmpl=`echo "$TAC_SGW_0 % 256" | bc`
MME_CONF[@TAC-LB_SGW_0@]=`printf "%02x\n" $tmpl`
MME_CONF[@TAC-HB_SGW_0@]=`printf "%02x\n" $tmph`

MME_CONF[@MCC_MME_0@]=$&#123;MME_CONF[@MCC@]&#125;
MME_CONF[@MNC3_MME_0@]=`printf "%03d\n" $(echo $&#123;MME_CONF[@MNC@]&#125; | sed 's/^0*//')`
TAC_MME_0='601'
tmph=`echo "$TAC_MME_0 / 256" | bc`
tmpl=`echo "$TAC_MME_0 % 256" | bc`
MME_CONF[@TAC-LB_MME_0@]=`printf "%02x\n" $tmpl`
MME_CONF[@TAC-HB_MME_0@]=`printf "%02x\n" $tmph`

MME_CONF[@MCC_MME_1@]=$&#123;MME_CONF[@MCC@]&#125;
MME_CONF[@MNC3_MME_1@]=`printf "%03d\n" $(echo $&#123;MME_CONF[@MNC@]&#125; | sed 's/^0*//')`
TAC_MME_1='602'
tmph=`echo "$TAC_MME_1 / 256" | bc`
tmpl=`echo "$TAC_MME_1 % 256" | bc`
MME_CONF[@TAC-LB_MME_1@]=`printf "%02x\n" $tmpl`
MME_CONF[@TAC-HB_MME_1@]=`printf "%02x\n" $tmph`


for K in "$&#123;!MME_CONF[@]&#125;"; do 
  egrep -lRZ "$K" $PREFIX | xargs -0 -l sed -i -e "s|$K|$&#123;MME_CONF[$K]&#125;|g"
  ret=$?;[[ ret -ne 0 ]] && echo "Tried to replace $K with $&#123;MME_CONF[$K]&#125;"
done

# Generate freeDiameter certificate
sudo ./check_mme_s6a_certificate $PREFIX/freeDiameter mme.$&#123;MME_CONF[@REALM@]&#125;

mkdirFile exists 可以忽略

最后一行命令运行中可能出现红色 File /usr/local/etc/oai/freeDiameter/mme.cert.pem not found
MME S6A: Did not find valid certificate in /usr/local/etc/oai/freeDiameter 提示,是正常现象

最后输出类似如下

Write out database with 1 new entries
Data Base Updated
/home/yourusername/openair-cn/scripts
MME S6A: Found valid certificate in /usr/local/etc/oai/freeDiameter

1.4. Install SPGW

1.4.1. Install SPGW-U

1.4.1.1. Install SPGW-U software dependencies
cdgit clone https://github.com/fmtlib/fmt.git && cd fmt
mkdir _build && cd _build
cmake ..
make -j$(nproc)
sudo make install

cd ~/openair-cn-cups/
cd ./build/scripts
./build_spgwu -I -f
1.4.1.2. Build SPGW-U

As a starting point, you can start with a Debug build, then you can change the build type Check build types with ‘./build_spgwu -h’

./build_spgwu -c -V -b Debug -j

输出类似如下

Clean the build generated files (build from scratch)
CMake build process verbose
Cleaning S/P-GW-U: generated configuration files, obj files, executable
mkdir: created directory 'build'
Build type is Debug
Architecture is x86_64
git found: /usr/bin/git
Compilation log for /home/ubuntu/openair-cn-cups/build/spgw_u/build/spgwu is here: /home/ubuntu/openair-cn-cups/build/log/spgwu.txt
Scanning dependencies of target 3GPP_COMMON_TYPES
[  2%] Building CXX object common/CMakeFiles/3GPP_COMMON_TYPES.dir/logger.cpp.o
...
[ 97%] Building CXX object CMakeFiles/spgwu.dir/home/ubuntu/openair-cn-cups/src/itti/itti_msg.cpp.o
[100%] Linking CXX executable spgwu
[100%] Built target spgwu
spgwu compiled
'/home/ubuntu/openair-cn-cups/build/spgw_u/build/spgwu' -> '/usr/local/bin/spgwu'
spgwu installed
1.4.1.3. Create SPGW-U configuration files

注意:类似 1.3.3. 中的方法修改下面2处 ifconfig 命令参数中网卡名称和下面赋值语句中的3处。共计5处。

# prompt has been removed for easier Ctrl+C Ctrl+V
sudo ifconfig enp0s5:sxu 172.55.55.102 up   # SPGW-U SXab interface
sudo ifconfig enp0s5:s1u 192.168.248.159 up # SPGW-U S1U interface
INSTANCE=1
PREFIX='/usr/local/etc/oai'
sudo mkdir -m 0777 -p $PREFIX
cp ../../etc/spgw_u.conf  $PREFIX
sudo chmod -R 777 $PREFIX

declare -A SPGWU_CONF

SPGWU_CONF[@INSTANCE@]=$INSTANCE
SPGWU_CONF[@PREFIX@]=$PREFIX
SPGWU_CONF[@PID_DIRECTORY@]='/var/run'
SPGWU_CONF[@SGW_INTERFACE_NAME_FOR_S1U_S12_S4_UP@]='enp0s5:s1u'
SPGWU_CONF[@SGW_INTERFACE_NAME_FOR_SX@]='enp0s5:sxu'
SPGWU_CONF[@SGW_INTERFACE_NAME_FOR_SGI@]='enp0s5'

for K in "$&#123;!SPGWU_CONF[@]&#125;"; do 
  egrep -lRZ "$K" $PREFIX | xargs -0 -l sed -i -e "s|$K|$&#123;SPGWU_CONF[$K]&#125;|g"
  ret=$?;[[ ret -ne 0 ]] && echo "Tried to replace $K with $&#123;SPGWU_CONF[$K]&#125;"
done

修改 SPGW-U 配置文件中的自定义网络配置参数

sudo gedit /usr/local/etc/oai/spgw_u.conf

SPGW-C_LIST 部分中的第一行改为 {IPV4_ADDRESS="172.55.55.101";}

PDN_NETWORK_LIST 部分使用默认值,不需要修改

1.4.2. Install SPGW-C

1.4.2.1. Install SPGW-C software dependencies
cd ~/openair-cn-cups/
cd ./build/scripts
./build_spgwc -I -f
1.4.2.2. Build SPGW-C

As a starting point, you can start with a Debug build, then you can change the build type Check build types with ‘./build_spgwc -h’

./build_spgwc -c -V -b Debug -j

输出类似如下

Clean the build generated files (build from scratch)
CMake build process verbose
Cleaning S/P-GW-C: generated configuration files, obj files, executable
mkdir: created directory 'build'
Build type is Debug
Architecture is x86_64
git found: /usr/bin/git
Compilation log for /home/ubuntu/openair-cn-cups/build/spgw_c/build/spgwc is here: /home/ubuntu/openair-cn-cups/build/log/spgwc.txt
Scanning dependencies of target 3GPP_COMMON_TYPES
[  2%] Building CXX object common/CMakeFiles/3GPP_COMMON_TYPES.dir/logger.cpp.o
Scanning dependencies of target PGWC
...
Scanning dependencies of target spgwc
[ 92%] Building CXX object CMakeFiles/spgwc.dir/home/ubuntu/openair-cn-cups/src/oai_spgwc/options.cpp.o
[ 92%] Building CXX object CMakeFiles/spgwc.dir/home/ubuntu/openair-cn-cups/src/oai_spgwc/main.cpp.o
[ 95%] Building CXX object CMakeFiles/spgwc.dir/home/ubuntu/openair-cn-cups/src/itti/itti.cpp.o
[ 97%] Building CXX object CMakeFiles/spgwc.dir/home/ubuntu/openair-cn-cups/src/itti/itti_msg.cpp.o
[100%] Linking CXX executable spgwc
[100%] Built target spgwc
spgwc compiled
'/home/ubuntu/openair-cn-cups/build/spgw_c/build/spgwc' -> '/usr/local/bin/spgwc'
spgwc installed
1.4.2.3. Create SPGW-C configuration files

注意:类似 1.3.3. 中的方法修改下面4处 ifconfig 命令参数中网卡名称和下面赋值语句中的4处。共计8处。

# prompt has been removed for easier Ctrl+C Ctrl+V
sudo ifconfig enp0s5:sxc 172.55.55.101 up # SPGW-C SXab interface
sudo ifconfig enp0s5:s5c 172.58.58.102 up # SGW-C S5S8 interface
sudo ifconfig enp0s5:p5c 172.58.58.101 up # PGW-C S5S8 interface
sudo ifconfig enp0s5:s11 172.16.1.104 up  # SGW-C S11 interface
INSTANCE=1
PREFIX='/usr/local/etc/oai'
sudo mkdir -m 0777 -p $PREFIX
cp ../../etc/spgw_c.conf  $PREFIX
sudo chmod -R 777 $PREFIX

declare -A SPGWC_CONF

SPGWC_CONF[@INSTANCE@]=$INSTANCE
SPGWC_CONF[@PREFIX@]=$PREFIX
SPGWC_CONF[@PID_DIRECTORY@]='/var/run'
SPGWC_CONF[@SGW_INTERFACE_NAME_FOR_S11@]='enp0s5:s11'
SPGWC_CONF[@SGW_INTERFACE_NAME_FOR_S5_S8_CP@]='enp0s5:s5c'
SPGWC_CONF[@PGW_INTERFACE_NAME_FOR_S5_S8_CP@]='enp0s5:p5c'
SPGWC_CONF[@PGW_INTERFACE_NAME_FOR_SX@]='enp0s5:sxc'
SPGWC_CONF[@DEFAULT_DNS_IPV4_ADDRESS@]='8.8.8.8'
SPGWC_CONF[@DEFAULT_DNS_SEC_IPV4_ADDRESS@]='4.4.4.4'

for K in "$&#123;!SPGWC_CONF[@]&#125;"; do 
  egrep -lRZ "$K" $PREFIX | xargs -0 -l sed -i -e "s|$K|$&#123;SPGWC_CONF[$K]&#125;|g"
  ret=$?;[[ ret -ne 0 ]] && echo "Tried to replace $K with $&#123;SPGWC_CONF[$K]&#125;"
done

修改 SPGW-C 配置文件中的自定义网络配置参数

sudo gedit /usr/local/etc/oai/spgw_c.conf

IP_ADDRESS_POOL 部分中的 IPV4_LIST 部分的第一行改为 {RANGE = "12.1.1.2 - 12.1.1.224";},

第二行改为 {RANGE = "12.1.2.2 - 12.1.2.224";},

APN_LIST 部分中的第一行中的 default 改为 default.ng4T.com

1.5. Run EPC Network Functions

每个组件均需要新建一个终端,共需要4个

建议先在每个新建的终端上运行一下类似 sudo ls 的命令保持 root 状态

1.5.1. Run HSS

cd ~/openair-cn/scripts/
PREFIX='/usr/local/etc/oai'
oai_hss -j $PREFIX/hss_rel14.json

输出类似如下

Options::jsonConfig            : /usr/local/etc/oai/hss_rel14.json
Options::diameterconfiguration : /usr/local/etc/oai/freeDiameter/hss_rel14_fd.conf
Options::cassserver            : 127.0.0.1
Options::cassuser              : root
Options::casspwd               : root
Options::cassdb                : vhss
Options::randvector            : 1
Options::roamallow             : 1
Options::optkey                : 1006020f0a478bf6b699f15c062e42b3
Options::reloadkey             : 0
Options::onlyloadkey           : 0
Options::gtwport               : 9080
Options::gtwhost               : *
Options::resthost              : 9081
Options::synchimsi             : 
Options::synchauts             : 
Initialized random
12:59:13  NOTI   libfdproto '1.2.1' initialized.
12:59:13  NOTI   libgnutls '3.5.18' initialized.
12:59:13  NOTI   HASHLIST is enabled
...
12:59:13  NOTI   Loaded extensions: '/usr/local/lib/freeDiameter/dict_S6c.fdx'[(no config file)], loaded
Connecting to cassandra host: 127.0.0.1
Registering s6t dictionary
Registering s6t command handlers
Registering COIR command handler
Registering NIIR command handler
Registering s6as6d dictionary
Registering s6as6d command handlers
Registering UPLR command handler
Registering AUIR command handler
Registering PUUR command handler
Registering s6c dictionary
Registering s6c command handlers
Registering SERIFSR command handler
12:59:13  NOTI   Local server address(es): 192.168.123.158&#123;---L-&#125;
The freeDiameter engine has been started
Started REST server on port [9081]

1.5.2. Run MME

# sudo ifconfig enp0s5:m11 172.16.1.102 up
# sudo ifconfig enp0s5:m1c 192.168.247.102 up
# sudo ifconfig lo 127.0.0.11

cd ~/openair-cn/scripts/
PREFIX='/usr/local/etc/oai'
./run_mme --config-file $PREFIX/mme.conf --set-virt-if

输出类似如下

setting config file to: /usr/local/etc/oai/mme.conf
OPENAIRCN_DIR    = /home/ubuntu/openair-cn
Configuring ens3:m1c  192.168.247.102/24
Configuring ens3:m11  172.16.1.102/24
Configuring ens3:m10  192.168.10.110/24
Initializing shared logging
Initializing shared logging Done
Initializing OAI Logging
Initializing OAI logging Done
mme_config_parse_opt_line mme_config.config_file /usr/local/etc/oai/mme.conf
000006 00000:541475 7F65369E42C0 INFO  CONFIG nair-cn/src/mme_app/mme_config.c:1016    ==== EURECOM MME vBranch: master Abrev. Hash: 6a7a8719 Date: Wed May 22 16:11:57 2019 +0200 ====
000007 00000:541637 7F65369E42C0 DEBUG CONFIG nair-cn/src/mme_app/mme_config.c:1018    Built with CMAKE_BUILD_TYPE ................: Debug
000008 00000:541810 7F65369E42C0 DEBUG CONFIG nair-cn/src/mme_app/mme_config.c:1019    Built with DISABLE_ITTI_DETECT_SUB_TASK_ID .: 1
000009 00000:541938 7F65369E42C0 DEBUG CONFIG nair-cn/src/mme_app/mme_config.c:1020    Built with ITTI_TASK_STACK_SIZE ............: 2097152
000010 00000:542074 7F65369E42C0 DEBUG CONFIG nair-cn/src/mme_app/mme_config.c:1021    Built with ITTI_LITE .......................: 0
000011 00000:542201 7F65369E42C0 DEBUG CONFIG nair-cn/src/mme_app/mme_config.c:1022    Built with LOG_OAI .........................: 1
000012 00000:542329 7F65369E42C0 DEBUG CONFIG nair-cn/src/mme_app/mme_config.c:1023    Built with LOG_OAI_CLEAN_HARD ..............: 0
000013 00000:542456 7F65369E42C0 DEBUG CONFIG nair-cn/src/mme_app/mme_config.c:1024    Built with MESSAGE_CHART_GENERATOR .........: 0
000014 00000:542589 7F65369E42C0 DEBUG CONFIG nair-cn/src/mme_app/mme_config.c:1025    Built with PACKAGE_NAME ....................: MME
000015 00000:542716 7F65369E42C0 DEBUG CONFIG nair-cn/src/mme_app/mme_config.c:1026    Built with S1AP_DEBUG_LIST .................: 0
000016 00000:542843 7F65369E42C0 DEBUG CONFIG nair-cn/src/mme_app/mme_config.c:1027    Built with SECU_DEBUG ......................: 1
000017 00000:542968 7F65369E42C0 DEBUG CONFIG nair-cn/src/mme_app/mme_config.c:1028    Built with SCTP_DUMP_LIST ..................: 0
000018 00000:543094 7F65369E42C0 DEBUG CONFIG nair-cn/src/mme_app/mme_config.c:1029    Built with TRACE_HASHTABLE .................: 0
000019 00000:543221 7F65369E42C0 DEBUG CONFIG nair-cn/src/mme_app/mme_config.c:1030    Built with TRACE_3GPP_SPEC .................: 1
000020 00000:543349 7F65369E42C0 INFO  CONFIG nair-cn/src/mme_app/mme_config.c:1032    Configuration:
000021 00000:543476 7F65369E42C0 INFO  CONFIG nair-cn/src/mme_app/mme_config.c:1033    - File .................................: /usr/local/etc/oai/mme.conf
000022 00000:543604 7F65369E42C0 INFO  CONFIG nair-cn/src/mme_app/mme_config.c:1034    - Realm ................................: ng4T.com
000023 00000:543753 7F65369E42C0 INFO  CONFIG nair-cn/src/mme_app/mme_config.c:1035    - Run mode .............................: BASIC
000024 00000:543881 7F65369E42C0 INFO  CONFIG nair-cn/src/mme_app/mme_config.c:1036    - Max eNBs .............................: 8
000025 00000:544009 7F65369E42C0 INFO  CONFIG nair-cn/src/mme_app/mme_config.c:1037    - Max UEs ..............................: 128
000026 00000:544136 7F65369E42C0 INFO  CONFIG nair-cn/src/mme_app/mme_config.c:1038    - IMS voice over PS session in S1 ......: false
000027 00000:544274 7F65369E42C0 INFO  CONFIG nair-cn/src/mme_app/mme_config.c:1039    - Emergency bearer services in S1 mode .: false
000028 00000:544400 7F65369E42C0 INFO  CONFIG nair-cn/src/mme_app/mme_config.c:1040    - Location services via epc ............: false
000029 00000:544529 7F65369E42C0 INFO  CONFIG nair-cn/src/mme_app/mme_config.c:1041    - Extended service request .............: false
000030 00000:544657 7F65369E42C0 INFO  CONFIG nair-cn/src/mme_app/mme_config.c:1042    - Unauth IMSI support ..................: false
000031 00000:544783 7F65369E42C0 INFO  CONFIG nair-cn/src/mme_app/mme_config.c:1043    - Relative capa ........................: 10
000032 00000:544918 7F65369E42C0 INFO  CONFIG nair-cn/src/mme_app/mme_config.c:1044    - Statistics timer .....................: 10 (seconds)

000033 00000:545069 7F65369E42C0 INFO  CONFIG nair-cn/src/mme_app/mme_config.c:1045    - S1-MME:
000034 00000:545188 7F65369E42C0 INFO  CONFIG nair-cn/src/mme_app/mme_config.c:1046        port number ......: 36412
000035 00000:545299 7F65369E42C0 INFO  CONFIG nair-cn/src/mme_app/mme_config.c:1047    - IP:
000036 00000:545418 7F65369E42C0 INFO  CONFIG nair-cn/src/mme_app/mme_config.c:1048        s1-MME iface .....: ens3:m1c
000037 00000:545530 7F65369E42C0 INFO  CONFIG nair-cn/src/mme_app/mme_config.c:1049        s1-MME ip ........: 192.168.247.102
000038 00000:545650 7F65369E42C0 INFO  CONFIG nair-cn/src/mme_app/mme_config.c:1050        s11 MME iface ....: ens3:m11
000039 00000:545761 7F65369E42C0 INFO  CONFIG nair-cn/src/mme_app/mme_config.c:1051        s11 MME port .....: 2123
000040 00000:545882 7F65369E42C0 INFO  CONFIG nair-cn/src/mme_app/mme_config.c:1052        s11 MME ip .......: 172.16.1.102
000041 00000:545994 7F65369E42C0 INFO  CONFIG nair-cn/src/mme_app/mme_config.c:1053        s10 MME iface ....: ens3:m10
000042 00000:546122 7F65369E42C0 INFO  CONFIG nair-cn/src/mme_app/mme_config.c:1054        s10 MME port .....: 2123
000043 00000:546235 7F65369E42C0 INFO  CONFIG nair-cn/src/mme_app/mme_config.c:1055        s10 MME ip .......: 192.168.10.110
000044 00000:546354 7F65369E42C0 INFO  CONFIG nair-cn/src/mme_app/mme_config.c:1056    - ITTI:
000045 00000:546467 7F65369E42C0 INFO  CONFIG nair-cn/src/mme_app/mme_config.c:1057        queue size .......: 2000000 (bytes)
000046 00000:546587 7F65369E42C0 INFO  CONFIG nair-cn/src/mme_app/mme_config.c:1058        log file .........: (null)
000047 00000:546699 7F65369E42C0 INFO  CONFIG nair-cn/src/mme_app/mme_config.c:1059    - SCTP:
000048 00000:546819 7F65369E42C0 INFO  CONFIG nair-cn/src/mme_app/mme_config.c:1060        in streams .......: 8
000049 00000:546929 7F65369E42C0 INFO  CONFIG nair-cn/src/mme_app/mme_config.c:1061        out streams ......: 8
000050 00000:547050 7F65369E42C0 INFO  CONFIG nair-cn/src/mme_app/mme_config.c:1062    - GUMMEIs (PLMN|MMEGI|MMEC):
000051 00000:547161 7F65369E42C0 INFO  CONFIG nair-cn/src/mme_app/mme_config.c:1065                208.93 |32768|3 
000052 00000:547281 7F65369E42C0 INFO  CONFIG nair-cn/src/mme_app/mme_config.c:1068    - TAIs : (mcc.mnc:tac)
000053 00000:547391 7F65369E42C0 INFO  CONFIG nair-cn/src/mme_app/mme_config.c:1071    - TAI list type one PLMN consecutive TACs
000054 00000:547509 7F65369E42C0 INFO  CONFIG nair-cn/src/mme_app/mme_config.c:1083                208. 93:600
000055 00000:547620 7F65369E42C0 INFO  CONFIG nair-cn/src/mme_app/mme_config.c:1083                208. 93:601
000056 00000:547800 7F65369E42C0 INFO  CONFIG nair-cn/src/mme_app/mme_config.c:1083                208. 93:602
000057 00000:547911 7F65369E42C0 INFO  CONFIG nair-cn/src/mme_app/mme_config.c:1089    - NAS:
000058 00000:548032 7F65369E42C0 INFO  CONFIG nair-cn/src/mme_app/mme_config.c:1094        Prefered Integrity Algorithms .: EIA2 EIA1 EIA0 EIA0 (decreasing priority)
000059 00000:548143 7F65369E42C0 INFO  CONFIG nair-cn/src/mme_app/mme_config.c:1099        Prefered Integrity Algorithms .: EEA0 EEA1 EEA2 EEA0 (decreasing priority)
000060 00000:548271 7F65369E42C0 INFO  CONFIG nair-cn/src/mme_app/mme_config.c:1100        T3346 ....: 5 min
000061 00000:548380 7F65369E42C0 INFO  CONFIG nair-cn/src/mme_app/mme_config.c:1101        T3402 ....: 12 min

Broadcast message from systemd-journald@test-install-openair-cn (Thu 2019-05-23 14:11:03 UTC):

mme[18197]: 000000 00000:541142 7F65369E42C0 DEBUG CONFIG nair-cn/src/mme_app/mme_config.c:1240    Config file is (null)


Broadcast message from systemd-journald@test-install-openair-cn (Thu 2019-05-23 14:11:03 UTC):

mme[18197]: 000001 00000:541427 7F65369E42C0 INFO  MME-AP nair-cn/src/mme_app/mme_config.c:0791    Parsing configuration file found S1-MME: 192.168.247.102/24 on ens3:m1c

000062 00000:550537 7F65369E42C0 INFO  CONFIG nair-cn/src/mme_app/mme_config.c:1102        T3412 ....: 54 min
000063 00000:550545 7F65369E42C0 INFO  CONFIG nair-cn/src/mme_app/mme_config.c:1103        T3422 ....: 6 sec
000064 00000:550549 7F65369E42C0 INFO  CONFIG nair-cn/src/mme_app/mme_config.c:1104        T3450 ....: 6 sec
000065 00000:550553 7F65369E42C0 INFO  CONFIG nair-cn/src/mme_app/mme_config.c:1105        T3460 ....: 6 sec
000066 00000:550556 7F65369E42C0 INFO  CONFIG nair-cn/src/mme_app/mme_config.c:1106        T3470 ....: 6 sec
000067 00000:550559 7F65369E42C0 INFO  CONFIG nair-cn/src/mme_app/mme_config.c:1107        T3485 ....: 8 sec
000068 00000:550562 7F65369E42C0 INFO  CONFIG nair-cn/src/mme_app/mme_config.c:1108        T3486 ....: 8 sec
000069 00000:550566 7F65369E42C0 INFO  CONFIG nair-cn/src/mme_app/mme_config.c:1109        T3489 ....: 4 sec
000070 00000:550569 7F65369E42C0 INFO  CONFIG nair-cn/src/mme_app/mme_config.c:1110        T3470 ....: 6 sec
000071 00000:550572 7F65369E42C0 INFO  CONFIG nair-cn/src/mme_app/mme_config.c:1111        T3495 ....: 8 sec
000072 00000:550579 7F65369E42C0 INFO  CONFIG nair-cn/src/mme_app/mme_config.c:1112        NAS non standart features .:
000073 00000:550583 7F65369E42C0 INFO  CONFIG nair-cn/src/mme_app/mme_config.c:1113          Force TAU ...................: true
000074 00000:550586 7F65369E42C0 INFO  CONFIG nair-cn/src/mme_app/mme_config.c:1114          Force reject SR .............: true
000075 00000:550590 7F65369E42C0 INFO  CONFIG nair-cn/src/mme_app/mme_config.c:1115          Disable Esm information .....: false
000076 00000:550593 7F65369E42C0 INFO  CONFIG nair-cn/src/mme_app/mme_config.c:1117    - S6A:
000077 00000:550596 7F65369E42C0 INFO  CONFIG nair-cn/src/mme_app/mme_config.c:1118        conf file ........: /usr/local/etc/oai/freeDiameter/mme_fd.conf
000078 00000:550600 7F65369E42C0 INFO  CONFIG nair-cn/src/mme_app/mme_config.c:1119    - Logging:
000079 00000:550604 7F65369E42C0 INFO  CONFIG nair-cn/src/mme_app/mme_config.c:1120        Output ..............: CONSOLE
000080 00000:550607 7F65369E42C0 INFO  CONFIG nair-cn/src/mme_app/mme_config.c:1121        Output thread safe ..: false
000081 00000:550611 7F65369E42C0 INFO  CONFIG nair-cn/src/mme_app/mme_config.c:1122        Output with color ...: true
000082 00000:550614 7F65369E42C0 INFO  CONFIG nair-cn/src/mme_app/mme_config.c:1123        UDP log level........: TRACE
000083 00000:550618 7F65369E42C0 INFO  CONFIG nair-cn/src/mme_app/mme_config.c:1124        GTPV2-C log level....: TRACE
000084 00000:550621 7F65369E42C0 INFO  CONFIG nair-cn/src/mme_app/mme_config.c:1125        SCTP log level.......: TRACE
000085 00000:550624 7F65369E42C0 INFO  CONFIG nair-cn/src/mme_app/mme_config.c:1126        S1AP log level.......: TRACE
000086 00000:550628 7F65369E42C0 INFO  CONFIG nair-cn/src/mme_app/mme_config.c:1127        ASN1 Verbosity level : 0
000087 00000:550631 7F65369E42C0 INFO  CONFIG nair-cn/src/mme_app/mme_config.c:1128        NAS log level........: TRACE
000088 00000:550635 7F65369E42C0 INFO  CONFIG nair-cn/src/mme_app/mme_config.c:1129        MME_APP log level....: TRACE
000089 00000:550638 7F65369E42C0 INFO  CONFIG nair-cn/src/mme_app/mme_config.c:1130        S10 log level........: INVALID_LOG_LEVEL
000090 00000:550642 7F65369E42C0 INFO  CONFIG nair-cn/src/mme_app/mme_config.c:1131        S11 log level........: TRACE
000091 00000:550645 7F65369E42C0 INFO  CONFIG nair-cn/src/mme_app/mme_config.c:1132        S6a log level........: TRACE
000092 00000:550649 7F65369E42C0 INFO  CONFIG nair-cn/src/mme_app/mme_config.c:1133        UTIL log level.......: TRACE
000093 00000:550652 7F65369E42C0 INFO  CONFIG nair-cn/src/mme_app/mme_config.c:1134        MSC log level........: ERROR (MeSsage Chart)
000094 00000:550656 7F65369E42C0 INFO  CONFIG nair-cn/src/mme_app/mme_config.c:1135        ITTI log level.......: ERROR (InTer-Task Interface)
000095 00000:550659 7F65369E42C0 INFO  CONFIG nair-cn/src/mme_app/mme_config.c:1136        XML log level........: INVALID_LOG_LEVEL (XML dump/load of messages)

Broadcast message from systemd-journald@test-install-openair-cn (Thu 2019-05-23 14:11:03 UTC):

mme[18197]: 000002 00000:541441 7F65369E42C0 INFO  MME-AP nair-cn/src/mme_app/mme_config.c:0807    Parsing configuration file found S11: 172.16.1.102/24 on ens3:m11

 Creating queue of message of size 128
 Creating queue of message of size 256
 Creating queue of message of size 256
 Creating queue of message of size 256
 Creating queue of message of size 256
 Creating queue of message of size 256
 Creating queue of message of size 256
 Creating queue of message of size 256
 Creating queue of message of size 256
 Creating queue of message of size 256
 Creating queue of message of size 256
 Creating queue of message of size 256
 Creating queue of message of size 256
 Creating queue of message of size 256
 Creating queue of message of size 1024
 Creating queue of message of size 1024
 Creating queue of message of size 256

Broadcast message from systemd-journald@test-install-openair-cn (Thu 2019-05-23 14:11:03 UTC):

mme[18197]: 000003 00000:541448 7F65369E42C0 INFO  MME-AP nair-cn/src/mme_app/mme_config.c:0822    Parsing configuration file found S10: 192.168.10.110/24 on ens3:m10


Broadcast message from systemd-journald@test-install-openair-cn (Thu 2019-05-23 14:11:03 UTC):

mme[18197]: 000004 00000:541459 7F65369E42C0 INFO  MME-AP nair-cn/src/mme_app/mme_config.c:0962    Parsing configuration file found S-GW S11: 172.16.1.104


Broadcast message from systemd-journald@test-install-openair-cn (Thu 2019-05-23 14:11:03 UTC):

mme[18197]: 000005 00000:541465 7F65369E42C0 INFO  MME-AP nair-cn/src/mme_app/mme_config.c:0962    Parsing configuration file found S-GW S11: 172.16.1.104

000096 00000:569138 7F65369E42C0 DEBUG NAS    ir-cn/src/nas/emm/nas_emm_task.c:0171    Initializing NAS EMM task interface
000097 00000:569177 7F65369E42C0 TRACE NAS-EM penair-cn/src/nas/emm/emm_main.c:0092    Entering emm_main_initialize()
000098 00000:569193 7F65369E42C0 TRACE NAS    air-cn/src/nas/api/mme/mme_api.c:0120      Entering mme_api_get_emm_config()
000099 00000:569204 7F65369E42C0 TRACE NAS    air-cn/src/nas/api/mme/mme_api.c:0250      Leaving mme_api_get_emm_config() (rc=0)
000100 00000:569225 7F65369E42C0 TRACE NAS-EM penair-cn/src/nas/emm/emm_main.c:0109    Leaving emm_main_initialize()
...
...
...
000287 00000:642737 7F6525FFB700 ERROR S6A    tu/openair-cn/src/s6a/s6a_task.c:0089    ...... 00000:642735 7F6525FFB700 LEVEL S6A --no source file-- No TLS protection negotiated with peer 'hss.ng4T.com'.
000288 00000:642765 7F6525FFB700 ERROR S6A    tu/openair-cn/src/s6a/s6a_task.c:0089    ...... 00000:642763 7F6525FFB700 LEVEL S6A --no source file-- 'STATE_WAITCEA'    -> 'STATE_OPEN'    'hss.ng4T.com'
000289 00001:636354 7F64DDFFB700 DEBUG S6A    tu/openair-cn/src/s6a/s6a_peer.c:0116    Diameter identity of MME: mme.ng4T.com with length: 12
000290 00001:636400 7F64DDFFB700 DEBUG S6A    tu/openair-cn/src/s6a/s6a_peer.c:0151    S6a peer connection attempt 1 / 8
000291 00001:636417 7F64DDFFB700 DEBUG S6A    tu/openair-cn/src/s6a/s6a_peer.c:0164    Peer hss.ng4T.com is now connected...
000292 00001:636597 7F652E9EF700 DEBUG SCTP   rc/sctp/sctp_primitives_server.c:0674    Received SCTP_INIT_MSG
000293 00001:636621 7F652E9EF700 DEBUG SCTP   rc/sctp/sctp_primitives_server.c:0320    Creating new listen socket on port 36412 with
000294 00001:636626 7F652E9EF700 DEBUG SCTP   rc/sctp/sctp_primitives_server.c:0325    ipv4 addresses:
000295 00001:636632 7F652E9EF700 DEBUG SCTP   rc/sctp/sctp_primitives_server.c:0334        - 192.168.247.102
000296 00010:580341 7F6527FFF700 DEBUG MME-AP src/mme_app/mme_app_statistics.c:0045    ======================================= STATISTICS ============================================

000297 00010:580364 7F6527FFF700 DEBUG MME-AP src/mme_app/mme_app_statistics.c:0046                   |   Current Status| Added since last display|  Removed since last display |
000298 00010:580370 7F6527FFF700 DEBUG MME-AP src/mme_app/mme_app_statistics.c:0048    Connected eNBs |          0      |              0              |             0               |
000299 00010:580375 7F6527FFF700 DEBUG MME-AP src/mme_app/mme_app_statistics.c:0050    Attached UEs   |          0      |              0              |             0               |
000300 00010:580379 7F6527FFF700 DEBUG MME-AP src/mme_app/mme_app_statistics.c:0052    Connected UEs  |          0      |              0              |             0               |
000301 00010:580384 7F6527FFF700 DEBUG MME-AP src/mme_app/mme_app_statistics.c:0054    Default Bearers|          0      |              0              |             0               |
000302 00010:580388 7F6527FFF700 DEBUG MME-AP src/mme_app/mme_app_statistics.c:0056    S1-U Bearers   |          0      |              0              |             0               |
...
...

1.5.3. Run SPGW

1.5.3.1. Run SPGW-C

注意:先运行 SPGW-C 再运行 SPGW-U

# Set up interfaces for SPGW-C
sudo ifconfig enp0s5:sxc 172.55.55.101 up # SPGW-C SXab interface
sudo ifconfig enp0s5:s5c 172.58.58.102 up # SGW-C S5S8 interface
sudo ifconfig enp0s5:p5c 172.58.58.101 up # PGW-C S5S8 interface
sudo ifconfig enp0s5:s11 172.16.1.104 up  # SGW-C S11 interface
# Set up interfaces for SPGW-U
sudo ifconfig enp0s5:sxu 172.55.55.102 up   # SPGW-U SXab interface
sudo ifconfig enp0s5:s1u 192.168.248.159 up # SPGW-U S1U interface

cd ~/openair-cn-cups/build/scripts
PREFIX='/usr/local/etc/oai'
sudo spgwc -c $PREFIX/spgw_c.conf
1.5.3.2. Run SPGW-U

【不做】每次重新启动计算机后需要运行一次如下命令,以指定用户流量所使用的网关。根据实际情况修改网关和用户流量来源地址 (PDN)

echo '200 lte' | sudo tee --append /etc/iproute2/rt_tables
# Here the gateway is at 192.168.0.1
sudo ip route add default via 192.168.0.1 dev enp0s5 table lte
# you will have to repeat the following line for each PDN network set in your SPGW-U config file
sudo ip rule add from 12.0.0.0/8 table lte

注意:先运行 SPGW-C 再运行 SPGW-U

cd ~/openair-cn-cups/build/scripts
PREFIX='/usr/local/etc/oai'
sudo spgwu -c $PREFIX/spgw_u.conf

2. RAN(eNB 和 UE) 配置

官方文档 https://gitlab.eurecom.fr/oai/openairinterface5g/-/wikis/home

2.1. Requirements for RAN

根据官方文档介绍,选择较新版本进行配置(starting master tag v1.1.0 and develop tag 2019.w09),操作系统 Ubuntu 16.04 with low-latency kernel 4.4.0 or higher

具体来说,本文档在 macOS 主机上使用 Parallel Desktop 安装 Ubuntu 16.04 LTS 进行部署测试,RAN 版本使用 master branch commit 7cc5a63acaf77d5e1e4c4b023958b329ae4ece3d

2.1.1. System requirements (Hardware compatibility)

3代 Intel i5 以上处理器,至少4个核心

Note: When running the software on virtualized environment (containers, VMs), make sure that the access to the RF interface is granted (e.g. passthru) and CPU flags are set. In addition, make sure that low latency kernel is installed when using VMs and that enough CPUs processing is available.

2.1.2. Kernel Setups - Main Installation (Software compatibility)

2.1.2.1. Install the low-latency kernel
sudo apt-get install linux-image-lowlatency linux-headers-lowlatency

显示内核启动顺序

grep menuentry /boot/grub/grub.cfg

输出类似如下,确认存在类似 Ubuntu, with Linux 4.4.0-184-lowlatency,安装正确

if [ x"$&#123;feature_menuentry_id&#125;" = xy ]; then
  menuentry_id_option="--id"
  menuentry_id_option=""
export menuentry_id_option
menuentry 'Ubuntu' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-simple-a13224e0-182d-4064-bca9-718d8994e7be' &#123;
submenu 'Advanced options for Ubuntu' $menuentry_id_option 'gnulinux-advanced-a13224e0-182d-4064-bca9-718d8994e7be' &#123;
    menuentry 'Ubuntu, with Linux 4.15.0-106-generic' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-4.15.0-106-generic-advanced-a13224e0-182d-4064-bca9-718d8994e7be' &#123;
    menuentry 'Ubuntu, with Linux 4.15.0-106-generic (upstart)' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-4.15.0-106-generic-init-upstart-a13224e0-182d-4064-bca9-718d8994e7be' &#123;
    menuentry 'Ubuntu, with Linux 4.15.0-106-generic (recovery mode)' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-4.15.0-106-generic-recovery-a13224e0-182d-4064-bca9-718d8994e7be' &#123;
    menuentry 'Ubuntu, with Linux 4.15.0-91-generic' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-4.15.0-91-generic-advanced-a13224e0-182d-4064-bca9-718d8994e7be' &#123;
    menuentry 'Ubuntu, with Linux 4.15.0-91-generic (upstart)' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-4.15.0-91-generic-init-upstart-a13224e0-182d-4064-bca9-718d8994e7be' &#123;
    menuentry 'Ubuntu, with Linux 4.15.0-91-generic (recovery mode)' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-4.15.0-91-generic-recovery-a13224e0-182d-4064-bca9-718d8994e7be' &#123;
    menuentry 'Ubuntu, with Linux 4.4.0-184-lowlatency' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-4.4.0-184-lowlatency-advanced-a13224e0-182d-4064-bca9-718d8994e7be' &#123;
    menuentry 'Ubuntu, with Linux 4.4.0-184-lowlatency (upstart)' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-4.4.0-184-lowlatency-init-upstart-a13224e0-182d-4064-bca9-718d8994e7be' &#123;
    menuentry 'Ubuntu, with Linux 4.4.0-184-lowlatency (recovery mode)' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-4.4.0-184-lowlatency-recovery-a13224e0-182d-4064-bca9-718d8994e7be' &#123;
menuentry 'Memory test (memtest86+)' &#123;
menuentry 'Memory test (memtest86+, serial console 115200)' &#123;

修改 grub 文件

sudo gedit /etc/default/grub

GRUB_DEFAULT=0

改为

GRUB_DEFAULT="Advanced options for Ubuntu>Ubuntu, with Linux 4.4.0-184-lowlatency" (对应的版本号)

更新 grub 以启用

sudo update-grub

重新启动 sudo reboot 后,输入 uname -r 查看内核版本,若为 4.4.0-184-lowlatency 即为成功

2.1.2.2. Power management

Remove all power management features in the BIOS (sleep states, in particular C-states) and CPU frequency scaling (Intel SpeedStep). In some cases, you can also do this with cpufreqtool. Also, disable hyperthreading in BIOS and make sure its turned off in Linux

2.1.2.2.1. Check CPU frequency

check this using this command: watch grep \"cpu MHz\" /proc/cpuinfo

2.1.2.2.2. Disable pstate & cstate

修改 grub 文件

sudo gedit /etc/default/grub

GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"

改为

GRUB_CMDLINE_LINUX_DEFAULT="quiet splash intel_pstate=disable processor.max_cstate=1 intel_idle.max_cstate=0 idle=poll"

更新 grub 以启用

sudo update-grub

重新启动 sudo reboot

2.1.2.2.3. Blacklist intel_powerclamp

修改文件,如果不存在则新建

sudo gedit /etc/modprobe.d/blacklist.conf

在文件末尾添加如下内容,建议保留一行空行


# blacklist the intel_powerclamp module
# for OAI RAN build power management requirements
blacklist intel_powerclamp

重新启动 sudo reboot

2.1.2.2.4. Disable power management from BIOS

Disable hyperthreading, CPU frequency control, C-States, P-States and any other power management from BIOS.

根据实际情况进入 BIOS 设置,虚拟机软件则一般使用对应的配置菜单,打开 CPU 设置中类似 “PMU 虚拟化” 的选项。

2.1.2.2.5. Install i7z utility to check the cpu
sudo apt-get install i7z
sudo i7z

输出类似如下

Cpu speed from cpuinfo 2903.00Mhz
cpuinfo might be wrong if cpufreq is enabled. To guess correctly try estimating via tsc
Linux's inbuilt cpu_khz code emulated now
True Frequency (without accounting Turbo) 2903 MHz
  CPU Multiplier 29x || Bus clock frequency (BCLK) 100.10 MHz

Socket [0] - [physical cores=4, logical cores=4, max online cores ever=4]
  TURBO DISABLED on 4 Cores, Hyper Threading OFF
  Max Frequency without considering Turbo 2903.00 MHz (100.10 x [29])
  Max TURBO Multiplier (if Enabled) with 1/2/3/4 Cores is  0x/0x/0x/0x
  Real Current Frequency 3500.91 MHz [100.10 x 34.97] (Max of below)
        Core [core-id]  :Actual Freq (Mult.)      C0%   Halt(C1)%  C3 %   C6 %  Temp      VCore
        Core 1 [0]:       3496.98 (34.93x)      96.2       0       0       0    97      0.9062
        Core 2 [1]:       3496.15 (34.93x)      96.2       0       0       0    97      0.9062
        Core 3 [2]:       3500.91 (34.97x)      96.6       0       0       0    97      0.9062
        Core 4 [3]:       3496.96 (34.93x)      96.2       0       0       0    97      0.9062



C0 = Processor running without halting
C1 = Processor running with halts (States >C0 are power saver modes with cores idling)
C3 = Cores running with PLL turned off and core cache turned off
C6, C7 = Everything in C3 + core state saved to last level cache, C7 is deeper than C6
  Above values in table are in percentage over the last 1 sec
[core-id] refers to core-id number in /proc/cpuinfo
'Garbage Values' message printed when garbage values are read
  Ctrl+C to exit

CPU 频率不应该有超过1-2 Hz 的改变,除了 C0 外不应该有其他 C-state,如果不正确则必须修正,否则 eNB/UE/RRH 会有运行问题

2.1.2.3. Disable CPU Frequency scaling

Install cpufrequtils:

sudo apt-get install cpufrequtils

Then edit the following file (if it doesn’t exist, create it):

sudo gedit /etc/default/cpufrequtils

And add the following line to it:

GOVERNOR="performance"

Save and exit.

Now you need to disable ondemand daemon, otherwise after you reboot the settings will be overwriten.

sudo update-rc.d ondemand disable
sudo /etc/init.d/cpufrequtils restart

You can check your settings with:

cpufreq-info

It will show a block of information for every core your processor has. Just check if all of then are in perfomance mode, and at the maximum speed of your processor.

在虚拟机上尝试此步骤 CPU 频率调整,会有类似如下显示。无法调整应为正常现象,似乎无重大后续影响。

cpufrequtils 008: cpufreq-info (C) Dominik Brodowski 2004-2009
Report errors and bugs to cpufreq@vger.kernel.org, please.
analyzing CPU 0:
  no or unknown cpufreq driver is active on this CPU
  maximum transition latency: 4294.55 ms.
analyzing CPU 1:
  no or unknown cpufreq driver is active on this CPU
  maximum transition latency: 4294.55 ms.
analyzing CPU 2:
  no or unknown cpufreq driver is active on this CPU
  maximum transition latency: 4294.55 ms.
analyzing CPU 3:
  no or unknown cpufreq driver is active on this CPU
  maximum transition latency: 4294.55 ms.
2.1.2.4. Wi-Fi/Bluetooth

根据官方文档,可能需要关闭 Wi-Fi/Bluetooth,或移除对应的驱动,以解决某些问题

2.2. Get source code

官方综合文档(概述 EPC、eNB、UE的源码获取):https://gitlab.eurecom.fr/oai/openairinterface5g/blob/master/doc/GET_SOURCES.md

对于 eNB UE,仓库为:https://gitlab.eurecom.fr/oai/openairinterface5g

2.2.1. Install git

sudo apt-get update
sudo apt-get install git

2.2.2. Clone the repository

cd ~
git clone https://gitlab.eurecom.fr/oai/openairinterface5g.git
# cd openairinterface5g/
# git checkout v1.1.0

2.3. Build

本质上通过使用 openairinterface5g/cmake_targets/build_oai 这个 Soft Modem Build Script 进行 build

这里同时编译 eNB 和 UE,也可分别编译。该脚本具有多种选项和参数设置,详见官方文档 https://gitlab.eurecom.fr/oai/openairinterface5g/blob/master/doc/BUILD.md

该脚本运行可能需要较长时间

cd ~/openairinterface5g/
source oaienv
cd cmake_targets/
./build_oai -I -w USRP --eNB --UE

结尾部分输出类似如下

Log file for compilation has been written to: /home/jarvis/openairinterface5g/cmake_targets/log/params_libconfig.Rel14.txt
params_libconfig compiled
Log file for compilation has been written to: /home/jarvis/openairinterface5g/cmake_targets/log/coding.Rel14.txt
coding compiled
Log file for compilation has been written to: /home/jarvis/openairinterface5g/cmake_targets/log/nasmesh.Rel14.txt
nasmesh compiled
Log file for compilation has been written to: /home/jarvis/openairinterface5g/cmake_targets/log/rb_tool.Rel14.txt
rb_tool compiled
Log file for compilation has been written to: /home/jarvis/openairinterface5g/cmake_targets/log/oai_usrpdevif.Rel14.txt
oai_usrpdevif compiled
liboai_device.so is linked to USRP device library
Compiling rfsimulator
Log file for compilation has been written to: /home/jarvis/openairinterface5g/cmake_targets/log/rfsimulator.Rel14.txt
rfsimulator compiled
Compiling basicsimulator
Log file for compilation has been written to: /home/jarvis/openairinterface5g/cmake_targets/log/tcp_bridge_oai.Rel14.txt
tcp_bridge_oai compiled
Log file for compilation has been written to: /home/jarvis/openairinterface5g/cmake_targets/log/oai_eth_transpro.Rel14.txt
oai_eth_transpro compiled
liboai_transpro.so is linked to ETHERNET transport
10. Bypassing the Tests ...

至此基本的 eNB 和 UE build 完成,其他组件如 PHY Simulators ( https://gitlab.eurecom.fr/oai/openairinterface5g/-/wikis/OpenAirLTEPhySimul )等参见官方文档

2.4. Run

官方文档 https://gitlab.eurecom.fr/oai/openairinterface5g/-/blob/master/doc/RUNMODEM.md

其中基本组件(eNB、UE)的运行见 https://gitlab.eurecom.fr/oai/openairinterface5g/-/blob/master/doc/BASIC_SIM.md

注意若要连接 EPC 先启动 EPC,使用虚拟机时,EPC 和 RAN 都要使用桥接网络模式,同时每次启动 IP 可能变化,每次都要修改配置文件有关网络参数

2.4.1. Run eNB

eNB basic simulator 有两种模式,连接 EPC(S1 mode) 或者不连接(noS1 mode)

2.4.1.1. Running in FDD mode with EPC
2.4.1.1.1. Configure network interface

根据实际网络配置设置,和 EPC 中对应的网络接口应处于同一网段,注意修改为实际网卡名,类似于 1.3.3.

sudo ifconfig enp0s5:e1c 192.168.247.10 up
sudo ifconfig enp0s5:e1u 192.168.248.10 up
2.4.1.1.2. Edit configuration file

在 MME 配置文件中 TAI_LIST 下找到一组 TAI 配置类似 {MCC="208" ; MNC="93"; TAC = "600"; }, ,如果有多组选择其中一组

编辑 eNB 配置文件

sudo gedit ~/openairinterface5g/ci-scripts/conf_files/lte-fdd-basic-sim.conf

修改 tracking_area_code 的值和 MME 中 TAC 一致

修改 plmn_list = ( { mcc = 208; mnc = 93; mnc_length = 2; } ); 中的 mcc 的值和 MME 中 MCC 一致,mnc 的值和 MME 中 MNC 一致,mnc_length 的值根据实际 mnc 值的长度确定

修改 downlink_frequency 的值为 2680000000

修改 N_RB_DL 的值选择带宽,从 (25, 50, 100) 中选择

替换 CI_MME_IP_ADDR 为 MME 配置中 m1c 虚拟网卡的 IP 地址,例如本文档中是 enp0s5:m1c 的 IP 地址 192.168.247.102,根据实际情况设置

以下几项根据运行 eNB 的本机配置情况修改,参考 2.4.1.1.1.

ENB_INTERFACE_NAME_FOR_S1_MME 的值修改为 "enp0s5:e1c"

ENB_IPV4_ADDRESS_FOR_S1_MME 的值修改为 "192.168.247.10"

ENB_INTERFACE_NAME_FOR_S1U 的值修改为 "enp0s5:e1u"

ENB_IPV4_ADDRESS_FOR_S1U 的值修改为 "192.168.248.10"

ENB_IPV4_ADDRESS_FOR_X2C 的值修改为 "192.168.247.10"

2.4.1.1.3. Starting up
cd ~/openairinterface5g/
source oaienv
cd cmake_targets/lte_build_oai/build

ENODEB=1 sudo -E ./lte-softmodem -O $OPENAIR_HOME/ci-scripts/conf_files/lte-fdd-basic-sim.conf --basicsim
2.4.1.2. Running in TDD mode without any EPC
cd ~/openairinterface5g/
source oaienv
cd cmake_targets/lte_build_oai/build

# NOTE: Here is TDD mode, change to corresponding configuration file to use.
# ENODEB=1 sudo -E ./lte-softmodem -O $OPENAIR_HOME/ci-scripts/conf_files/lte-fdd-basic-sim.conf --basicsim --noS1
ENODEB=1 sudo -E ./lte-softmodem -O $OPENAIR_HOME/ci-scripts/conf_files/lte-tdd-basic-sim.conf --basicsim --noS1

2.4.2. Run UE

2.4.2.1. Edit configuration file

在 HSS 的 Cassandra DB 中查询需要的参数,在运行 EPC 的计算机上查询

cqlsh
DESCRIBE TABLES
use vhss;
select imsi,key,opc,msisdn from users_imsi;
quit

选择一组数据,修改 UE 的配置文件

sudo gedit ~/openairinterface5g/openair3/NAS/TOOLS/ue_eurecom_test_sfr.conf

MSIN 的值修改为 DB 中 imsi 的后10位

USIM_API_K 的值修改为 DB 中 key 的值

OPC 的值修改为 DB 中 opc 的值

MSISDN 的值修改为 DB 中 msisdn 的值

HPLMN 的值修改为 DB 中 imsi 的前5位

确认 OPLMN_LIST 中存在所使用的 HPLMN

2.4.2.2. Starting up
cd ~/openairinterface5g/
source oaienv

# Edit openair3/NAS/TOOLS/ue_eurecom_test_sfr.conf
cd cmake_targets/lte_build_oai/build

../../nas_sim_tools/build/conf2uedata -c $OPENAIR_HOME/openair3/NAS/TOOLS/ue_eurecom_test_sfr.conf -o .

sudo -E ./lte-uesoftmodem -C 2680000000 -r 25 --ue-rxgain 125 --basicsim [--noS1]

参数 -r 25 根据 eNB 的配置设置,N_RB_DL=25 使用 25,N_RB_DL=50 使用 50,N_RB_DL=100 使用 100

参数 -C 2680000000 是 downlink frequency,和 eNB 配置文件中的 downlink_frequency 值保持一致

--noS1 可选,如果要运行在 noS1 mode

注意:eNB 有 TDD 和 FDD 两种模式,每种有不同的配置文件,注意参数的对应。这里的参数配置示例是对应上面 FDD 模式的 eNB 配置的

2.4.3. Testing the data plane

S1 mode 即连接 EPC 的模式,noS1 mode 即不连接 EPC 的模式

2.4.3.1. In S1 mode

首先找到分配给 UE 的 IP 地址,在运行 UE 的计算机上运行

ifconfig oaitun_ue1

输出类似如下

oaitun_ue1 Link encap:UNSPEC  HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00  
          inet addr:12.1.1.2  P-t-P:12.1.1.2  Mask:255.0.0.0
...

其中 12.1.1.2 是 EPC 中 SPGW 分配给当前 UE 的 IP 地址

2.4.3.1.1. ping test

在运行 EPC 的计算机上运行

ping -I pdn -c 20 12.1.1.2
# ping -c 20 12.1.1.2

输出类似如下

在运行 UE 的计算机上运行

ping -I oaitun_ue1 -c 20 12.1.1.1

输出类似如下

2.4.3.1.2. iperf test

对于 DL iperf test

在运行 UE 的计算机上运行

iperf -B 12.1.1.2 -u -s -i 1 -fm -p 5001

在运行 EPC 的计算机上运行

iperf -c 12.1.1.2 -u -t 30 -b 10M -i 1 -fm -B 12.1.1.1 -p 5001

对于 UL iperf test

在运行 EPC 的计算机上运行

iperf -B 12.1.1.1 -u -s -i 1 -fm -p 5001

在运行 UE 的计算机上运行

iperf -c 12.1.1.1 -u -t 30 -b 2M -i 1 -fm -B 12.1.1.2 -p 5001
2.4.3.2. In noS1 mode

IP 地址是固定的,但是同样可以通过如下命令查看

在运行 UE 的计算机上运行

ifconfig oaitun_ue1

在运行 eNB 的计算机上运行

ifconfig oaitun_enb1
2.4.3.2.1. ping test
ping -I oaitun_ue1 -c 20 10.0.1.1
ping -I oaitun_enb1 -c 20 10.0.1.2
2.4.3.2.2. iperf test
iperf -B 10.0.1.2 -u -s -i 1 -fm
iperf -c 10.0.1.2 -u -b 1.00M -t 30 -i 1 -fm -B 10.0.1.1
  • 版权声明: 本博客所有文章除特别声明外,著作权归作者所有。转载请注明出处!
  • Copyrights © 2019-2021 Jarvis Li
  • 访问人数: | 浏览次数:

请我喝杯咖啡吧~

支付宝
微信