Table of contents
Background
The 5G network consists of three main components: the User Equipment (UE), the 5G New Radio (gNodeB), and the core network (5GC). The srsRAN Project is an open-source 5G CU/DU software implementation, but it does not include a UE application. However, its 4G version, srsRAN 4G, has a UE implementation called srsUE. Open5GS is another open-source project that provides an implementation of the 5G Core. The srsUE can connect to the srs gNB using USPRs, but for lab setups, we can use the ZeroMQ-based virtual radio support provided by both srsUE and srs gNB.
I have set up this lab on both bare metal and OpenStack virtual machine, using the following configurations:
CPU: 4 Cores
RAM: 8 GB
OS: Ubuntu 20.04.5 LTS (5.15.0-71-generic) // should work for Ubuntu 22.04 also
Installation
Use the following commands to install the common dependency of UE, gNB.
sudo apt-get update
sudo apt-get install -y build-essential cmake libfftw3-dev libmbedtls-dev libboost-program-options-dev \
libconfig++-dev libsctp-dev git libtool pkg-config libyaml-cpp-dev libgtest-dev
As we are going to use virtual radio, ZeroMQ installation is required.
#install zeromq dev libraries
sudo apt-get install libzmq3-dev
#install czmq
git clone https://github.com/zeromq/czmq.git
cd czmq
./autogen.sh
./configure
make
sudo make install
sudo ldconfig
srsRAN gNB compilation, installation:
git clone https://github.com/srsRAN/srsRAN_Project.git
cd srsRAN_Project
#Checkout release 23_5, using stable release
git checkout release_23_5
mkdir build; cd build
cmake ../ -DENABLE_EXPORT=ON -DENABLE_ZEROMQ=ON
make -j $(nproc)
make test -j $(nproc)
sudo make install
srsRAN_4G UE compilation, installation:
git clone https://github.com/srsRAN/srsRAN_4G.git
cd srsRAN_4G
mkdir build; cd build
cmake ../ -DENABLE_ZEROMQ=ON
make -j $(nproc)
make test -j $(nproc)
sudo make install
open5GS core installation:
We will be using pre-compiled packages of open5GS.
#install MongoD, required by open5GS. For Ubuntu 22.04, source list file is different.
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 focal/mongodb-org/6.0 multiverse" | \ sudo tee /etc/apt/sources.list.d/mongodb-org-6.0.list
sudo apt-get update
sudo apt-get install -y mongodb-org
# install open5GS
sudo add-apt-repository ppa:open5gs/latest
sudo apt-get update
sudo apt-get install -y open5gs
Configuration
Configure open5GS:
Edit /etc/open5gs/amf.yaml
- Change mcc value to 001 and mnc value to 01 under guami:plmn_id, tai:plmn_id, plmn_support:plmn_id keys.
- Change tac value to 7 under tai key.
guami: - plmn_id: mcc: 001 mnc: 01 amf_id: region: 2 set: 1 tai: - plmn_id: mcc: 001 mnc: 01 tac: 7 plmn_support: - plmn_id: mcc: 001 mnc: 01 s_nssai: - sst: 1
As we are installing gNB and core on the same machine, no need to change IP address of the AMF and the UPF interfaces.
Restart the AMF
sudo systemctl restart open5gs-amfd
- Configure IMSI using dbctl cli
#download dbctl cli utility to insert imsi details
wget https://raw.githubusercontent.com/open5gs/open5gs/main/misc/db/open5gs-dbctl
chmod +x open5gs-dbctl
./open5gs-dbctl add 001010123456780 00112233445566778899aabbccddeeff 63BFA50EE6523365FF14C1F45F88737D
./open5gs-dbctl showpretty
Configure gNB:
Few of the config parameters need to be changed to run gNB over virtual radio (ZMQ). Download gnb.yaml from github to configs directory of srsRAN_Project.
cd srsRAN_Project
wget -P configs https://raw.githubusercontent.com/himanshu3/srsran_open5gs_5gsa/main/gnb.yaml
Configure UE:
- Download ue.conf from github to srsRAN_4G directory
wget https://raw.githubusercontent.com/himanshu3/srsran_open5gs_5gsa/main/ue.conf
Create a network namespace for the UE as we are using ZMQ.
sudo ip netns add ue1
E2E Tests
- Start gNB
sudo gnb -c $(SRSRAN_Project_ROOT)/configs/gnb.yaml
#you should see output similar to following:
Available radio types: zmq.
--== srsRAN gNB (commit 49a07c710) ==--
Connecting to AMF on 10.73.80.121:38412
Cell pci=1, bw=10 MHz, dl_arfcn=368500 (n3), dl_freq=1842.5 MHz, dl_ssb_arfcn=368410, ul_freq=1747.5 MHz\==== gNodeB started ===
Type to view trace
- Start UE
sudo srsue $(srsRAN_4G_ROOT)/ue.conf
#you should see output similar to following:
Supported RF device list: zmq file
CHx base_srate=11.52e6
Current sample rate is 1.92 MHz with a base rate of 11.52 MHz (x6 decimation) CH0 rx_port=tcp://127.0.0.1:2000 CH0 tx_port=tcp://127.0.0.1:2001
Current sample rate is 11.52 MHz with a base rate of 11.52 MHz (x1 decimation) Current sample rate is 11.52 MHz with a base rate of 11.52 MHz (x1 decimation)
Waiting PHY to initialize ... done!
Attaching UE... Random Access Transmission: prach_occasion=0, preamble_index=0, ra-rnti=0x39, tti=174
Random Access Complete. c-rnti=0x4601, ta=0 RRC Connected
PDU Session Establishment successful. IP: 10.45.0.3
RRC NR reconfiguration successful.
Run Uplink ping
sudo ip netns exec ue1 ping 10.45.0.1
Run Downlink ping
ping 10.45.0.3 # replace ip with UE IP displayed UE logs.