--- title: OAI with COTS UE tags: "OAI" --- # 5G NR Platform [TOC] ## Required - Hardware - CPU: i5-9400 - OS: Ubuntu 18.04LTS - UE: Oppo reno 5G - USRP B210, B200mini - Software - Core Network: [Open5gs](https://open5gs.org/open5gs/) - gNB: [OpenAirInterface](https://gitlab.eurecom.fr/oai/openairinterface5g) - branch: develop - commit: 3bc86d69c0c63399ed7adf0f6d40ad68557877c5 - Band 78, 106 RB ## Build the gNB ### Clone the OpenAirInterface Clone the project form the gitlab ```shell git clone https://gitlab.eurecom.fr/oai/openairinterface5g/ cd openairinterface5g git checkout 3bc86d69c0 ``` Build OAI gNB executable ```bash source oaienv cd cmake_targets/ export BUILD_UHD_FROM_SOURCE=True ./build_oai -I -w USRP --gNB ``` > NOTICE: Do NOT run with `sudo` Modify the config file: `openairinterface5g/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.106PRB.usrpb210.conf` ```diff @@ -10,8 +10,10 @@ gNB_name = "gNB-OAI"; // Tracking area code, 0x0000 and 0xfffe are reserved values - tracking_area_code = 1; - plmn_list = ({ mcc = 208; mnc = 99; mnc_length = 2; snssaiList = ({ sst = 1; sd = 0x1; }) }); + tracking_area_code = 2; + plmn_list = ({ + mcc = 001; + mnc = 01; + mnc_length = 2; + snssaiList = ({ + sst = 1; + # sd = 0x1; + }) + }); nr_cellid = 12345678L; @@ -166,7 +168,7 @@ ////////// AMF parameters: - amf_ip_address = ( { ipv4 = "192.168.70.132"; + amf_ip_address = ( { ipv4 = "127.0.0.5"; ipv6 = "192:168:30::17"; active = "yes"; preference = "ipv4"; @@ -177,9 +179,9 @@ NETWORK_INTERFACES : { GNB_INTERFACE_NAME_FOR_NG_AMF = "demo-oai"; - GNB_IPV4_ADDRESS_FOR_NG_AMF = "192.168.70.129/24"; + GNB_IPV4_ADDRESS_FOR_NG_AMF = "127.0.32.56/8"; GNB_INTERFACE_NAME_FOR_NGU = "demo-oai"; - GNB_IPV4_ADDRESS_FOR_NGU = "192.168.70.129/24"; + GNB_IPV4_ADDRESS_FOR_NGU = "127.0.32.56/8"; GNB_PORT_FOR_S1U = 2152; # Spec 2152 }; ``` ## Install Open5gs ### Install Open5GS Run the following command to install the open5gs ```bash sudo apt update sudo apt install software-properties-common sudo add-apt-repository ppa:open5gs/latest sudo apt update sudo apt install open5gs ``` Check if all daemons are alive(active): ```bash sudo systemctl | grep open5gs- ``` Setup 5G core network: edit `/etc/open5gs/amf.yaml` ```diff amf: sbi: - addr: 127.0.0.5 port: 7777 ngap: - addr: 127.0.0.5 guami: - plmn_id: - mcc: 999 - mnc: 70 + mcc: 001 # set your PLMN-MCC + mnc: 01 # set your PLMN-MNC amf_id: region: 2 set: 1 tai: - plmn_id: - mcc: 999 - mnc: 70 - tac: 1 + mcc: 001 # set your PLMN-MCC + mnc: 01 # set your PLMN-MNC + tac: 2 # should match the TAC used by your gNB plmn_support: - plmn_id: - mcc: 999 - mnc: 70 + mcc: 001 # set your PLMN-MCC + mnc: 01 # set your PLMN-MNC s_nssai: - sst: 1 security: ``` Restart corresponding daemons ```bash sudo systemctl restart open5gs-amfd sudo systemctl restart open5gs-upfd ``` Monitor virtual network interface card ```bash sudo tcpdump -i ogstun ``` Create a text file `~/restart_5gs.sh` and paste the following: ```shell # stop 5gs 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-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 # restart 5gs sudo systemctl restart open5gs-smfd sudo systemctl restart open5gs-amfd sudo systemctl restart open5gs-upfd sudo systemctl restart open5gs-nrfd 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 ``` Give the permission: ```bash chmod +x ~/restart_5gs.sh ``` ### Add the IMSI to the database Insert UE information to database Download this [code](https://github.com/open5gs/open5gs/blob/main/misc/db/open5gs-dbctl) to any folder you like ```bash curl https://raw.githubusercontent.com/open5gs/open5gs/main/misc/db/open5gs-dbctl > ./open5gs-dbctl chmod +x ./open5gs-dbctl ./open5gs-dbctl help ``` Add UE information. (The subscription is added to database with default apn `internet`. I suggest you stick with the default apn until you get everthing working) ```bash # add {imsi key opc} ./open5gs-dbctl add 001010000000093 465B5CE8B199B49FAA5F0A2EE238A6BC E8ED289DEBA952E4283B54E88E6183CA ``` ## Run the Core Network and gNB ### Establish the iptable Run the following command to establish the iptable for forwarding the traffic. ``` sudo sysctl -w net.ipv4.ip_forward=1 sudo iptables -I INPUT --source 10.45.0.0/16 -j ACCEPT sudo iptables -t nat -I POSTROUTING --out-interface <your NIC> -j MASQUERADE sudo iptables -I FORWARD --in-interface <your NIC> --out-interface ogstun -j ACCEPT sudo iptables -I FORWARD --in-interface ogstun --out-interface <your NIC> -j ACCEPT ``` > Remember to edit the network interface card. ### Run the Core Network Open a terminal for running the Core Network ```bash ~/restart_5gs.sh && sudo tail /var/log/open5gs/amf.log -f ``` ### Run the gNB Open another terminal for running the gNB. ```bash cd ~/openairinterface5g/cmake_targets/ran_build/build sudo ./nr-softmodem -O ../../../targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.106PRB.usrpb210.conf -E --sa ``` Once gNB is connected to core network successfully, you should something like this in the log of core network: ```log [amf] INFO: [Added] Number of gNBs is now 1 (../src/amf/context.c:878) [amf] INFO: gNB-N2[192.168.32.100] max_num_of_ostreams : 2 (../src/amf/amf-sm.c:700) ``` ## Go to a TA for COTS UE Turn on the airplane mode first. Turn off after run the core network and gNB. Use browser to visit [fast.com](https://fast.com). The speed need to close to **15Mbps**.
×
Sign in
Email
Password
Forgot password
or
By clicking below, you agree to our
terms of service
.
Sign in via Facebook
Sign in via Twitter
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet
Wallet (
)
Connect another wallet
New to HackMD?
Sign up