---
# System prepended metadata

title: srsRAN 5G SA setup

---

# srsRAN 5G SA setup

Power management
Remove all power management features in the BIOS (sleep states, in particular
C-states) and CPU frequency scaling (Intel SpeedStep). In some cases, you can
also do this with cpufreqtool. Also, disable hyperthreading in BIOS and make sure its turned off in Linux

check this using this command: watch grep \"cpu MHz\" /proc/cpuinfo

have a look at this link
for further information.
you must disable p-state and c-state in linux so you need to add intel_pstate=disable to the Linux boot options,
i.e GRUB_CMDLINE_LINUX_DEFAULT="quiet intel_pstate=disable"  in /etc/default/grub, then perform update-grub. You may optionally add the following as well "processor.max_cstate=1 intel_idle.max_cstate=0 idle=poll"

Append "blacklist intel_powerclamp" to the end of /etc/modprobe.d/blacklist.conf, to blacklist the intel_powerclamp" module. If the file does not exist, create one, and add the line into it.
You also need to disable hyperthreading, CPU frequency control, C-States, P-States and any other power management from BIOS as well.
Install i7z utility to check the cpu

Details:
In the power management part, the boot option commands was set using "grub customizer" tool:
Genral settings -> default entry -> predefined -> ubuntu low latency 
Then in the "kernel parameters" part add those power management commands:
processor.max_cstate=1 intel_idle.max_cstate=0 idle=poll quiet splash intel_pstate=disable 
Install ccache and backward-cpp (for ccache you may need to add the repository)

______________________________________________________
UHD:
Install dependencies:
sudo apt install autoconf automake build-essential ccache cmake cpufrequtils doxygen ethtool \
g++ git inetutils-tools libboost-all-dev libncurses5 libncurses5-dev libusb-1.0-0 libusb-1.0-0-dev \
libusb-dev python3-dev python3-mako python3-numpy python3-requests python3-scipy python3-setuptools \
python3-ruamel.yaml 



Build and install uhd hardware driver:
git clone https://github.com/EttusResearch/uhd.git 

Install version 3.15
To change the version to 3.15: (see the list of versions by git branch -a)
$git switch UHD-3.15-LTS

_______________________________________________________

Configuring the mobile core via webui

Add a new subscriber:
Subscriber key: the Ki value of the simcard
AMF: leave unchanged for now
Usim type: leave unchanged (Opc)
UE-AMBR Downlink and Uplink: keep unchanged: 1Gbps
Keep the rest of parameters unchanged. 

Change the name of APN using WEBUI to recongnize the new network

Change the configuration files of mobile core for new MCC-MNC:
amf.yaml, mme.yaml

make the following changes: 
In  /etc/open5gs/ :
Upf.yaml -> gtpu: - addr: change to the the IP address of the mobile core machine
Amf.yaml -> ngap: - addr: change to the the IP address of the mobile core machine
Also in the gnb_rf_n310_fdd_n3_20mhz.yml file, the addr: mobile core ip, bind_addr: gnb IP
 
also s1ap should be updated in mme.conf, but I have not updated it. Will check it later if I couldn't make a connection. 
The same is about gtpu address in sgwu.yaml. It is already kept unchanged. 

Tac is already set to 1. Need to be the same as mobile core. Change it to 7. 


I changed the ip address in mme.yaml for s1ap to the ip address of the mobile core system.
I changed the ip address in sgwu.yaml for gtpu to the ip address of the mobile core system. 
I inserted the commands of IP forwarding and NAT rules in the mobile core VM:
To enable forwarding and add the NAT rule, enter

Enable IPv4/IPv6 Forwarding
$ sudo sysctl -w net.ipv4.ip_forward=1
$ sudo sysctl -w net.ipv6.conf.all.forwarding=1

Add NAT Rule
$ sudo iptables -t nat -A POSTROUTING -s 10.45.0.0/16 ! -o ogstun -j MASQUERADE
$ sudo ip6tables -t nat -A POSTROUTING -s 2001:db8:cafe::/48 ! -o ogstun -j MASQUERADE
Configure the firewall correctly. Some operating systems (Ubuntu) by default enable firewall rules to block traffic.

$ sudo ufw status
Status: active
$ sudo ufw disable
Firewall stopped and disabled on system startup
$ sudo ufw status
Status: inactive


Can use its webUI (should be installed separately):
http://localhost:3000
Username : admin
Password : 1423
__________________________________________________________
sim programming

to read the OPC of the simcard after programming
sudo ./sysmo-isism-tool.sja2.py --adm1 65088337 -o
where 65088337 is the adm1 of the simcard

to read the simcard:
$./pySim-read.py -p 0

to program the simcard: 
$ ./pySim-prog.py -p 0 -t sysmoISIM-SJA2 -a 65088337 -x 505 -y 01 -i 505010000070590 -s 8988211000000700000
Where -t specifies the simcard type, -a is ADM1 code, -x is MCC, -y is MNC, -i is IMSI, and -s is ICCID.  
If we're going to update MCC-MNC, just need to update these two values, as well as IMSI (the first 5 digits of IMSI is MCC-MNC) and keep the rest of parameters unchanged. ADM1 should never change, as it is used for authentication and changing it will damage the simcard. 

IMPORTANT NOTE:
After changing the IMSI, OPC will be updated automatically. So should read and set the new opc using sudo ./sysmo-isism-tool.sja2.py --adm1 65088337 -o



