# 5G Core - The Installation of 5G Core(free5gc) ## Prerequisites ### Linux Kernel Version Kernel mus version 5.0.0-23-generic or 5.4.x version of the Linux kernel. free5gc uses the gtp5g kernel module, which has been tested and compiled against that kernel versions only. ``` uname -r ``` ![image](https://hackmd.io/_uploads/r1RTKDHtT.png) ### Install Golang Install Golang with compatible version : ```` wget https://dl.google.com/go/go1.18.10.linux-amd64.tar.gz sudo tar -C /usr/local -zxvf go1.18.10.linux-amd64.tar.gz mkdir -p ~/go/{bin,pkg,src} # The following assume that your shell is bash: echo 'export GOPATH=$HOME/go' >> ~/.bashrc echo 'export GOROOT=/usr/local/go' >> ~/.bashrc echo 'export PATH=$PATH:$GOPATH/bin:$GOROOT/bin' >> ~/.bashrc echo 'export GO111MODULE=auto' >> ~/.bashrc source ~/.bashrc ```` ![image](https://hackmd.io/_uploads/rySfcvSFa.png) ![image](https://hackmd.io/_uploads/Hy7F5DBYa.png) ![image](https://hackmd.io/_uploads/S1Uc5vSFp.png) ![image](https://hackmd.io/_uploads/SkHn5vHYa.png) ![image](https://hackmd.io/_uploads/Bk0AqvSKa.png) ![image](https://hackmd.io/_uploads/r1UZoPrK6.png) ### Control-plane Supporting Packages Install Mongodb for Supporting Control-Plane : ``` sudo apt -y update sudo apt -y install mongodb wget git sudo systemctl start mongodb ``` ![image](https://hackmd.io/_uploads/B1sNjPSYa.png) ![image](https://hackmd.io/_uploads/r1vtivHFa.png) ### User-plane Supporting Packages Install Many Depedencies for Supporting User-Plane : ``` sudo apt -y update sudo apt -y install git gcc g++ cmake autoconf libtool pkg-config libmnl-dev libyaml-dev ``` ![image](https://hackmd.io/_uploads/BJuojDHF6.png) ### Linux Host Network Settings Configure Host Network : ``` sudo sysctl -w net.ipv4.ip_forward=1 sudo iptables -t nat -A POSTROUTING -o enp2s1 -j MASQUERADE sudo iptables -A FORWARD -p tcp -m tcp --tcp-flags SYN,RST SYN -j TCPMSS --set-mss 1400 sudo systemctl stop ufw sudo systemctl disable ufw ``` ![image](https://hackmd.io/_uploads/SJpfnDBKp.png) ![image](https://hackmd.io/_uploads/BJewhvSFT.png) ![image](https://hackmd.io/_uploads/HkD22vBYT.png) ## Install Control Plane Elements ### Clone the free5GC repository (stable version) install the latest stable build (v3.3.0): ``` cd ~ git clone --recursive -b v3.3.0 -j `nproc` https://github.com/free5gc/free5gc.git cd free5gc ``` ![image](https://hackmd.io/_uploads/r1GM6Prta.png) ### Compile network function services in free5gc Compile network function services in free5gc. This command invokes the make tool to build the free5gc project. The Makefile in the root of the project directory specifies the build process, which may involve compiling source code, linking object files, and producing executable files. ``` cd ~/free5gc make ``` ![image](https://hackmd.io/_uploads/SkYSpwStp.png) ![image](https://hackmd.io/_uploads/SJeW0wrta.png) ## Install User Plane Function (UPF) ### Retrieve the 5G GTP-U kerne Retrieve the 5G GTP-U kernel module using git and build it ``` git clone -b v0.8.3 https://github.com/free5gc/gtp5g.git cd gtp5g make sudo make install ``` ![image](https://hackmd.io/_uploads/r1f0CDHFa.png) ![image](https://hackmd.io/_uploads/rkQkJdHFa.png) ![image](https://hackmd.io/_uploads/ry-Z1uSFa.png) ### Build the UPF Build the UPF using ``` cd ~/free5gc make upf ``` ![image](https://hackmd.io/_uploads/SkOOkOBY6.png) ## Install WebConsole ### Install nodejs and yarn packages ``` sudo apt remove cmdtest sudo apt remove yarn curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add - echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list sudo apt update sudo apt install -y nodejs yarn ``` ![image](https://hackmd.io/_uploads/rJ32J_StT.png) ![image](https://hackmd.io/_uploads/Skt01drtp.png) ### Build WebConsole The command ‘cd ~/free5gc’ changes the current directory to the free5gc directory in the user’s home directory. The next command make webconsole builds the web console module of the free5gc project. ``` cd ~/free5gc make webconsole ``` ![image](https://hackmd.io/_uploads/ryKNgurYp.png) The command go run server.go runs a Go program called server.go. ``` go run server.go ``` ![image](https://hackmd.io/_uploads/Sk1tp7DYp.png) ![image](https://hackmd.io/_uploads/H1xwTQPtT.png) ![image](https://hackmd.io/_uploads/HyYs67Dta.png) ## Test free5GC ### Execute Run.sh ``` sudo ./run.sh ``` ![image](https://hackmd.io/_uploads/SkKX6jUK6.png) ### Run the tests ``` cd ~/free5gc make upf chmod +x ./test.sh ``` ![image](https://hackmd.io/_uploads/SJDzzuBYa.png) #### Test Registration The TestRegistration function is employed for enrolling a user into the 5G Core Network through the submission of a registration request to both the Authentication and Authorization Server (AUSF) and the Home Subscriber Server (HSS). This function oversees the registration procedure by validating the user's identity and authentication details, creating and storing session keys, and furnishing essential information to other network functions for subsequent communication. ``` ./test.sh TestRegistration ``` ![image](https://hackmd.io/_uploads/r1QIGOSYp.png) ![image](https://hackmd.io/_uploads/ryB-44vYp.png) #### Test GUTI Registration The TestGUTIRegistration function is employed to enroll a user utilizing their GUTI. It forwards a registration request to the MME, where the GUTI is verified, and essential authentication and authorization procedures are conducted in collaboration with the AUSF and HSS. Upon successful registration, the MME assigns a permanent identity to the user, referred to as the Subscriber Permanent Identifier (SUPI), which is utilized for subsequent communication with the user. ``` ./test.sh TestGUTIRegistration ``` ![image](https://hackmd.io/_uploads/B12R3-_YT.png) ![image](https://hackmd.io/_uploads/BJZlTbuFa.png) #### Test Service Request TestServiceRequest is a testing function designed to simulate service requests initiated by users within the 5G Core Network. This function creates a service request message and transmits it to the SEAF (Service Authorization Function) to assess user authorization and evaluate network conditions. Upon authorization, the SEAF dispatches a response message to TestServiceRequest, which then proceeds to configure the essential resources for the requested service. ``` ./test.sh TestServiceRequest ``` ![image](https://hackmd.io/_uploads/ByFiMOrYa.png) ![image](https://hackmd.io/_uploads/ry24N4PK6.png) #### Test PDU Session Release Request The TestPDUSessionReleaseRequest is a testing function designed to simulate the release of a PDU (Packet Data Unit) session. It accomplishes this by generating a release request message and transmitting it to the SMF (Session Management Function). This process facilitates the termination of the PDU session and involves releasing the allocated resources for the session through communication with other network functions. ``` ./test.sh TestPDUSessionReleaseRequest ``` ![image](https://hackmd.io/_uploads/Hk4V0-_ta.png) ![image](https://hackmd.io/_uploads/HkZvCZuFa.png) #### Test Paging The TestPaging function is a testing procedure that simulates the paging process. It does so by triggering a paging request, facilitating the exchange of messages among the network functions participating in the procedure, and establishing the essential resources for the requested service. ``` ./test.sh TestPaging ``` ![image](https://hackmd.io/_uploads/r1GA0-dFp.png) ![image](https://hackmd.io/_uploads/r1JnC-dKa.png) #### Test N2Handover The TestN2Handover function serves as a testing mechanism that emulates the N2 handover procedure. This simulation involves the exchange of messages among the source gNB, target gNB, and other network functions engaged in the handover process. The primary objective is to enable the seamless transfer of both the control plane and user plane connections from the source gNB to the target gNB. Throughout this process, the session and routing information for the user are preserved. ``` ./test.sh TestN2Handover ``` ![image](https://hackmd.io/_uploads/HyG5yGOtT.png) ![image](https://hackmd.io/_uploads/rkYPJfuF6.png) #### Test ReSynchronization The TestReSynchronization function is a testing utility that emulates the Re-Synchronization procedure within the network. This involves initiating the procedure, facilitating the exchange of messages among the network functions participating in the process, and validating the re-establishment of synchronization between these network functions. This simulation is particularly relevant after experiencing a temporary loss of synchronization. ``` ./test.sh TestReSynchronization ``` ![image](https://hackmd.io/_uploads/ByolgzuK6.png) ![image](https://hackmd.io/_uploads/Bkv0yM_tp.png) #### Test ULCL The TestULCL function is a testing feature designed to simulate the ULI Consolidation List (ULCL) procedure. This simulation involves triggering the consolidation of ULI (User Location Information) from multiple sources into a unified list. The process includes validating the successful consolidation and generating a response based on the outcome of the consolidation. ``` ./test_ulcl.sh TestRequestTwoPDUSessions ``` ![image](https://hackmd.io/_uploads/r1g2gM_YT.png) ![image](https://hackmd.io/_uploads/S1iYxzdta.png) #### Test Deregistration The TestDeregistration function serves as a testing mechanism for simulating user deregistration within the network. This involves generating a deregistration request message and transmitting it to the AMF (Access and Mobility Management Function). The purpose is to facilitate the discontinuation of the user's connection with the network and subsequently release the resources allocated to the user through communication with other network functions. ``` ./test.sh TestDeregistration ``` ![image](https://hackmd.io/_uploads/rkSJXOBKT.png) ![image](https://hackmd.io/_uploads/SyR3NEvY6.png) ## Install Ueranism ### Install Ubuntu Server #### Update Ubuntu Server ``` sudo apt update ``` ![image](https://hackmd.io/_uploads/Sk1eZbtKa.png) #### Change Hostname with 'ueranism' ``` sudo adduser ueranism ``` ![image](https://hackmd.io/_uploads/Hk2HBZYF6.png) Change IP Local to specifiec hostname : ``` sudo nano /etc/hosts ``` ![image](https://hackmd.io/_uploads/BJPTSbYta.png) Make user ueranism have permission sudo : ``` sudo usermod -aG sudo ueranism ``` ![image](https://hackmd.io/_uploads/H17z8-YYp.png) ### Change Static IP Address Change IP in NAT for IP Static like installation guide : ![image](https://hackmd.io/_uploads/S1lcPZYF6.png) ### Clone Repo Ueransim ``` cd ~ git clone https://github.com/aligungr/UERANSIM cd UERANSIM git checkout v3.1.0 ``` ![image](https://hackmd.io/_uploads/H1EnT-FYp.png) ### Update and Upgrade UERANSIM ``` sudo apt update sudo apt upgrade ``` ![image](https://hackmd.io/_uploads/SkIfCbKF6.png) ### Install Required Tools ``` sudo apt install make sudo apt install g++ sudo apt install libsctp-dev lksctp-tools sudo apt install iproute2 sudo snap install cmake --classic ``` ![image](https://hackmd.io/_uploads/HybBCfFt6.png) ![image](https://hackmd.io/_uploads/rk-vCzKta.png) ![image](https://hackmd.io/_uploads/H1OACMYYa.png) ![image](https://hackmd.io/_uploads/ByrbJmFK6.png) ![image](https://hackmd.io/_uploads/SJdmk7tF6.png) ### Build Ueransim ``` cd ~/UERANSIM make ``` ![image](https://hackmd.io/_uploads/SyVkemtKp.png) ![image](https://hackmd.io/_uploads/SJw9ZQtYp.png) ### Add Subscriber in Web Console ![image](https://hackmd.io/_uploads/rJ-Hhe3KT.png) ### Change IP Address Free5gc ![image](https://hackmd.io/_uploads/HyXZ6xnta.png) ![image](https://hackmd.io/_uploads/rytFaehKa.png) ![image](https://hackmd.io/_uploads/HkvTpe2Fp.png) ![image](https://hackmd.io/_uploads/rkTiAgnKT.png) ![image](https://hackmd.io/_uploads/ry0k1Z2tp.png) ![image](https://hackmd.io/_uploads/r1NLyZhKa.png) ![image](https://hackmd.io/_uploads/r19T1W3t6.png) ![image](https://hackmd.io/_uploads/SJ_hy-3tp.png) ![image](https://hackmd.io/_uploads/ByoyeZ2Fp.png) ![image](https://hackmd.io/_uploads/BkC5ZZnFT.png) ![image](https://hackmd.io/_uploads/rk3Aqb2t6.png) ![image](https://hackmd.io/_uploads/Hy0msWhFT.png) THANK YOU