1.Open5Gs and UERANSIM - mhradhika/5GTrial GitHub Wiki

Architecture

This was implemented by installing the Core and UE/gNB in separate machines. Please refer to the official documentation before following the steps in our wiki.

5G Core

Installation

The following are the prerequisites for installing Open5gs (assuming a minimal installation of Ubuntu 22.04 LTS desktop)

Note:- The version of Open5GS used here is 2.6.4

sudo apt install gnupg Free and open-source software program that provides cryptographic privacy and authentication for data communication.

sudo apt install curl curl is a command-line tool that allows you to make requests to URLs and retrieve or send data using various protocols, such as HTTP, HTTPS, FTP, and more.

curl -fsSL https://pgp.mongodb.com/server-6.0.asc | sudo gpg -o /usr/share/keyrings/mongodb-server-6.0.gpg --dearmor

echo "deb [ arch=amd64,arm64 signed-by=/usr/share/keyrings/mongodb-server-6.0.gpg] https://repo.mongodb.org/apt/ubuntu jammy/mongodb-org/6.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-6.0.list

sudo apt update Update repositories since ppa-list was updated.

sudo apt install -y mongodb-org Document-oriented NoSQL database.

sudo systemctl enable mongod Enables mongodb on system-startup.

sudo add-apt-repository ppa:open5gs/latest Adds the Open5Gs repository to apt-repository list.

sudo apt update Update respositories since ppa-list was updated

sudo apt install open5gs

curl -fsSL https://deb.nodesource.com/setup_18.x | sudo -E bash -

sudo apt install nodejs Required to install the Web-UI(Optional)

sudo apt install net-tools Needed to use the command ifconfig

sudo apt install git

Configuration

Consider installing the packages timeshift and setup daily automatic snapshots or snapshot manually to revert system back to previous working condition.

sudo apt install timeshift

The following setup as done on 2 Ubuntu 22.04 LTS desktops connected to network via Ethernet with 1 used as the 5G core and the other used as the UERANSIM machine.

addresses

Consider adding 'level: debug' like given below for every configuration files to get a more detailed log file.

Screenshot from 2023-07-03 14-39-03

Configuration files.

  1. amf.yaml

amf_conf

Change the IP address in the highlighted text to IP address of your network interface(CORE).

  1. bsf.yaml : No Changes Required.

  2. hss.yaml : No Changes Required.

  3. nrf.yaml : No Changes Required.

  4. pcf.yaml : No Changes Required.

  5. scp.yaml : No Changes Required.

  6. sgwu.yaml : No Changes Required.

  7. udr.yaml : No Changes Required.

  8. ausf.yaml : No Changes Required.

  9. mme.yaml : No Changes Required.

  10. nssf.yaml : No Changes Required.

  11. pcrf.yaml : No Changes Required.

  12. sgwc.yaml : No Changes Required.

  13. smf.yaml : No Changes Required.

  14. udm.yaml : No Changes Required.

  15. upf.yaml

upf_conf

Change the highlighted address to IP address of network interface(CORE).

Create a start/restart and stop script to start all the above services.

restart.sh

#!/bin/bash
sudo systemctl restart open5gs-mmed
sudo systemctl restart open5gs-sgwcd
sudo systemctl restart open5gs-sgwud
sudo systemctl restart open5gs-smfd
sudo systemctl restart open5gs-amfd
sudo systemctl restart open5gs-upfd
sudo systemctl restart open5gs-hssd
sudo systemctl restart open5gs-pcrfd
sudo systemctl restart open5gs-nrfd
sudo systemctl restart open5gs-scpd 
sudo systemctl restart open5gs-ausfd
sudo systemctl restart open5gs-udmd
sudo systemctl restart open5gs-pcfd
sudo systemctl restart open5gs-nssfd
sudo systemctl restart open5gs-bsfd
sudo systemctl restart open5gs-udrd
sudo systemctl restart open5gs-webui
sudo systemctl restart open5gs-sgwud

Similalry a stop script stop.sh

#!/bin/bash
sudo systemctl stop open5gs-mmed
sudo systemctl stop open5gs-sgwcd
sudo systemctl stop open5gs-smfd
sudo systemctl stop open5gs-amfd
sudo systemctl stop open5gs-sgwud
sudo systemctl stop open5gs-upfd
sudo systemctl stop open5gs-hssd 
sudo systemctl stop open5gs-pcrfd
sudo systemctl stop open5gs-nrfd
sudo systemctl stop open5gs-scpd
sudo systemctl stop open5gs-ausfd
sudo systemctl stop open5gs-udmd
sudo systemctl stop open5gs-pcfd
sudo systemctl stop open5gs-nssfd
sudo systemctl stop open5gs-bsfd
sudo systemctl stop open5gs-udrd
sudo systemctl stop open5gs-webui

Register subscriber information

  1. Connect to http://localhost:3000

  2. Login with admin account Username : admin Password : 1234

  3. Go to Subscriber menu

  4. Click the + button to add new subscriber

  5. Fill the IMSI number as 999700000000001 and save

  6. Execute the restart script. All services must be restarted after adding a new subscriber.

IPtables

iptables_1

iptables_2

UE/gNB

Note:- The 5g LTE/5G RAN (Radio Access Network) simulator used here is UERANSIM version 3.2.6

Installation

First install all the dependencies

sudo apt install make gcc g++

sudo apt install libsctp-dev lksctp-tools iproute2

sudo snap install cmake --classic

Clone UERANSIM repository using

git clone https://github.com/aligungr/UERANSIM

Build UERANSIM

cd UERANSIM

make

Configuration

Go to the config folder using cd config

Configure the UE.

Open the open5gs-ue.yaml file in the config folder using

sudo nano open5gs-ue.yaml

The gnbSearchList must have the IP address of the device running UERANSIM(ue and gnb).

Make sure the supi has the same imsi value as the one registered in the device running open5gs.

open5gs-ue.yaml now looks like this

Screenshot from 2023-07-07 09-43-56

Configure the gNB

Open the open5gs-gnb.yaml in the config folder using

sudo nano open5gs-gnb.yaml

The linkIP, ngapIP and the gtpIP must be the IP address of the device running UERANSIM(ue and gnb).

The address in amfConfigs must be the IP address of the device running the core network(open5gs)

open5gs-gnb.yaml now looks like this

Screenshot from 2023-07-07 09-45-05

Build UE and gNB

To build the gNB use

sudo ./build/nr-gnb -c config/open5gs-gnb.yaml

The terminal screenshot below shows successful build of gNB .

Screenshot from 2023-07-07 11-50-48

To build the UE open another terminal and use

sudo ./build/nr-ue -c config/open5gs-ue.yaml

The terminal screenshot below shows successful build of UE .

Screenshot from 2023-07-07 11-43-05

Troubleshooting

  1. If gNB does not create a successful PDU session,on the host running the core, check the upf log file usually located at /var/logs/open5gs and see if UPF is initialized successfully. If not, comment sudo systemctl restart open5gs-sgwud and run the restart script.This is due to the sgwud service using the same port as the upfd service.

  2. iptables rules like -P FORWARD DROP and -A INPUT -s 10.45.0.0/16 -j DROP on the core system will not allow PDU seesion to be established.