OAI 5G core network installation

preface

In the last blog, gNB was successfully installed using OAI, and then the 5G core network of OAI was installed. The main reference tutorials are as follows: https://gitlab.eurecom.fr/oai/cn5g/oai-cn5g-fed/-/blob/master/README.md

PS: because the core network is deployed through docker, it may be difficult to understand if you don't know docker. It's best to first understand the implementation principle of container image in docker.

The core network and gNB are installed on different hosts, which is also the configuration recommended by the official. It has not been tried to install these two on the same host. It is recommended to install them on two hosts for the first time to avoid unnecessary trouble.

The host of the core network also uses Ubuntu 18.04.06. It seems that the official hardware requirements are not too high. Mine is an integrated host of i5-10500T.

1, Install docker and docker compose

1. Install docker

The official tutorials are installed through docker and docker compose, so you should install these two software first. Here is the docker official website for reference https://www.docker.com/
It can be installed through the official automatic installation script of docker. Open the terminal and run the following commands

curl -fsSL https://get.docker.com | bash -s docker --mirror Aliyun

It may be slow. Some other domestic sources can also be used in this place. The installation will be faster. You can search by yourself.
After installation, you can

sudo docker --version

Check whether the installation is successful. After that, you can add the user name to the docker group, so that you don't need to add sudo when running the docker command in the future.

sudo usermod -a -G docker oai-5gc

Among them oai-5gc, if you want to change to your own user name, you can run it yourself and try to add it successfully.

Next, you need to register an account on dockerhub, https://hub.docker.com/

2. Install docker compose

For the installation of this part, you can also refer to the tutorial on the docker official website in the previous step.
Install docker compose through script

sudo curl -L "https://github.com/docker/compose/releases/download/1.27.4/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose

Among them, 1.27.4 is the version number. This version is the version given by the OAI official website. If there are changes later, you can change it yourself
The official address is as follows
https://gitlab.eurecom.fr/oai/cn5g/oai-cn5g-fed/-/blob/master/docs/DEPLOY_SA5G_MINI_DS_TESTER_DEPLOYMENT.md

After installation, apply executable permissions to the binary files of docker compose, and create a soft connection

sudo chmod +x /usr/local/bin/docker-compose
sudo ln -s /usr/local/bin/docker-compose /usr/bin/docker-compose

Finally, you can check whether the installation is successful through the docker compose -- version command.

3,python

You also need a python version of at least 3.6. Generally, it seems to come with Ubuntu. Check the version through the following command.

python3 --version 

2, Download Image

First, log in to the dockerHub account just registered through the command line.
Then download the corresponding image files one by one. If there is an interruption, you can try to run them again

$docker login
$docker pull ubuntu:bionic
$docker pull mysql:5.7
$docker pull rdefosseoai/oai-amf:latest
$docker pull rdefosseoai/oai-nrf:latest
$ docker pull rdefosseoai/oai-spgwu-tiny:latest
$ docker pull rdefosseoai/oai-smf:latest
$ docker pull rdefosseoai/oai-udr:latest
$ docker pull rdefosseoai/oai-udm:latest
$ docker pull rdefosseoai/oai-ausf:latest
$ docker pull rdefosseoai/oai-upf-vpp:latest

Then rename the downloaded image for easy operation

$ docker image tag rdefosseoai/oai-amf:latest oai-amf:latest
$ docker image tag rdefosseoai/oai-nrf:latest oai-nrf:latest
$ docker image tag rdefosseoai/oai-smf:latest oai-smf:latest
$ docker image tag rdefosseoai/oai-spgwu-tiny:latest oai-spgwu-tiny:latest
$ docker image tag rdefosseoai/oai-udr:latest oai-udr:latest
$ docker image tag rdefosseoai/oai-udm:latest oai-udm:latest
$ docker image tag rdefosseoai/oai-ausf:latest oai-ausf:latest
$ docker image tag rdefosseoai/oai-upf-vpp:latest oai-upf-vpp:latest

Remember to log out after that

docker logout

3, Download 5G core network source code

git clone --branch v1.2.1 https://gitlab.eurecom.fr/oai/cn5g/oai-cn5g-fed.git
cd oai-cn5g-fed
git checkout -f v1.2.1
./scripts/syncComponents.sh 

The execution time of the last step is relatively long. Wait patiently. The final results are as follows

4, Operation core network

First switch to oai-cn5g-fed / docker compose, and then run the following command to view the help.

python3 core-network.py --help

As shown in the figure below

Then you can run the corresponding commands according to your needs. I take a simple example. The commands and results are as follows. Then you can view the running container through the docker ps command. Or use the ifconfig command to view the network interface of each container in which docker runs

python3 ./core-network.py --type start-mini --fqdn no --scenario 1


When you need to stop the core network, you can save the logs of each container before. The commands are as follows:

docker logs oai-amf > amf.log
docker logs oai-smf > smf.log
docker logs oai-nrf > nrf.log
docker logs oai-spgwu > spgwu.log
python3 ./core-network.py --type stop-mini

The log file is still saved in the current folder, that is, the oai-cn5g-fed / docker compose folder.

5, Link gNB

setp1

Firstly, it is necessary to ensure that the core network host and the gNB host are under the same LAN, such as connected to the same router or switch, that is, the two hosts can ping each other. It is recommended to use a network cable to link the host and the router.
If ping fails, there may be several reasons:
1. Not under the same LAN
2. The firewalls of the two hosts are not turned off
3. Maybe the router has set up IP isolation to prohibit mutual ping between terminals. This is the problem with the Xiaomi router I use.

step2

If you can ping, add routing forwarding on the host of the gNB. The command is as follows:

sudo ip route add 192.168.70.128/26 via 192.168.28.153 dev eno1;

192.168.70.128/26 is the address of the network bridge created by the core network through docker. Generally, if the parameter of docker file is not modified, this does not need to be changed,
192.168.28.153 is the address of the core network host
eno1 is the name of the wired network card
In addition, note that the command to add a route is one-time, that is, it fails after shutdown and restart, and needs to be added again.

step3

Set the network parameters on the core network host. The commands are as follows:

sudo sysctl net.ipv4.conf.all.forwarding=1
sudo iptables -P FORWARD ACCEPT

Also note that the above commands are one-time and need to be added again after restart.

step4

After setting the parameters of the two hosts, you can test them. First start the core network of the core network host, and then ping each container in the core network through the gNB host. The addresses of each container are as follows, and the results are as follows:

step5

After the above steps are OK, you can try to run gNB,
First run the core network, and then run the following command on the gNB host:

cd cmake_targets/ran_build/build
sudo ./nr-softmodem -E --sa -O ../../../targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.106PRB.usrpb210.conf 

The operation results are as follows:

[notice] in this step, if you encounter a problem that no device is found, you can try adding - E to the running command, that is, run the following command:

sudo -E ./nr-softmodem -E --sa -O ../../../targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.106PRB.usrpb210.conf 

6, Summary

The above is about the process of using OAI to build a 5G core network. Since the mobile phone white card stage has not been carried out at present, the process of filling your own white card information into the database of the core network is not carried out when configuring the core network. If necessary, friends can check the official tutorial link given at the beginning.

The next step should be to burn a white card. If it succeeds, it should be recorded accordingly. Wish me good luck.

The road is blocked and long, the road is tortuous, and the future is bright!

Tags: Linux Docker Container

Posted on Fri, 03 Dec 2021 06:52:50 -0500 by Genesis730