free5gc installation and test
Reference
Environment
Name | Version |
---|---|
OS | Ubuntu 18.04.4 |
Go | 1.14.4 linux/amd64 |
kernel | 5.0.0-23-generic(MUST for UPF |
Installation
A. Pre-requisite
-
需要内核版本
5.0.0-23-generic
,uname -r # 5.0.0-23-generic
更换内核方法直接使用:
sudo apt-get install linux-image-5.0.0-23-generic sudo apt-get install linux-headers-5.0.0-23-generic
-
Go language requirement
- 如果存在安装的其他Go版本,
- 卸载.
sudo rm -rf /usr/local/go
- Install Go 1.14.4
wget https://dl.google.com/go/go1.14.4.linux-amd64.tar.gz sudo tar -C /usr/local -zxvf go1.14.4.linux-amd64.tar.gz # 后面的配置和下面一样
- 卸载.
- 如果是第一次安装Go
- Install Go 1.14.4
wget https://dl.google.com/go/go1.14.4.linux-amd64.tar.gz sudo tar -C /usr/local -zxvf go1.14.4.linux-amd64.tar.gz mkdir -p ~/go/{bin,pkg,src} echo 'export GOPATH=$HOME/go' >> ~/.bashrc echo 'export GOROOT=/usr/local/go' >> ~/.bashrc echo 'export PATH=$PATH:$GOPATH/bin:$GOROOT/bin' >> ~/.bashrc source ~/.bashrc
- Install Go 1.14.4
- 如果存在安装的其他Go版本,
-
Required packages for control plane 控制侧需要的依赖包
sudo apt -y update sudo apt -y install mongodb wget git sudo systemctl start mongodb
-
Required packages for user plane 用户侧需要的依赖包
sudo apt -y update sudo apt -y install git gcc cmake autoconf libtool pkg-config libmnl-dev libyaml-dev go get -u github.com/sirupsen/logrus
这里遇到了一个问题, Go 下载模块的时候需要外网.
解决办法–添加代理
B. Install Control Plane Entities
-
Clone free5GC project
cd ~ git clone --recursive -b v3.0.3 -j `nproc` https://github.com/free5gc/free5gc.git cd free5gc
(Optional) If you want to use the nightly version, runs:
cd ~/free5gc git checkout master git submodule sync git submodule update --init --jobs `nproc` git submodule foreach git checkout master git submodule foreach git pull --jobs `nproc`
-
Run the script to install dependent packages
cd ~/free5gc go mod download
不要改变任何文件名, In step 2, the folder name should remain free5gc.
-
Complie free5gc
./build.sh
C. Install User Plane Function(UPF)
UPF使用C编写,需要单独编译
-
Check the kernel version
uname -r
Get linux kernel module 5G GTP-U
git clone -b v0.1.0 https://github.com/PrinzOwO/gtp5g.git cd gtp5g make sudo make install
-
Build from sources
cd ~/free5gc/src/upf mkdir build cd build cmake .. make -j`nproc`
Note: UPF’s config is located at
free5gc/src/upf/build/config/ufcfg.yaml
Run
A. Run Core Network
-
Option 1. Run network function service individually, e.g. AMF(redo this for
each NF)cd ~/free5gc ./bin/amf
Note For N3IWF needs specific configuration in section B
-
Option 2. Run whole core network with command
./run.sh
运行结果图如下
B. Run N3IWF(Individually)
TODO
Test
cd ~/free5gc
chmod +x ./test.sh
-
a. TestRegistration
(in directory: ~/free5gc) ./test.sh TestRegistration
测试的时候遇到如下问题
-
b. TestServiceRequest
./test.sh TestServiceRequest
-
c. Other test
TODO