Deploying 5G Core Network with Open5GS and UERANSIM

Happy devSecOps

(λx.x)eranga
Effectz.AI
8 min readNov 7, 2021

--

Background

In this post I’m gonna discuss about deploying 5G-Core network with Open5GS which is open source implementation of 5G mobile core network. To test the 5G core network functions I have used UERANSIM which is open source 5G UE and RAN(gNodeB) simulator. All source codes/deployments which related to this post available on gitlab. Please clone the repo and continue the post. In this post I have installed Open5GS as native Linux daemon service. In future post I will discuss about installing Open5GS with Kubernets and Helm Charts.

5G Architecture

The 5th Generation(5G) mobile network is a new global wireless standard after 1G, 2G, 3G, and 4G networks. 5G enables a new kind of network that is designed to connect virtually everyone and everything together including machines, objects, and devices. 5G wireless technology is meant to deliver higher multi-Gbps peak data speeds, ultra low latency, more reliability, massive network capacity, increased availability, and a more uniform user experience to more users. Higher performance and improved efficiency empower new user experiences and connects new industries.

The 3rd Generation Partnership Project(3GPP) is defining standards for 5G. 3GPP is an umbrella term for a number of standards organizations which develop protocols for mobile telecommunications. According to the 3GPP the 5G System(5GS) will have three main components 1). User Equipment(UE), 2). 5G Radio Access Network(5G-RAN), 3). 5G Core Network (5GC). UEs are the 5G enabled devices(user equipments). 5G-RAN(also know as gNB) is a type of network infrastructure used commonly for mobile networks that consist of radio base stations with large antennas. A RAN wirelessly connects user equipment to a core network. 5G Core network facilitate various Network Functions such as session management, authentication, policy control, data storage etc. There are several open source 5G Core network implementations available, Free5GC, Open5GS are two popular 5G Core network implementations.

5G Core Architecture

Unlike previous cellular networks 5G Core network architecture designed with Network Function Virtualization and Software Defined Networking. Basically 5G Core network designed with microservices-based design pattern. The different data services and requirements of the 5GC(also called Network Functions) implemented as microservices. These microservices(Network Functions) will be deployed as cloud native application. The 5G Core System consists of the following network functions(NF). These functions are divided into two main planes: the control plane and the user plane.

The interaction of these services(with UE and 5G-RAN) and their respective interfaces described in the following figure. When deploying 5G Core network, we basically deploy all these services on cloud as cloud native application.

Open5GS

The Open5GS is an open source implementation of 5G mobile core network. The ultimate goal of this project is to implement the 5G Core network defined in 3GPP Release.Currently, it supports 3GPP Release 16 with providing 5G Core(AMF, SMF+PGW-c, UPF+PGW-u, PCF, UDR, UDM, AUSF, NRF) network functions and Evolved Packet Core(MME, SGW-c, SGW-u, HSS, and PCRF) network functions.

UERANSIM

UERANSIM is an open source 5G UE & 5G RAN(gNodeB) implementation. It can be considered as a 5G mobile phone and a base station in basic terms. There are 3 main interface in UE/RAN perspective, 1) Control Interface (between RAN and AMF), 2) User Interface (between RAN and UPF), 3) Radio Interface (between UE and RAN). UERANSIM supports to run with Open5GS and Free5GC 5G Core networks. We can connect UERANSIM to one of these 5G Core network and test the functionality.

5G Core Deployment

In this scenario I have deployed 5G Core network with Open5GS and gNB/UE simulation with UERANSIM. Open5GS deployed on one server(IP 172.31.13.16) and UERANSIM deployed on another server(IP 172.31.13.37). The architecture of the deployment described in the following figure.

Following are the main steps that need to follow in the deployment. If you are setting up this environment on cloud(e.g AWS, gGloud) make sure to open all the TCP and SCTP ports between the servers in the LAN(gNB to AMF communication happens via SCTP).

1. Install Open5GS

Open5GS can be installed as native Linux daemon services. Also it’s available to deploy with Docker, Kubernetes and Helm Charts. I have deployed it as a native Linux daemon service application. When running it start the 5G network functions as linux daemon services. Following is the way to install Open5GS on server1.

2. Setup Open5GS

I’m deploying 5G Core and gNB on separate servers. So I need to configure the NGAP bind address of the AMF(5G Core running server IP) and the GTPU bind address of the UPF(5G Core running server IP). Then only gNB and UE can connect to 5G Core network. If you are running an gNB stack and 5G Core on same server, you will not need to make these changes. Following are the configurations that I have done. After doing these configurations I have restarted the AMF and UPF services.

3. NAT Port Forwarding

In order to bridge between the 5G Core UPF and WAN(Internet), I need enable IP forwarding and add a NAT rule to the IP Tables. Following are the NAT port forwarding I have done. Without this port forwarding the connectivity from 5G Core to internet would not work.

4. Register UE Device

Next I need to register the UE device on 5G Core. Open5GS provides a WebUI application. I can register the UE device via connecting to the WebUI. Following is the way to do that.

The WebUI start on port 3000 on server1. Connect to WebUI and login with admin/1423 credentials. Then add new subscriber with IMSI: 901700000000001 and other default information.

5. Install UERANSIM

Next I have installed the UERANSIM on server2. The installation done with make file available in UERANSIM repository. Following is the way to install UERANSIM.

6. Setup gNB

UERANSIM contains two parts gNB and UE. The gNB config files which related to Open5GS located in UERANSIM/config/open5gs-gnb.yaml. I need to configure the linkIp, ngapIp, gtpIp and amfConfigs: address in the config file. linkIp, ngapIp, gtpIp are setup with server2 IP address(IP address of UERANSIM running server). The amfConfigs: address is the server1 IP address(IP address of the Open5GC running server). The gNB can be started with the UERANSIM/build/nr-gnb script by using the UERANSIM/config/open5gs-gnb.yaml config file.

7. Setup UE

The UERANSIM UE config files which related to Open5GS located in UERANSIM/config/open5gs-ue.yaml. I need to configure the gnbSearchList with the IP address of the server2(IP address of UERANSIM running server). The UE can be started with the UERANSIM/build/nr-ue script by using the UERANSIM/config/open5gs-ue.yaml config file. The other thing to notice is, the open5gs-ue.yaml defines the UE device configurations. We have used these configurations when registering the subscriber in the Open5GC 5G Core via the WebUI.

8. Test 5G Network

When running UERANSIM UE it creates PDU session and TUN network interface uesimtun0. You can find the PDU Session IP and TUN address in the UE logs(TUN interface[uesimtun0, 10.45.0.3]). We can use UE’s internet connection from other application via using this TUN interface. For an example if we use simple curl command with uesimtun0 interface(e.g curl --interface uesimtun0 "https://httpbin.org/get" ) it will route the packet to internet via the Open5GC 5G Core network as described in following diagram.

Additionally UERANSIM provides a UERANSIM/build/nr-binder tool to bind external applications with TUN interface. We can bind bind the uesimtun0 interface to almost any application using UERANSIM/build/nr-binder . Following is the way to use UERANSIM/build/nr-binder with different applications. I have tested it with ping, curl, docker, python applications.

9. Image Streaming via 5G Core

In above setup, UERANSIM UE TUN interface(uesimtun0) can only be accessible via the UERANSIM running machine. Which means we can only connect to 5G core network from the UERANSIM running machine. In my scenario, I wanted to stream images to a TCP server(which resides in the public internet) from external client(which resides outside the UERANSIM server) via the 5G core network. Example scenario would be streaming images which captures from a VR device to the streaming server via 5G core network. To achieve this setup I have done some workaround using TCP proxy server. Following is the architecture of the setup.

UERANSIM service running on a server with public IP 3.237.100.204. Image streaming service running on a server with public IP 100.27.44.103. I have run TCP proxy server on port 7654 inside 3.237.100.204 server. The image streaming service running on 7654 port on 100.27.44.103 server. The TCP proxy server forwarding the the incoming packets of 3.237.100.204:7654 to 100.27.44.103:7654. I have used following docker command to run the The TCP proxy server.

This docker command added into a shell script called tcp-proxy.sh and run it with nr-binder. Then all the traffic of the TCP proxy service going through the 5G core network.

Following is a simple image streaming server written with Python. It listen on port 7654 and incoming images saved in a directory called out. I have run the streaming server via python3 stream-server.py command.

Following is the image streaming client application written with Python. It reads the image from disk and send the streams to the TCP proxy server which runs on 3.237.100.204:7654 server. Then proxy server forward the image streams to the image streaming server 100.27.44.103:7654 via 5G core network. I have run the streaming client via python3 stream-client.py command.

Reference

  1. https://www.rajarshipathak.com/2020/01/beginners-guide-for-5g-core-network-architecture.html
  2. https://www.grandmetric.com/2017/06/05/5g-core-network-a-short-overview/
  3. https://open5gs.org/open5gs/docs/guide/01-quickstart/
  4. https://www.free5gc.org/installations/stage-3-sim-install/
  5. https://nickvsnetworking.com/my-first-5g-core-open5gs-and-ueransim/
  6. https://www.viavisolutions.com/en-us/5g-architecture
  7. https://frontjang.info/entry/Open5GC-UERANSIM-%EC%9C%BC%EB%A1%9C-5G-%EB%84%A4%ED%8A%B8%EC%9B%8C%ED%81%AC-%EA%B5%AC%EC%B6%95%ED%95%98%EA%B8%B0-1-%EA%B5%AC%EC%84%B1-%EB%B0%8F-%EC%84%A4%EC%B9%98

--

--