目录

硬件设备要求

OAI 要在基于 Intel 处理器架构的 PCs 上运行 eNB 和 UE,这是因为 DSP(数字信号处理器)大量的使用到了整数指令集(SSE, SSE2, SSS3, SSE4, and AVX2)。而对于 EPC,则可以在任意的 64 位 Linux 操作系统上运行,但不能使用容器来运行,因为 EPC 需要安装内核模块,eNB 对电脑配置的要求比 EPC 要更高一些。

OAI eNB 和 UE 在以下 CPU 型号完成了测试

  • Generation 3/4/5/6 Intel Core i5,i7
  • Generation 2/3/4 Intel Xeon
  • Intel Atom Rangeley, E38xx, x5-z8300

针对 UE 还在下列具体的 CPU 型号完成了测试

  • Intel Core i5-6600K CPU @ 3.50GHz × 4
  • Intel Core i5-6600 CPU @ 3.30GHz × 4
  • Intel Core i7-8700 CPU @ 3.20GHz × 6

当你希望与基站进行 Real-Time Operation 交互时,还需要特殊的硬件设备支持

  • RF 前端设备:NI/Ettus USRP B200/B210 需要 PC 具有 USB3.0 插口。

SIM Card 要求:在部署 OAI LTE SDR 之前,需要 SIM Card,并对其进行编程。

  • 可编程 USIM 卡:例如 Sysmocom 的 sysmoUSIM-SJS1 型号 USIM Card(http://shop.sysmocom.de/products/sysmousim-sjs1)
  • SIM Card 读卡机:PC/SC Smart Card Reader
  • SIM Card 烧录软件:PySIM

物料购买

设备清单

  • EPC:PC1(Intel Core i5,双网卡)
  • eNB:PC2(Intel Core i5,单网卡,USB3.0)
  • RF 前端:USRP B210
  • UE:安卓手机
  • USIM Card:Sysmocom sysmoUSIM-SJS1

物料购买

  • USIM Card 相关

  • USRP 210 相关

部署架构图



NOTE:官方不建议使用无线网卡代替 PGW 连接 PDN 的网关,所以对于只有单网卡的 PCs 可以参考下面的实物连线图。这么做的话需要分配静态 IP 地址来 Ping 通两台 PCs,注意千万别用 DHCP。

安装 LTE/EPC

注:以下所有操作均通过 root 用户执行

前期准备

运维相关

国内软件源

  1. sudo vim /etc/apt/sources.list
  2. deb http://mirrors.aliyun.com/ubuntu/ xenial main
  3. deb-src http://mirrors.aliyun.com/ubuntu/ xenial main
  4. deb http://mirrors.aliyun.com/ubuntu/ xenial-updates main
  5. deb-src http://mirrors.aliyun.com/ubuntu/ xenial-updates main
  6. deb http://mirrors.aliyun.com/ubuntu/ xenial universe
  7. deb-src http://mirrors.aliyun.com/ubuntu/ xenial universe
  8. deb http://mirrors.aliyun.com/ubuntu/ xenial-updates universe
  9. deb-src http://mirrors.aliyun.com/ubuntu/ xenial-updates universe
  10. deb http://mirrors.aliyun.com/ubuntu/ xenial-security main
  11. deb-src http://mirrors.aliyun.com/ubuntu/ xenial-security main
  12. deb http://mirrors.aliyun.com/ubuntu/ xenial-security universe
  13. deb-src http://mirrors.aliyun.com/ubuntu/ xenial-security universe

运维工具

  1. sudo apt-get install git vim openssh-server i7z subversion

NOTE:请科学上网。e.g.

  1. sudo gedit ~/.gitconfig
  2. [http]
  3. proxy = http://127.0.0.1:1080
  4. [https]
  5. proxy = https://127.0.0.1:1080

操作系统要求

用于部署 OAI 的操作系统强烈建议使用 Ubuntu Linux 发行版,因为 OAI 是在 Ubuntu 上进行开发的,所以这是最稳定的部署系统。

  • 对于 old tags(older than v0.6.1_tdd)的 OAI 应该使用 Ubuntu 14.04 LTS with low-latency kernel 3.19;
  • 对于 newer tags(starting v1.0.0 or develop)的 OAI 则应该使用 Ubuntu 16.04 with low-latency kernel 4.8.0 or higher。

NOTE:本文操作系统为 Ubuntu 16.04 LTS。

NOTE 1:不建议在虚拟机上运行 OAI,因为某些虚拟机可能没有加载需要的 CPU models。

NOTE 2:不建议在同一台 PC 上安装 eNB 和 EPC,因为存在对不同软件/内核版本的依赖。

首先更新操作系统环境

  1. sudo apt-get update
  2. sudo apt-get upgrade

内核要求

OAI 其实对内核非常敏感,很多莫名其表的错误都是由内核不适应导致的,所以切记检查内核的版本。

NOTE:实际上 EPC 不依赖 low-latency kernel,但是为了部署的流畅度,也安装上。

安装 Kernel 4.8.0(最低要求)

  1. wget http://kernel.ubuntu.com/~kernel-ppa/mainline/v4.8/linux-headers-4.8.0-040800-generic_4.8.0-040800.201610022031_amd64.deb
  2. wget http://kernel.ubuntu.com/~kernel-ppa/mainline/v4.8/linux-image-4.8.0-040800-generic_4.8.0-040800.201610022031_amd64.deb
  3. sudo dpkg -i linux-headers-4.8.0-040800-generic_4.8.0-040800.201610022031_amd64.deb
  4. sudo dpkg -i linux-image-4.8.0-040800-generic_4.8.0-040800.201610022031_amd64.deb

安装 low-latency kernel(低延时内核)

  1. sudo apt-get install linux-lowlatency
  2. sudo apt-get install linux-image-`uname -r | cut -d- -f1-2`-lowlatency
  3. sudo apt-get install linux-headers-`uname -r | cut -d- -f1-2`-lowlatency
  4. sudo reboot

NOTE:重新登录可以看见当前内核版本,e.g. Welcome to Ubuntu 16.04.6 LTS (GNU/Linux 4.15.0-70-lowlatency x86_64)

检查是否加载了 GTP 内核模块(for openair-cn)

  1. uname -a
  2. # 临时加载 gtp 模块
  3. sudo modprobe gtp
  4. dmesg | tail # You should see something that says about GTP kernel module
  5. # e.g.
  6. # [ 111.364332] gtp: GTP module loaded (pdp ctx size 104 bytes)

CPU Frequency scaling,将 CPU 频率打满

CPU 调频功能允许操作系统通过提高或降低 CPU 频率来达到省电目的,这里我们将 CPU 的频率打满,不让操作系统自己控制 CPU 的频率。

NOTE:这里主要是对 eNB 节点进行的操作,因为 eNB 对 Real-Time 操作具有很高的要求。

NOTE 1:将 CPU 频率打满会损耗 CPU 的寿命,酌情处理。

在 BIOS 中移除电源管理功能(P-states, C-states)

在 BIOS 中关闭超线程(hyper-threading)

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

  1. sudo vi /etc/default/grub
  2. GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"
  3. GRUB_CMDLINE_LINUX_DEFAULT="quiet intel_pstate=disable"
  4. GRUB_CMDLINE_LINUX_DEFAULT="quiet processor.max_cstate=1 intel_idle.max_cstate=0 idle=poll"
  5. sudo update-grub

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

  1. sudo vi /etc/modprobe.d/blacklist.conf
  2. # 末尾添加
  3. blacklist intel_powerclamp
  4. reboot

关闭 CPU 睿频

  1. sudo apt-get install cpufrequtils
  2. sudo vi /etc/default/cpufrequtils
  3. ...
  4. GOVERNOR="performance"
  5. sudo update-rc.d ondemand disable
  6. sudo /etc/init.d/cpufrequtils restart
  7. # 查看睿频是否成功关闭,会看到所有频率都在 C0%
  8. i7z

再次查看 CPU 功率,此时的 CPU 功率应该有了很大的提升,而且频率变动极小

  1. watch grep \"cpu MHz\" /proc/cpuinfo

NOTE:如果没有成功关闭 C-state 的话还需要执行以下操作

  1. sudo gedit /etc/default/grub
  2. #GRUB_CMDLINE_LINUX_DEFAULT="quiet splash”
  3. #GRUB_CMDLINE_LINUX_DEFAULT="quiet intel_pstate=disable"
  4. #GRUB_CMDLINE_LINUX_DEFAULT="processor.max_cstate=1 intel_idle.max_cstate=0 idle=poll”
  5. GRUB_CMDLINE_LINUX_DEFAULT="quiet splash quiet intel_pstate=disable processor.max_cstate=1 intel_idle.max_cstate=0 idle=poll"
  6. sudo update-grub
  7. sudo reboot

eNodeB

获取 RAN 的代码

  1. git config --global http.sslverify false
  2. git config --global http.postBuffer 1048576000
  3. git clone https://gitlab.eurecom.fr/oai/openairinterface5g.git --branch v0.6.1
  4. git checkout -b v0.6.1

配置 eNB:需要更改和确认的部分如下:前三行在 MME 中可以查到,之后就是把 IP 对应换成自己的 EPC 和 eNB 所在的 IP 地址。

  1. sudo vi ~/openairinterface5g/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf
  2. eNBs =
  3. (
  4. {
  5. // Tracking area code, 0x0000 and 0xfffe are reserved values
  6. tracking_area_code = "1";
  7. mobile_country_code = "208";
  8. mobile_network_code = "92";
  9. ...
  10. ////////// MME parameters:
  11. mme_ip_address = ( { ipv4 = "192.168.0.1";
  12. ipv6 = "192:168:30::17";
  13. active = "yes";
  14. preference = "ipv4";
  15. }
  16. );
  17. NETWORK_INTERFACES :
  18. {
  19. ENB_INTERFACE_NAME_FOR_S1_MME = "enp0s31f6";
  20. ENB_IPV4_ADDRESS_FOR_S1_MME = "192.168.0.2/24";
  21. ENB_INTERFACE_NAME_FOR_S1U = "enp0s31f6";
  22. ENB_IPV4_ADDRESS_FOR_S1U = "192.168.0.2/24";
  23. ENB_PORT_FOR_S1U = 2152; # Spec 2152
  24. };

安装依赖包:这里采用了「文件安装 + USRP 驱动安装」的方式

  1. cd ~/openairinterface5g
  2. source oaienv
  3. cd cmake_targets
  4. sudo ./build_oai -I -w USRP

如有需要,可以按照 USRP 官方文档安装相应的 UHD 驱动

https://kb.ettus.com/Building_and_Installing_the_USRP_Open-Source_Toolchain_(UHD_and_GNU_Radio)_on_Linux

编译安装 eNB + USRP(使用空口硬件传输)

  1. cd ~/openairinterface5g
  2. source oaienv
  3. cd cmake_targets
  4. ./build_oai --eNB -c -w USRP
  1. Will install external packages
  2. Setting hardware to: OAI_USRP
  3. CMAKE_CMD=cmake ..
  4. RF HW set to OAI_USRP
  5. Flags for Deadline scheduler: False
  6. Flags for CPU Affinity: False
  7. 2. Setting the OAI PATHS ...
  8. OPENAIR_DIR = /root/openairinterface5g
  9. FreeDiameter prefix not found, install freeDiameter if EPC, HSS
  10. Installing packages
  11. ...
  12. Installing ASN1. The log file for ASN1 installation is here: /root/openairinterface5g/cmake_targets/log/asn1c_install_log.txt
  13. Cloning into '/opt/ssh'...
  14. installing packages for USRP support
  15. ...
  16. [INFO] Images destination: /usr/share/uhd/images
  17. [INFO] Target usrp1_b100_fw_default is up to date.
  18. [INFO] Target x3xx_x310_fpga_default is up to date.
  19. [INFO] Target usrp2_n210_fpga_default is up to date.
  20. [INFO] Target n230_n230_fpga_default is up to date.
  21. [INFO] Target usrp1_b100_fpga_default is up to date.
  22. [INFO] Target b2xx_b200_fpga_default is up to date.
  23. [INFO] Target usrp2_n200_fpga_default is up to date.
  24. [INFO] Target e3xx_e320_fpga_default is up to date.
  25. [INFO] Target n3xx_n310_fpga_default is up to date.
  26. [INFO] Target b2xx_b205mini_fpga_default is up to date.
  27. [INFO] Target octoclock_octoclock_fw_default is up to date.
  28. [INFO] Target usrp2_usrp2_fw_default is up to date.
  29. [INFO] Target usrp2_n200_fw_default is up to date.
  30. [INFO] Target usrp2_usrp2_fpga_default is up to date.
  31. [INFO] Target b2xx_common_fw_default is up to date.
  32. [INFO] Target n3xx_n320_fpga_default is up to date.
  33. [INFO] Target b2xx_b200mini_fpga_default is up to date.
  34. [INFO] Target usrp1_usrp1_fpga_default is up to date.
  35. [INFO] Target usrp2_n210_fw_default is up to date.
  36. [INFO] Target n3xx_n300_fpga_default is up to date.
  37. [INFO] Target e3xx_e310_fpga_default is up to date.
  38. [INFO] Target b2xx_b210_fpga_default is up to date.
  39. [INFO] Downloading x3xx_x300_fpga_default-gbb85bdff.zip, total size: 19053.994 kB
  40. [INFO] Downloading usb_common_windrv_default-g14000041.zip, total size: 4838.302 kB
  41. [INFO] Images download complete.
  42. 3. building the compilation directives ...
  43. 10. Bypassing the Tests ...

EPC

配置 FQDN

  1. sudo vim /etc/hosts
  2. ...
  3. 127.0.0.1 localhost
  4. 127.0.1.1 epc.openair4G.eur epc
  5. 127.0.1.1 hss.openair4G.eur hss
  6. hostname -f

获取 CN 代码(包括 MME、S/P-GW 及 HSS)

  1. git config --global http.sslverify false
  2. git config --global http.postBuffer 1048576000
  3. //新版
  4. sudo git clone https://github.com/OPENAIRINTERFACE/openair-cn.git
  5. //史前的旧版
  6. #git clone https://gitlab.eurecom.fr/oai/openair-cn.git
  7. cd openair-cn
  8. git checkout -b v0.5.0

准备 EPC config files in /usr/local/etc/oai

  1. sudo mkdir -p /usr/local/etc/oai/freeDiameter
  2. sudo cp ~/openair-cn/etc/mme.conf /usr/local/etc/oai
  3. sudo cp ~/openair-cn/etc/hss.conf /usr/local/etc/oai
  4. sudo cp ~/openair-cn/etc/spgw.conf /usr/local/etc/oai
  5. sudo cp ~/openair-cn/etc/acl.conf /usr/local/etc/oai/freeDiameter
  6. sudo cp ~/openair-cn/etc/mme_fd.conf /usr/local/etc/oai/freeDiameter
  7. sudo cp ~/openair-cn/etc/hss_fd.conf /usr/local/etc/oai/freeDiameter

HSS

安装依赖包

  1. cd ~/openair-cn/scripts
  2. # -i 表示安装 Missing Packages
  3. ./build_hss -i

这里会安装 MySQL 和 phpmyadmin,过程中会要求输出 MySQL 的密码,一般设置为 linux。phpmyadmin 的用户名为 root,密码为 linux。安装成功后在浏览器中输入 http://127.0.0.1/phpmyadmin。如果发现访问不成功,则需要手动安装(视实际情况):

  1. # 安装 apache2
  2. sudo apt-get install apache2
  3. # 安装 PHP
  4. apt-get install php7.0
  5. apt-get install libapache2-mod-php7.0
  6. # 安装 MySQL
  7. sudo apt-get install mysql-server mysql-client
  8. # 安装 phpmyadmin
  9. sudo apt-get install phpmyadmin
  10. sudo ln -s /etc/phpmyadmin/apache.conf /etc/apache2/conf-available/phpmyadmin.conf
  11. sudo a2enconf phpmyadmin
  12. sudo /etc/init.d/apache2 reload
  13. sudo service apache2 restart

修改 HSS 配置

  1. 主要是修改 MySQL 连接信息,其中 OPERATOR_key 也可以先不管,用这个默认的就可以,是后面 SIM 卡的相关信息。
  1. sudo vim /usr/local/etc/oai/hss.conf
  2. HSS :
  3. {
  4. ## MySQL mandatory options
  5. MYSQL_server = "127.0.0.1"; # HSS S6a bind address
  6. MYSQL_user = "root"; # Database server login
  7. MYSQL_pass = "linux"; # Database server password
  8. MYSQL_db = "oai_db"; # Your database name
  9. ## HSS options
  10. #OPERATOR_key = "@OPERATOR_KEY@"; # OP key matching your database
  11. #OPERATOR_key = "1006020f0a478bf6b699f15c062e42b3"; # OP key matching your database
  12. OPERATOR_key = "11111111111111111111111111111111"; # OP key matching your database
  13. RANDOM = "true"; # True random or only pseudo random (for subscriber vector generation)
  14. ## Freediameter options
  15. FD_conf = "@PREFIX@/freeDiameter/hss_fd.conf";
  16. PID_DIRECTORY = "@PID_DIRECTORY@"; # /var/run is the default
  17. };
  1. 修改 HSS freeDiameter 配置。
  1. sudo vim /usr/local/etc/oai/freeDiameter/hss_fd.conf
  2. # The first parameter in this section is Identity, which will be used to
  3. # identify this peer in the Diameter network. The Diameter protocol mandates
  4. # that the Identity used is a valid FQDN for the peer. This parameter can be
  5. # omitted, in that case the framework will attempt to use system default value
  6. # (as returned by hostname --fqdn).
  7. Identity = "hss.openair4G.eur";
  8. # In Diameter, all peers also belong to a Realm. If the realm is not specified,
  9. # the framework uses the part of the Identity after the first dot.
  10. Realm = "openair4G.eur";

编译安装

  1. cd ~/openair-cn/scripts
  2. sudo ./build_hss -c

MME

安装依赖包

  1. cd ~/openair-cn/scripts
  2. sudo ./build_mme -i

修改 MME 配置

  1. 修改 MME Network Interface 配置,关注 S1 和 S11 接口。

    NOTE:S1 和 eNB 和 EPC 连接的接口的统称;S11 是 S-GW 与 MME 连接的接口。
  1. sudo vim /usr/local/etc/oai/mme.conf
  2. NETWORK_INTERFACES :
  3. {
  4. # MME binded interface for S1-C or S1-MME communication (S1AP), can be ethernet interface, virtual ethernet interface, we don't advise wireless interfaces
  5. MME_INTERFACE_NAME_FOR_S1_MME = "enp0s25"; # YOUR NETWORK CONFIG HERE
  6. MME_IPV4_ADDRESS_FOR_S1_MME = "192.168.0.1/24"; # CIDR, YOUR NETWORK CONFIG HERE
  7. # MME binded interface for S11 communication (GTPV2-C)
  8. MME_INTERFACE_NAME_FOR_S11 = "lo"; # YOUR NETWORK CONFIG HERE
  9. MME_IPV4_ADDRESS_FOR_S11 = "127.0.11.1/8"; # CIDR, YOUR NETWORK CONFIG HERE
  10. MME_PORT_FOR_S11 = 2123; # YOUR NETWORK CONFIG HERE
  11. #S10 Interface
  12. MME_INTERFACE_NAME_FOR_S10 = "@MME_INTERFACE_NAME_FOR_S10@"; # YOUR NETWORK CONFIG HERE
  13. MME_IPV4_ADDRESS_FOR_S10 = "@MME_IPV4_ADDRESS_FOR_S10@"; # CIDR, YOUR NETWORK CONFIG HERE
  14. MME_PORT_FOR_S10 = 2123; # YOUR NETWORK CONFIG HERE
  15. };
  1. 修改 MME freediameter 配置。
  1. sudo vim /usr/local/etc/oai/freeDiameter/mme_fd.conf
  2. Identity = "epc.openair4G.eur";
  3. Realm = "openair4G.eur";
  4. ConnectPeer= "hss.openair4G.eur" {ConnectTo = "127.0.0.1"; No_SCTP ; No_IPv6; Prefer_TCP; No_TLS; port = 3868; realm = "openair4G.eur";};

编译安装

  1. cd ~/openair-cn/scripts
  2. sudo ./build_mme -c

S/PGW

安装依赖包

  1. cd ~/openair-cn/scripts
  2. sudo ./build_spgw -i

修改 S/PGW 配置

  1. 修改 SGW 配置,关注 S1-U 和 S11 接口。
  1. sudo vim /usr/local/etc/oai/spgw.conf
  2. S-GW :
  3. {
  4. NETWORK_INTERFACES :
  5. {
  6. # S-GW binded interface for S11 communication (GTPV2-C), if none selected the ITTI message interface is used
  7. SGW_INTERFACE_NAME_FOR_S11 = "lo"; # STRING, interface name, YOUR NETWORK CONFIG HERE
  8. SGW_IPV4_ADDRESS_FOR_S11 = "127.0.11.2/8"; # STRING, CIDR, YOUR NETWORK CONFIG HERE
  9. SGW_UDP_PORT_FOR_S11 = 2123; # INTEGER, port number, PREFER NOT CHANGE UNLESS YOU KNOW WHAT YOU ARE DOING
  10. # S-GW binded interface for S1-U communication (GTPV1-U) can be ethernet interface, virtual ethernet interface, we don't advise wireless interfaces
  11. SGW_INTERFACE_NAME_FOR_S1U_S12_S4_UP = "enp0s25"; # STRING, interface name, YOUR NETWORK CONFIG HERE, USE "lo" if S-GW run on eNB host
  12. SGW_IPV4_ADDRESS_FOR_S1U_S12_S4_UP = "192.168.0.1/24"; # STRING, CIDR, YOUR NETWORK CONFIG HERE
  13. SGW_UDP_PORT_FOR_S1U_S12_S4_UP = 2152; # INTEGER, port number default is 2152, PREFER NOT CHANGE UNLESS YOU KNOW WHAT YOU ARE DOING
  14. # S-GW binded interface for S5 or S8 communication, not implemented, so leave it to none
  15. SGW_INTERFACE_NAME_FOR_S5_S8_UP = "none"; # STRING, interface name, DO NOT CHANGE (NOT IMPLEMENTED YET)
  16. SGW_IPV4_ADDRESS_FOR_S5_S8_UP = "0.0.0.0/24"; # STRING, CIDR, DO NOT CHANGE (NOT IMPLEMENTED YET)
  17. };
  1. 修改 PGW 配置,关注 SGi 接口。
  1. sudo vim /usr/local/etc/oai/spgw.conf
  2. P-GW =
  3. {
  4. INSTANCE = @INSTANCE@; # 0 is the default
  5. PID_DIRECTORY = "@PID_DIRECTORY@"; # /var/run is the default
  6. NETWORK_INTERFACES :
  7. {
  8. # P-GW binded interface for S5 or S8 communication, not implemented, so leave it to none
  9. PGW_INTERFACE_NAME_FOR_S5_S8 = "none"; # STRING, interface name, DO NOT CHANGE (NOT IMPLEMENTED YET)
  10. # P-GW binded interface for SGI (egress/ingress internet traffic)
  11. PGW_INTERFACE_NAME_FOR_SGI = "enp0s25"; # STRING, YOUR NETWORK CONFIG HERE
  12. PGW_IPV4_ADDRESS_FOR_SGI = "192.168.0.1/24"; # STRING, CIDR, YOUR NETWORK CONFIG HERE
  13. PGW_MASQUERADE_SGI = "yes"; # STRING, {"yes", "no"}. YOUR NETWORK CONFIG HERE, will do NAT for you if you put "yes", only if OVS/OPENFLOW not used.
  14. UE_TCP_MSS_CLAMPING = "no"; # STRING, {"yes", "no"}, only if OVS/OPENFLOW not used.
  15. };

编译安装

  1. cd ~/openair-cn/scripts
  2. sudo ./build_spgw -c

GTP-U handled by OVS in PGW

启动 LTE/EPC

测试前准备好 wireshark 抓包,启动 LTE/EPC 所有进程后可以抓到 S1 SetupRequest 和 S1 SetupResponse 的包,后面如果有 UE 接入,还会抓到 NAS 信令的包。

安装 gitlab.eurecom.fr 的 certificates

  1. 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
  2. cd ~/openair-cn/scripts
  3. sudo ./check_hss_s6a_certificate /usr/local/etc/oai/freeDiameter/ hss.openair4G.eur
  4. sudo ./check_mme_s6a_certificate /usr/local/etc/oai/freeDiameter/ epc.openair4G.eur
  5. root@epc:~/openair-cn/scripts# ll /usr/local/etc/oai/freeDiameter/
  6. total 60
  7. drwxr-xr-x 2 root root 4096 11 29 15:32 ./
  8. drwxr-xr-x 3 root root 4096 11 29 15:25 ../
  9. -rw-r--r-- 1 root root 1052 11 29 13:21 acl.conf
  10. -rw-r--r-- 1 root root 960 11 29 15:32 hss.cacert.pem
  11. -rw-r--r-- 1 root root 916 11 29 15:32 hss.cakey.pem
  12. -rw-r--r-- 1 root root 3071 11 29 15:32 hss.cert.pem
  13. -rw-r--r-- 1 root root 4123 11 29 14:04 hss_fd.conf
  14. -rw-r--r-- 1 root root 887 11 29 15:32 hss.key.pem
  15. -rw-r--r-- 1 root root 960 11 29 15:32 mme.cacert.pem
  16. -rw-r--r-- 1 root root 916 11 29 15:32 mme.cakey.pem
  17. -rw-r--r-- 1 root root 3071 11 29 15:32 mme.cert.pem
  18. -rw-r--r-- 1 root root 4150 11 29 14:45 mme_fd.conf
  19. -rw-r--r-- 1 root root 891 11 29 15:32 mme.key.pem

NOTEhss.openair4G.eurepc.openair4G.eur 之前有空格

HSS

编辑环境变量

  1. cd ~/openair-cn; vi oaienv
  2. export OPENAIRCN_DIR=$(pwd)
  3. export PREFIX=/usr/local/etc/oai
  4. export PID_DIRECTORY=/var/run
  5. export REALM="openair4G.eur"
  6. declare -A HSS_CONF
  7. HSS_CONF[@PREFIX@]=$PREFIX
  8. HSS_CONF[@PID_DIRECTORY@]=$PID_DIRECTORY
  9. HSS_CONF[@REALM@]=$REALM
  10. for K in "${!HSS_CONF[@]}"; do
  11. egrep -lRZ "$K" $PREFIX | xargs -0 -l sed -i -e "s|$K|${HSS_CONF[$K]}|g"
  12. done
  • 第一次启动 HSS
  1. cd ~/openair-cn; source oaienv; cd scripts
  2. sudo ./run_hss -i ~/openair-cn/src/oai_hss/db/oai_db.sql

NOTE-i ~/openair-cn/src/oai_hss/db/oai_db.sql 会安装 oai_db 数据库,再次运行会重装数据库,仅执行一次。

  • 后续启动 HSS
  1. cd openair-cn; source oaienv; cd scripts; sudo ./run_hss

启动日志

  1. root@epc:~/openair-cn/scripts# sudo ./run_hss -i ~/openair-cn/src/oai_hss/db/oai_db.sql
  2. setting import DB flag to: 1
  3. OPENAIRCN_DIR = /root/openair-cn
  4. mysqladmin: [Warning] Using a password on the command line interface can be insecure.
  5. Database "oai_db" dropped
  6. mysql: [Warning] Using a password on the command line interface can be insecure.
  7. HSS: oai_db creation succeeded
  8. mysql: [Warning] Using a password on the command line interface can be insecure.
  9. HSS: oai_db import succeeded
  10. ==== EURECOM OPENAIR-HSS vBranch: heads/v0.5.0 Abrev. Hash: d1d0e45 Date: Mon Sep 30 15:46:32 2019 +0200 ====
  11. Initial built: Nov 29 2019 14:04:31
  12. Please report any bug to: openaircn-user@lists.eurecom.fr
  13. Parsing configuration file: /usr/local/etc/oai/hss.conf
  14. Configuration
  15. * Global:
  16. - File .............: /usr/local/etc/oai/hss.conf
  17. * MYSQL:
  18. - Server ...........: 127.0.0.1
  19. - Database .........: oai_db
  20. - User .............: root
  21. - Password .........: *****
  22. * FreeDiameter:
  23. - Conf file ........: /usr/local/etc/oai//freeDiameter/hss_fd.conf
  24. * Security:
  25. - Operator key......: ********************************
  26. - Random ......: true
  27. Initializing db layer
  28. Initializing db layer: DONE
  29. Initialized random
  30. Query: SELECT `imsi`,`key`,`OPc` FROM `users`
  31. IMSI: 20834123456789Key: 2b.d6.45.9f.82.c5.b3.00.95.2c.49.10.48.81.ff.48.
  32. OPc: 5e.9c.a4.4b.ac.ee.f2.88.d5.d8.46.65.55.ff.97.e0.
  33. RijndaelKeySchedule: K 2BD6459F82C5B300952C49104881FF48
  34. Compute opc:
  35. K: 2BD6459F82C5B300952C49104881FF48
  36. In: 11111111111111111111111111111111
  37. Rinj: 76FC81817B423A50600E9580B6270D48
  38. Out: 67ED90906A532B41711F8491A7361C59
  39. Query: UPDATE `users` SET `OPc`=UNHEX('67ed90906a532b41711f8491a7361c59') WHERE `users`.`imsi`='20834123456789'
  40. IMSI 20834123456789 Updated OPc 5e9ca44baceef288d5d8466555ff97e0 -> 67ed90906a532b41711f8491a7361c59
  41. 1 rows affected
  42. ...
  43. ...
  44. Initializing s6a layer
  45. 10:10:22 NOTI libfdproto '1.2.1' initialized.
  46. 10:10:22 NOTI libgnutls '3.4.10' initialized.
  47. 10:10:22 NOTI HASHLIST is enabled
  48. 10:10:22 DBG Core state: 0 -> 1
  49. 10:10:22 NOTI libfdcore '1.2.1' initialized.
  50. 10:10:22 DBG Generating fresh Diffie-Hellman parameters of size 1024 (this takes some time)...
  51. 10:10:22 DBG Loading : /usr/local/lib/freeDiameter/acl_wl.fdx
  52. 10:10:22 NOTI Loading (acl_wl) extension.
  53. 10:10:22 NOTI Extension ACL_wl initialized with configuration: '/usr/local/etc/oai/freeDiameter/acl.conf'
  54. 10:10:22 DBG Loading : /usr/local/lib/freeDiameter/dict_nas_mipv6.fdx
  55. 10:10:23 NOTI Loading (dict_nas_mipv6) extension.
  56. 10:10:23 DBG Dictionary Extension 'MIPv6 NAS-to-HAAA Interaction' initialized
  57. 10:10:23 DBG Loading : /usr/local/lib/freeDiameter/dict_s6a.fdx
  58. 10:10:23 NOTI Dictionary Extension 'S6A from 3GPP standard v.10.5' initialized
  59. 10:10:23 NOTI Unable to resolve symbol 'fd_ext_init2' for extension /usr/local/lib/freeDiameter/acl_wl.fdx:
  60. 10:10:23 NOTI Unable to resolve symbol 'fd_ext_init2' for extension /usr/local/lib/freeDiameter/dict_nas_mipv6.fdx:
  61. 10:10:23 NOTI Unable to resolve symbol 'fd_ext_init2' for extension /usr/local/lib/freeDiameter/dict_s6a.fdx:
  62. 10:10:23 NOTI All extensions loaded.
  63. 10:10:23 NOTI freeDiameter configuration:
  64. 10:10:23 NOTI Default trace level .... : +1
  65. 10:10:23 NOTI Configuration file ..... : /usr/local/etc/oai//freeDiameter/hss_fd.conf
  66. 10:10:23 NOTI Diameter Identity ...... : hss.openair4G.eur (l:17)
  67. 10:10:23 NOTI Diameter Realm ......... : openair4G.eur (l:13)
  68. 10:10:23 NOTI Tc Timer ............... : 30
  69. 10:10:23 NOTI Tw Timer ............... : 30
  70. 10:10:23 NOTI Local port ............. : 3868
  71. 10:10:23 NOTI Local secure port ...... : 5868
  72. 10:10:23 NOTI Number of SCTP streams . : 3
  73. 10:10:23 NOTI Number of clients thr .. : 5
  74. 10:10:23 NOTI Number of app threads .. : 4
  75. 10:10:23 NOTI Local endpoints ........ : Default (use all available)
  76. 10:10:23 NOTI Local applications ..... : (none)
  77. 10:10:23 NOTI Flags : - IP ........... : Enabled
  78. 10:10:23 NOTI - IPv6 ......... : DISABLED
  79. 10:10:23 NOTI - Relay app .... : DISABLED
  80. 10:10:23 NOTI - TCP .......... : Enabled
  81. 10:10:23 NOTI - SCTP ......... : DISABLED (at compilation)
  82. 10:10:23 NOTI - Pref. proto .. : TCP
  83. 10:10:23 NOTI - TLS method ... : Separate port
  84. 10:10:23 NOTI TLS : - Certificate .. : /usr/local/etc/oai/freeDiameter/hss.cert.pem
  85. 10:10:23 NOTI - Private key .. : /usr/local/etc/oai/freeDiameter/hss.key.pem
  86. 10:10:23 NOTI - CA (trust) ... : /usr/local/etc/oai/freeDiameter/hss.cacert.pem (1 certs)
  87. 10:10:23 NOTI - CRL .......... : (none)
  88. 10:10:23 NOTI - Priority ..... : (default: 'NORMAL')
  89. 10:10:23 NOTI - DH bits ...... : 1024
  90. 10:10:23 NOTI Origin-State-Id ........ : 1575425422
  91. 10:10:23 NOTI Loaded extensions: '/usr/local/lib/freeDiameter/acl_wl.fdx'[/usr/local/etc/oai/freeDiameter/acl.conf], loaded
  92. 10:10:23 NOTI Loaded extensions: '/usr/local/lib/freeDiameter/dict_nas_mipv6.fdx'[(no config file)], loaded
  93. 10:10:23 NOTI Loaded extensions: '/usr/local/lib/freeDiameter/dict_s6a.fdx'[(no config file)], loaded
  94. 10:10:23 DBG Core state: 1 -> 2
  95. 10:10:23 NOTI Local server address(es): 172.18.20.190{---L-} 192.168.0.1{---L-}
  96. 10:10:23 DBG Core state: 2 -> 3
  97. Initializing s6a layer: DONE

配置数据库:访问 http://127.0.0.1/phpmyadmin,在 oai_db 数据库里修改/添加一会儿要进行测试的 USIM 卡的信息,例如:USIM IMSI 是 208930100001111,key 值是 8baf473f2f8fd09487cccbd7097c6862,OPC 是 e734f8734007d6c5ce7a0508809e7e9c。则:

- mmeidentity 表里添加 epc.openair4G.eur 项

- users 表里修改 imsi=208930100001111 的 key 值为 8baf473f2f8fd09487cccbd7097c6862

- users 表里修改 OPC 为 e734f8734007d6c5ce7a0508809e7e9c,同时修改它的 mmeidentity_idmmeidentity 为你刚刚在 mmeidentity 里添加的新项的 ID

或者使用 SQL 语句进行修改

  1. sudo mysql -u root -p
  2. use oai_db;
  3. select * from mmeidentity;
  4. update mmeidentity set mmehost="epc.openair4G.eur" where idmmeidentity=6;
  5. update users set mmeidentity_idmmeidentity=6 where imsi=208930100001111;

MME & S/P-GW

  • MME
  1. cd openair-cn; source oaienv; cd scripts; ./run_mme
  • S/P-GW

    NOTE:需要首先运行 HSS
  1. cd openair-cn; source oaienv; cd SCRIPTS; sudo -E ./run_spgw

eNB

  • 启动 eNB
  1. cd openairinterface5g; source oaienv
  2. cd cmake_targets/lte_build_oai/build
  3. sudo ./lte-softmodem -d -O ~/openairinterface5g/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf
  4. # sudo -E ./lte-softmodem -O $OPENAIR_DIR/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf

Connect the UE, it should attach to network and be able to reach internet through OAI network

自动化脚本

一键启动 EPC:

  1. #!/bin/sh
  2. YOURNAME='kujou'
  3. while :
  4. do
  5. stillRunning=$(ps -A | grep "run_hss" |grep -v "grep")
  6. if [ "$stillRunning" ] ; then
  7. echo "HSS was already started by another way"
  8. else
  9. pkill -9 hss
  10. pkill -9 mme
  11. pkill -9 spgw
  12. echo "HSS was not started"
  13. echo "Starting service ..."
  14. /home/$YOURNAME/openair-cn/scripts/run_hss &
  15. fi
  16. sleep 2
  17. stillRunning=$(ps -A | grep "run_mme" |grep -v "grep")
  18. if [ "$stillRunning" ] ; then
  19. echo "MME was already started by another way"
  20. else
  21. pkill -9 hss
  22. pkill -9 mme
  23. pkill -9 spgw
  24. echo "MME was not started"
  25. echo "Starting service ..."
  26. /home/$YOURNAME/openair-cn/scripts/run_mme &
  27. fi
  28. sleep 2
  29. stillRunning=$(ps -A | grep "run_spgw" |grep -v "grep")
  30. if [ "$stillRunning" ] ; then
  31. echo "SPGW was already started by another way"
  32. else
  33. pkill -9 hss
  34. pkill -9 mme
  35. pkill -9 spgw
  36. echo "SPGW was not started"
  37. echo "Starting service ..."
  38. /home/$YOURNAME/openair-cn/scripts/run_spgw &
  39. fi
  40. sleep 6
  41. done
  • 一键关闭 EPC
  1. #!/bin/bash
  2. sudo pkill -9 hss
  3. sudo pkill -9 mme
  4. sudo pkill -9 spgw
  5. sudo ps -A | grep hss
  6. sudo ps -A | grep mme
  7. sudo ps -A | grep spgw

COST UE

前提条件

  1. eNB 侧运行 scope 可以弹出观察窗,且不会提示 eNB 没有 associated with MME;
  2. EPC 侧可以观测到 MME 与 eNB 连上了。

写白卡

将 http://127.0.0.1/phpmyadmin 里面的参数写到 USIM 卡。

  • OAI 预设了 10 个 IMSI: 20892010000110[0~9]
  • Ki: 6874736969202073796d4b2079650a73
  • OPC: 504f20634f6320504f50206363500a4f
  • R1-R5: 4000204060
  • 短消息中心随便填

EXAMPLE

  • 写卡:

  • 读卡:

  • 手动添加 OAI DB 的 users 记录:

  • 总共可以加 10 条记录

手机设置

  • 添加 APN(Access Point Network),开启数据漫游
  • 插入白卡,重启手机
  • 扫描网络

注:测试机安装一款网优分析软件,e.g. 信号大师、网优大师。信号大师可以锁定网锁频段,在测试时锁频段后可以加快接入 eNB 的速度。

问题 1

问题:安装 HSS 依赖包过程中错误。

  1. Cloning into 'freediameter'...
  2. remote: Enumerating objects: 10135, done.
  3. remote: Counting objects: 100% (10135/10135), done.
  4. remote: Compressing objects: 100% (9796/9796), done.
  5. error: RPC failed; curl 56 GnuTLS recv error (-9): A TLS packet with unexpected length was received.
  6. fatal: The remote end hung up unexpectedly
  7. fatal: early EOF
  8. fatal: index-pack failed

分析:git clone 连接中断。

解决:重试。

问题 2

问题:编译安装 S/P-GW 过程中错误。

  1. Install GTP kernel module
  2. Do you want to install modified GTP kernel module for OVS ? <y/N> y
  3. Check kernel
  4. Kernel in 4.9.1...4.9.108 required. Aborting installation
  5. Error: SPGW software installation failed

Workaround:不安装 OVS。

参考文档

https://blog.csdn.net/prowc/article/details/75253440

https://blog.csdn.net/xrh003/article/details/75285108

http://www.doc88.com/p-1186932021431.html

https://blog.csdn.net/BUPTOctopus/article/details/81560514

https://www.mobibrw.com/2018/10729

https://blog.csdn.net/qq_42030961/article/details/82751991

https://blog.csdn.net/qq_42030961/article/details/82695682

https://blog.csdn.net/qq_42030961/article/details/82740296

https://blog.csdn.net/qq_42030961/article/details/84039098

https://zhuanlan.zhihu.com/p/25675218

https://blog.csdn.net/feifei_csdn/article/details/80364770

https://blog.csdn.net/huangkangying/article/details/8104463

OAI SDR LTE 基站部署的更多相关文章

  1. 使用GnuRadio+OpenLTE+SDR搭建4G LTE基站(上)

    0×00 前言 在移动互联网大规模发展的背景下,智能手机的普及和各种互联网应用的流行,致使对无线网络的需求呈几何级增长,导致移动运营商之间的竞争愈发激烈.但由于资费下调等各种因素影响,运营商从用户获得 ...

  2. LTE基站开局流程脚本的具体含义

    1.全局参数配置MOD ENODEB(修改基站): ENODEBID=2015(基站标识2015), NAME="安职-1"(基站名称), ENBTYPE=DBS3900_LTE( ...

  3. LTE基站开局流程

    1.全局参数配置 MOD  ENODEB :修改基站 ADD  CNOPERATOR: 添加运营商 ADD  CNOPERATORTA:添加跟踪区(TA) 2.设备参数配置(机柜.机框.RRU.光纤链 ...

  4. GSM Hacking Part① :使用SDR扫描嗅探GSM网络

    0×00 写在开头 近期,发现Crazy Danish Hacker在YouTuBe发布了一个挺不错的教程视频:使用SDR嗅探监听GSM网络的通信流量(GSM Sniffing Teaser – So ...

  5. LTE Module User Documentation(翻译15)——示例程序、参考场景以及故障检测和调试技巧

    LTE用户文档 (如有不当的地方,欢迎指正!)     21 Examples Programs(示例程序)   路径 src/lte/examples/ 包含一些示例仿真程序,这些例子表明如何仿真不 ...

  6. The architecture of LTE network.

    3GPP定义的LTE网络架构结构变得扁平化,无线RNC/BSC 消失,只有eNodeB.控制面使用MME进行处理,用户面使用SGW和PGW进行处理.相比GSM和UMTS,在逻辑接口上定义了S1/X2逻 ...

  7. 使用OpenBTS基站测试物联网模块安全性

    0×00 引子 近年来,随着云计算.物联网技术的快速发展,物联网的理念和相关技术产品已经广泛渗透到社会经济民生的各个领域,越来越多的穿戴设备.家用电器通过蓝牙.Wi-Fi.Li-Fi.z-wave.L ...

  8. LTE时代的定位技术:OTDOA,LPP,SUPL2.0

    LTE时代的定位技术:OTDOA,LPP,SUPL2.0 移动定位技术的发展历程 如今智能手机已经在整个社会普及,数量众多的手机应用成为了人们生活当中不可或缺的一部分.越来越多的手机应用都用到了手机定 ...

  9. LTE Module User Documentation(翻译8)——核心网(EPC)

    LTE用户文档 (如有不当的地方,欢迎指正!) 14 Evolved Packet Core (EPC)   我们现在讲解如何编写一个仿真程序——除了 LTE 无线接入网外,还允许仿真 EPC. EP ...

  10. LTE切换与TAU问题

    假如有两个LTE基站A B(同频组网) AB TAC不同 且添加了双向邻区关系 现终端开机重选至A然后往B方向移动 是先切换呢?还是先进性TAU更新 这个没有影响,,TAU并非需要在IDLE状态下才能 ...

随机推荐

  1. 在Keycloak中实现多租户并在ASP.NET Core下进行验证

    Keycloak是一个功能强大的开源身份和访问管理系统,提供了一整套解决方案,包括用户认证.单点登录(SSO).身份联合.用户注册.用户管理.角色映射.多因素认证和访问控制等.它广泛应用于企业和云服务 ...

  2. Lustre架构介绍的阅读笔记-NFS兼容性

    本文是在阅读Introduction to Lustre* Architecture的Traditional Network File Systems vs Lustre时的笔记. Lustre is ...

  3. OpenHarmony有氧拳击之设备端开发

    一.简介 在一个风和日丽,阳光明媚的下午,码农们都像往常一样正在专注地码代码.突然前面的小哥哥站起来,手握开发板,来回出拳.这是怎么回事? 原来这是一款拳击互动游戏,本文将带你一同解开其中的奥秘.开发 ...

  4. Git安装和配置教程:Windows/Mac/Linux三平台详细图文教程,带你一次性搞定Git环境

    Git是一款免费.开源的分布式版本控制系统,广泛应用于软件开发领域.随着开源和云计算的发展,Git已经成为了开发者必备的工具之一.本文将为大家介绍Git在Windows.Mac和Linux三个平台上的 ...

  5. 面试必备HashMap源码解析

    Map的实现有很多种,而HashMap算是最经典的实现之一了吧,在平时的使用中,绝大部分的使用也都是HashMap,我记得刚入行那会,脑子里对Map的使用就是Map map = new HashMap ...

  6. 格式化字符串走过的坑 pwn109

    格式化字符串走过的坑 pwn109 今天做的一道题有一个坑我调试半天终于打通了,格式化字符串的坑,确实不少,东西也比较多容易忘记,怎么说呢,功夫在平时,经验少了 老规矩先看一下保护 Full RELR ...

  7. 视频播放测试地址(MP4、M3U8 格式)

    最近在开发视频播放相关的业务功能,开发测试时,需要涉及到 MP4.M3U8 等视频格式. 我每次找测试视频地址时,都要找很久,现在把我在网上收集到的 MP4.M3U8 格式视频地址放在这里,希望帮助到 ...

  8. k8s之helm部署mysql集群

    一.简介 Helm Helm 是 Kubernetes 的包管理器. Chart Helm使用的包格式称为 chart.chart存储在Chart Repository. chart就是一个描述Kub ...

  9. Spring Cloud OpenFeign:基于Ribbon和Hystrix的声明式服务调用

    Spring Cloud OpenFeign:基于Ribbon和Hystrix的声明式服务调用 SpringCloud学习教程 SpringCloud Spring Cloud OpenFeign 是 ...

  10. UE4中HTC Vive 手柄如何抓取物体

    想知道 HTC Vive 手柄如何抓取物体? HTC Vive 的手柄有许多功能,在游戏里你可以用手柄射箭,可以用手柄拾取木棍等等,但是这些是如何设置的呢?来看看我们的公开课教程吧. 本期教程为上半部 ...