USRP - pchat-imm/o-ran-e2-kpm GitHub Wiki
Description: run srsRAN_Project for 5G using USRP B210
Tutorial:
- basic installation: https://docs.srsran.com/projects/project/en/latest/user_manuals/source/installation.html
- foundaiton of config gNB and open5gs: https://docs.srsran.com/projects/project/en/latest/tutorials/source/cotsUE/source/index.html
- open5gs enable system: https://open5gs.org/open5gs/docs/guide/01-quickstart/
- Installation
- Configuration
- Run system
follow this link: https://linuxconfig.org/how-to-switch-between-multiple-gcc-and-g-compiler-versions-on-ubuntu-22-04-lts-jammy-jellyfish
Install GCC and G++ compiler
sudo apt update
sudo apt install build-essential
sudo apt -y install gcc-10 g++-10
Update alternative, then compile the version 10, and check if the version selected correctly
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-10 10
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-10 10
sudo update-alternatives --config gcc
sudo update-alternatives --config g++
and check gcc and g++ version
gcc --version
gcc (Ubuntu 10.5.0-1ubuntu1~22.04) 10.5.0
g++ --version
g++ (Ubuntu 10.5.0-1ubuntu1~22.04) 10.5.0
before make any code with gcc, g++
installation following this link: https://askubuntu.com/questions/470545/how-do-i-set-up-ccache
# Install package
sudo apt install -y ccache
# Update symlinks
sudo /usr/sbin/update-ccache-symlinks
# Prepend ccache into the PATH
echo 'export PATH="/usr/lib/ccache:$PATH"' | tee -a ~/.bashrc
# Source bashrc to test the new PATH
source ~/.bashrc && echo $PATH
path will looks like this
/usr/lib/ccache/:/usr/lib/ccache/:/home/chatchamon/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/snap/bin
and test successful of ccache
>> which g++ gcc
/usr/lib/ccache/gcc
/usr/lib/ccache/g++
following
- https://open5gs.org/open5gs/docs/guide/02-building-open5gs-from-sources/
- https://open5gs.org/open5gs/docs/platform/01-debian-ubuntu/
>> sudo apt update
>> sudo apt install gnupg
>> curl -fsSL https://pgp.mongodb.com/server-6.0.asc | sudo gpg -o /usr/share/keyrings/mongodb-server-6.0.gpg --dearmor
create source list of mongoDB
echo "deb [ arch=amd64,arm64 signed-by=/usr/share/keyrings/mongodb-server-6.0.gpg] https://repo.mongodb.org/apt/ubuntu jammy/mongodb-org/6.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-6.0.list
install mongoDB package
sudo apt update
sudo apt install mongodb-org
# to start mongodb service
sudo systemctl start mongodb
# ensure it automatically start when on system boot
sudo systemctl enable mongodb
create TUN device with the interface name ogstun
sudo ip tuntap add name ogstun mode tun
sudo ip addr add 10.45.0.1/16 dev ogstun
sudo ip addr add 2001:db8:cafe::1/48 dev ogstun
sudo ip link set ogstun up
install dependencies
sudo apt install python3-pip python3-setuptools python3-wheel ninja-build build-essential flex bison git cmake libsctp-dev libgnutls28-dev libgcrypt-dev libssl-dev libidn11-dev libmongoc-dev libbson-dev libyaml-dev libnghttp2-dev libmicrohttpd-dev libcurl4-gnutls-dev libnghttp2-dev libtins-dev libtalloc-dev meson
git clone
git clone https://github.com/open5gs/open5gs
compile with meson
cd open5gs
meson build --prefix=`pwd`/install
ninja -C build
check if the compilation is correct
./build/tests/attach/attach ## EPC Only
./build/tests/registration/registration ## 5G Core Only
run all test programs
cd build
meson test -v
can see result of ninja -C build test
with wireshark, select interface to s1ap || gtpv2 || pfcp || diameter || gtp || ngap || http2.data.data || http2.headers.
. See sample results of wireshark on https://open5gs.org/open5gs/docs/guide/02-building-open5gs-from-sources/
perform installation process
cd build
ninja install
cd ../
in case meson test -v
are not succesful
from: https://open5gs.org/open5gs/docs/troubleshoot/02-now-in-github-issues/
make sure MongoDB server daemon is running.
-
find
if it follow any subscriber, thendrop
, and check withfind
which should show an empty list
>> mongosh
Current Mongosh Log ID: 6620bc6f0803e8e0fbc934dc
Connecting to: mongodb://127.0.0.1:27017/?directConnection=true&serverSelectionTimeoutMS=2000&appName=mongosh+2.2.4
Using MongoDB: 6.0.14
Using Mongosh: 2.2.4
For mongosh info see: https://docs.mongodb.com/mongodb-shell/
To help improve our products, anonymous usage data is collected and sent to MongoDB periodically (https://www.mongodb.com/legal/privacy-policy).
You can opt-out by running the disableTelemetry() command.
------
The server generated these startup warnings when booting
2024-04-18T11:47:47.325+07:00: Using the XFS filesystem is strongly recommended with the WiredTiger storage engine. See http://dochub.mongodb.org/core/prodnotes-filesystem
2024-04-18T11:47:47.731+07:00: Access control is not enabled for the database. Read and write access to data and configuration is unrestricted
2024-04-18T11:47:47.731+07:00: vm.max_map_count is too low
------
test> use open5gs
switched to db open5gs
open5gs> db.subscribers.find()
[
{
_id: ObjectId('6620858b38c7291c205c190b'),
ambr: { downlink: { value: 1, unit: 3 }, uplink: { value: 1, unit: 3 } },
schema_version: 1,
msisdn: [],
imeisv: [],
mme_host: [],
mme_realm: [],
purge_flag: [],
access_restriction_data: 32,
subscriber_status: 0,
operator_determined_barring: 0,
network_access_mode: 0,
subscribed_rau_tau_timer: 12,
imsi: '999700000062713',
security: {
k: '96E5235D7BD18E48BEF1B85521383C4E',
amf: '8000',
op: null,
opc: 'B1C0A05123C419D615B71EC0F8CE13AB'
},
slice: [
{
_id: ObjectId('6620858b38c7291c205c190c'),
sst: 1,
default_indicator: true,
session: [
{
qos: {
arp: {
priority_level: 8,
pre_emption_capability: 1,
pre_emption_vulnerability: 1
},
index: 9
},
ambr: {
downlink: { value: 1, unit: 3 },
uplink: { value: 1, unit: 3 }
},
_id: ObjectId('6620858b38c7291c205c190d'),
name: 'srsapn',
type: 3,
pcc_rule: []
}
]
}
],
__v: 0
}
]
open5gs> db.subscribers.drop()
true
open5gs> db.subscibers.find()
kill all processes, and pkill
any open5gs-*
that is showing, until nothing is on the screen
ps -ef | grep open5gs
sudo pkill -9 open5gs-*
and try meson test -v
again. (can compared result with testlog.txt)
# Download and import the Nodesource GPG key
sudo apt update
>> sudo apt install -y ca-certificates curl gnupg
>> sudo mkdir -p /etc/apt/keyrings
>> curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | sudo gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg
# Create deb repository
>> NODE_MAJOR=20
>> echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_$NODE_MAJOR.x nodistro main" | sudo tee /etc/apt/sources.list.d/nodesource.list
# Run Update and Install
>> sudo apt update
>> sudo apt install nodejs -y
install dependencies of run WebUI
cd webui
npm ci
run WebUI as an npm script
npm run dev
following: https://open5gs.org/open5gs/docs/guide/02-building-open5gs-from-sources/
enable IP forwarding and add NAT rule (important! or UE cannot connect internet)
### 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 firewall, as some defualt Ubuntu 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
optionally, may consider the setting below for security purpose (important ! or else UE will lose connection quickly as too much traffic coming to the open5GS)
### Prevent UE's from connecting to the host on which UPF is running
$ sudo iptables -I INPUT -s 10.45.0.0/16 -j DROP
$ sudo ip6tables -I INPUT -s 2001:db8:cafe::/48 -j DROP
following this page: https://kb.ettus.com/Building_and_Installing_the_USRP_Open-Source_Toolchain_(UHD_and_GNU_Radio)_on_Linux
update the system with sudo apt update
and install dependencies
sudo apt-get -y install autoconf automake build-essential ccache cmake cpufrequtils doxygen ethtool fort77 g++ gir1.2-gtk-3.0 git gobject-introspection gpsd gpsd-clients inetutils-tools libasound2-dev libboost-all-dev libcomedi-dev libcppunit-dev libfftw3-bin libfftw3-dev libfftw3-doc libfontconfig1-dev libgmp-dev libgps-dev libgsl-dev liblog4cpp5-dev libncurses5 libncurses5-dev libpulse-dev libqt5opengl5-dev libqwt-qt5-dev libsdl1.2-dev libtool libudev-dev libusb-1.0-0 libusb-1.0-0-dev libusb-dev libxi-dev libxrender-dev libzmq3-dev libzmq5 ncurses-bin python3-cheetah python3-click python3-click-plugins python3-click-threading python3-dev python3-docutils python3-gi python3-gi-cairo python3-gps python3-lxml python3-mako python3-numpy python3-opengl python3-pyqt5 python3-requests python3-scipy python3-setuptools python3-six python3-sphinx python3-yaml python3-zmq python3-ruamel.yaml swig wget
build and install UHD from source code
git clone https://github.com/EttusResearch/uhd
cd uhd
select LTS version of UHD either 3.15 or 4.0 as recomended (https://docs.srsran.com/projects/project/en/latest/user_manuals/source/installation.html)
# check full tag version
git tag -l
# select version
git checkout v4.0.0.0
then create build folder within the repo
cd host
mkdir build
cd build
cmake ..
the cmake should return, if not please check the website
-- Boost include directories: /usr/include
-- Boost library directories: /usr/lib/x86_64-linux-gnu
then make
it
make
# optional
make test
- after that, install UHD with default install prefix under the /usr/local/lib
sudo make install
update the system's shared library cache
sudo ldconfig
export environment variable defined with other folder, add this line to the end of sudo nano $HOME/.bashrc
export LD_LIBRARY_PATH=/usr/local/lib
close the terminal, then open and run the command without connecting any devices to see if it has uhd installed
uhd_find_devices
[INFO] [UHD] linux; GNU C++ version 10.5.0; Boost_107400; UHD_4.0.0.HEAD-0-g90ce6062
No UHD Devices Found
sudo uhd_images_downloader
Result
>> sudo uhd_images_downloader
[INFO] Using base URL: https://files.ettus.com/binaries/cache/
[INFO] Images destination: /usr/local/share/uhd/images
[INFO] No inventory file found at /usr/local/share/uhd/images/inventory.json. Creating an empty one.
21486 kB / 21486 kB (100%) x3xx_x310_fpga_default-gbe53058.zip
20061 kB / 20061 kB (100%) x3xx_x300_fpga_default-gbe53058.zip
01152 kB / 01152 kB (100%) e3xx_e310_sg1_fpga_default-gbe53058.zip
01138 kB / 01138 kB (100%) e3xx_e310_sg3_fpga_default-gbe53058.zip
10194 kB / 10194 kB (100%) e3xx_e320_fpga_default-g413ebee.zip
20816 kB / 20816 kB (100%) n3xx_n310_fpga_default-gbe53058.zip
14296 kB / 14296 kB (100%) n3xx_n300_fpga_default-gbe53058.zip
27135 kB / 27135 kB (100%) n3xx_n320_fpga_default-gbe53058.zip
00488 kB / 00488 kB (100%) b2xx_b200_fpga_default-gf2ec5c9.zip
00482 kB / 00482 kB (100%) b2xx_b200mini_fpga_default-gf2ec5c9.zip
00867 kB / 00867 kB (100%) b2xx_b210_fpga_default-gf2ec5c9.zip
00521 kB / 00521 kB (100%) b2xx_b205mini_fpga_default-gf2ec5c9.zip
00167 kB / 00167 kB (100%) b2xx_common_fw_default-g437381b.zip
00007 kB / 00007 kB (100%) usrp2_usrp2_fw_default-g6bea23d.zip
00450 kB / 00450 kB (100%) usrp2_usrp2_fpga_default-g6bea23d.zip
02415 kB / 02415 kB (100%) usrp2_n200_fpga_default-g6bea23d.zip
00009 kB / 00009 kB (100%) usrp2_n200_fw_default-g6bea23d.zip
02757 kB / 02757 kB (100%) usrp2_n210_fpga_default-g6bea23d.zip
00009 kB / 00009 kB (100%) usrp2_n210_fw_default-g6bea23d.zip
02123 kB / 02123 kB (100%) n230_n230_fpga_default-ge57dfe0.zip
00319 kB / 00319 kB (100%) usrp1_usrp1_fpga_default-g6bea23d.zip
00522 kB / 00522 kB (100%) usrp1_b100_fpga_default-g6bea23d.zip
00006 kB / 00006 kB (100%) usrp1_b100_fw_default-g6bea23d.zip
00017 kB / 00017 kB (100%) octoclock_octoclock_fw_default-g14000041.zip
04839 kB / 04839 kB (100%) usb_common_windrv_default-g14000041.zip
[INFO] Images download complete.
- update udev rule so non-root users can access the device. his step for b200,b210,b200mini. Make sure no device connect when running commands
cd /uhd/host/utils
sudo cp uhd-usrp.rules /etc/udev/rules.d/
sudo udevadm control --reload-rules
sudo udevadm trigger
- with USB interface,
lsusb
command should showEttus Research LLC USRP B210
with VID:PID of2500:0021
>> lsusb
Bus 003 Device 015: ID 2500:0020 Ettus Research LLC USRP B210
- check other command to see if uhd is working including:
uhd_find_devices
,uhd_usrp_probe
, and example in/usr/local/lib/uhd/example
uhd_find_devices
>> uhd_find_devices
[INFO] [UHD] linux; GNU C++ version 10.5.0; Boost_107400; UHD_4.0.0.HEAD-0-g90ce6062
[INFO] [B200] Loading firmware image: /usr/local/share/uhd/images/usrp_b200_fw.hex...
--------------------------------------------------
-- UHD Device 0
--------------------------------------------------
Device Address:
serial: 326C096
name: MyB210
product: B210
type: b200
uhd_usrp_probe
>> uhd_usrp_probe
[INFO] [UHD] linux; GNU C++ version 10.5.0; Boost_107400; UHD_4.0.0.HEAD-0-g90ce6062
[INFO] [B200] Detected Device: B210
[INFO] [B200] Loading FPGA image: /usr/local/share/uhd/images/usrp_b210_fpga.bin...
[INFO] [B200] Operating over USB 3.
[INFO] [B200] Detecting internal GPSDO....
[INFO] [GPS] No GPSDO found
[INFO] [B200] Initialize CODEC control...
[INFO] [B200] Initialize Radio control...
[INFO] [B200] Performing register loopback test...
[INFO] [B200] Register loopback test passed
[INFO] [B200] Performing register loopback test...
[INFO] [B200] Register loopback test passed
[INFO] [B200] Setting master clock rate selection to 'automatic'.
[INFO] [B200] Asking for clock rate 16.000000 MHz...
[INFO] [B200] Actually got clock rate 16.000000 MHz.
_____________________________________________________
/
| Device: B-Series Device
| _____________________________________________________
| /
| | Mboard: B210
| | serial: 326C096
| | name: MyB210
| | product: 2
| | revision: 4
| | FW Version: 8.0
| | FPGA Version: 16.0
| |
| | Time sources: none, internal, external, gpsdo
| | Clock sources: internal, external, gpsdo
| | Sensors: ref_locked
| | _____________________________________________________
| | /
| | | RX DSP: 0
| | |
| | | Freq range: -8.000 to 8.000 MHz
| | _____________________________________________________
| | /
| | | RX DSP: 1
| | |
| | | Freq range: -8.000 to 8.000 MHz
| | _____________________________________________________
| | /
| | | RX Dboard: A
| | | _____________________________________________________
| | | /
| | | | RX Frontend: A
| | | | Name: FE-RX2
| | | | Antennas: TX/RX, RX2
| | | | Sensors: temp, rssi, lo_locked
| | | | Freq range: 50.000 to 6000.000 MHz
| | | | Gain range PGA: 0.0 to 76.0 step 1.0 dB
| | | | Bandwidth range: 200000.0 to 56000000.0 step 0.0 Hz
| | | | Connection Type: IQ
| | | | Uses LO offset: No
| | | _____________________________________________________
| | | /
| | | | RX Frontend: B
| | | | Name: FE-RX1
| | | | Antennas: TX/RX, RX2
| | | | Sensors: temp, rssi, lo_locked
| | | | Freq range: 50.000 to 6000.000 MHz
| | | | Gain range PGA: 0.0 to 76.0 step 1.0 dB
| | | | Bandwidth range: 200000.0 to 56000000.0 step 0.0 Hz
| | | | Connection Type: IQ
| | | | Uses LO offset: No
| | | _____________________________________________________
| | | /
| | | | RX Codec: A
| | | | Name: B210 RX dual ADC
| | | | Gain Elements: None
| | _____________________________________________________
| | /
| | | TX DSP: 0
| | |
| | | Freq range: -8.000 to 8.000 MHz
| | _____________________________________________________
| | /
| | | TX DSP: 1
| | |
| | | Freq range: -8.000 to 8.000 MHz
| | _____________________________________________________
| | /
| | | TX Dboard: A
| | | _____________________________________________________
| | | /
| | | | TX Frontend: A
| | | | Name: FE-TX2
| | | | Antennas: TX/RX
| | | | Sensors: temp, lo_locked
| | | | Freq range: 50.000 to 6000.000 MHz
| | | | Gain range PGA: 0.0 to 89.8 step 0.2 dB
| | | | Bandwidth range: 200000.0 to 56000000.0 step 0.0 Hz
| | | | Connection Type: IQ
| | | | Uses LO offset: No
| | | _____________________________________________________
| | | /
| | | | TX Frontend: B
| | | | Name: FE-TX1
| | | | Antennas: TX/RX
| | | | Sensors: temp, lo_locked
| | | | Freq range: 50.000 to 6000.000 MHz
| | | | Gain range PGA: 0.0 to 89.8 step 0.2 dB
| | | | Bandwidth range: 200000.0 to 56000000.0 step 0.0 Hz
| | | | Connection Type: IQ
| | | | Uses LO offset: No
| | | _____________________________________________________
| | | /
| | | | TX Codec: A
| | | | Name: B210 TX dual DAC
| | | | Gain Elements: None
benchmark_rate in uhd example
cd /usr/local/lib/uhd/examples
sudo ./benchmark_rate --rx_rate 10e6 --tx_rate 10e6
[INFO] [UHD] linux; GNU C++ version 10.5.0; Boost_107400; UHD_4.0.0.HEAD-0-g90ce6062
[00:00:00.000118] Creating the usrp device with: ...
[INFO] [B200] Detected Device: B210
[INFO] [B200] Operating over USB 3.
[INFO] [B200] Initialize CODEC control...
[INFO] [B200] Initialize Radio control...
[INFO] [B200] Performing register loopback test...
[INFO] [B200] Register loopback test passed
[INFO] [B200] Performing register loopback test...
[INFO] [B200] Register loopback test passed
[INFO] [B200] Setting master clock rate selection to 'automatic'.
[INFO] [B200] Asking for clock rate 16.000000 MHz...
[INFO] [B200] Actually got clock rate 16.000000 MHz.
Using Device: Single USRP:
Device: B-Series Device
Mboard 0: B210
RX Channel: 0
RX DSP: 0
RX Dboard: A
RX Subdev: FE-RX2
RX Channel: 1
RX DSP: 1
RX Dboard: A
RX Subdev: FE-RX1
TX Channel: 0
TX DSP: 0
TX Dboard: A
TX Subdev: FE-TX2
TX Channel: 1
TX DSP: 1
TX Dboard: A
TX Subdev: FE-TX1
[00:00:02.295728978] Setting device timestamp to 0...
[INFO] [B200] Asking for clock rate 40.000000 MHz...
[INFO] [B200] Actually got clock rate 40.000000 MHz.
[00:00:02.692968427] Testing receive rate 10.000000 Msps on 1 channels
Setting TX spp to 2040
[00:00:02.715658392] Testing transmit rate 10.000000 Msps on 1 channels
[00:00:12.972366349] Benchmark complete.
Benchmark rate summary:
Num received samples: 102746818
Num dropped samples: 0
Num overruns detected: 0
Num transmitted samples: 102585480
Num sequence errors (Tx): 0
Num sequence errors (Rx): 0
Num underruns detected: 0
Num late commands: 0
Num timeouts (Tx): 0
Num timeouts (Rx): 0
Done!
from this link: https://docs.srsran.com/projects/project/en/latest/user_manuals/source/installation.html
install dependencies
sudo apt-get install cmake make gcc g++ pkg-config libfftw3-dev libmbedtls-dev libsctp-dev libyaml-cpp-dev libgtest-dev
install srsRAN_Project
git clone https://github.com/srsRAN/srsRAN_Project.git
cd srsRAN_Project
mkdir build
cd build
cmake ../
make -j $(nproc)
make test -j $(nproc)
sudo make install
- download PHYTester from: https://github.com/srsran/srsRAN_Project/releases
- copy and paste the file into srsRAN_Project folder, and extract file there
- enable PHY Testvector in
CMakeLists.txt
option(USE_PHY_TESTVECTORS "Enable testvector PHY tests" ON)
- then rebuild the srsRAN_Project
info on sim card
IMSI | ICCID | ACC | PIN1 | PUK1 | PIN2 | PUK2 | Ki | OPC | ADM1 | KIC1 | KID1 | KIK1 | KIC2 | KID2 | KIK2 | KIC3 | KID3 | KIK3 |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
999700000062710 | 8988211000000627102 | 0001 | 1863 | 60656842 | 7188 | 69439472 | 0B0B97D8586F3E1DE59D0578247C448D | 958254FECC8B3062FE01BF8C054677CF | 57910110 | ACA89091EFBA1D9DDD579FF23BCF46D2 | 5DB06EFC3FFC8019B919455638EFA7AB | F9800E73708AFD6923741989581BD755 | 025558C332319F627C047EB8873C2514 | FB6C8AF247047D0676CC07C41932BE2E | A96886F051D1F9A89041D12A8337250E | 87F8B66D6CA879AAA6D90AF0729BB343 | 0EAE945547BAAB8D2671341D5045BE9B | 875546A3F15622E87A2C1419A7E18D18 |
999700000062711 | 8988211000000627110 | 0002 | 9273 | 80898657 | 2581 | 45431615 | D2F199A52AE9D3E415AAFD6655AD3F88 | 410E9BB1834729971619E4D714D29B0A | 34061030 | F16439C77BFD0DC82E3453B472E6F473 | 872598184337F6184C76D9E0EF8CCAEB | B942CCAB1326D81B584160421E87CC70 | D136DCD03C2CBB50D59DB7C8B13D83E5 | 27E13714856403458C1FBA15126D8C8D | 0951027029E9B7DF31E52C32406D7EDB | CBA5A3E57674CA7E11F39BFD7E34C854 | CF9FDBA6DA97E8A6B5E76EC35D52A895 | 49E8183DA60F2EE9E7507F75F2A68E95 |
999700000062712 | 8988211000000627128 | 0004 | 8330 | 26544562 | 3188 | 95209499 | 13C3845F6212C9AD945665C835508CC0 | B884FD8F3497D1CBA3997208A81A4AA7 | 36645353 | F9B3E413EF34180FD29C4FBB7DB04188 | BAC70E5C5BEF8D6E20F8FA1EA68EE0EF | 925C4077C9F155C7AEFF417374D10E57 | D386248F970F9DB0CB816A16587F75C4 | B792130A4A18C875097C0909997BFAF0 | 9B2D255ADBEDDA2F4871BC9EFEAC9BBF | 288619DB6D727097C3A3B09EEEE4EB8D | D54819B9964C7E10B71CF7C19124652B | 73346CAD76D6882941C730553A3BFD50 |
999700000062713 | 8988211000000627136 | 0008 | 2481 | 43215893 | 5679 | 21192366 | 96E5235D7BD18E48BEF1B85521383C4E | B1C0A05123C419D615B71EC0F8CE13AB | 73947583 | BAEFEE018E08B0DE276DCF03900BE2AF | B2037C9475B7C9A2D8637F8B9651B835 | AED8AB5736726DB4BF6CF1FE44E61BF6 | EF00A3344612955BC3144E4DF8C719D4 | A42E9EBDFB3768C98AFEED6154E375F7 | 240A034AE19677D51B1CB19DD5F63503 | 6AC9B3640FD1FD90D50B43004C72C0A4 | EEA71035E53F67E7266E2C954212E6BC | 55CADF364D70E23D7ADFA510902ABFC2 |
999700000062714 | 8988211000000627144 | 0010 | 9353 | 57390501 | 9336 | 63122917 | DF8CBC862DB172C13CF09C37D7077009 | 0357A1719313FE31EA8112131810C98F | 76782966 | 676FF8C1E63C9B5E42440BD2CAB904A9 | 012F2D53A84DD2A49B5EB3DF909150D8 | AE2A7F7BBC1D90798642D14C1836A4F6 | F4D6F15DFAE71D630929FF47A6A4DEF8 | EF7184E65444042B2FC483F60F7E9A1F | 16D5AA4B7ADD2BB651E7B4AA17AFF8CA | A40F63E77B2030BBC395F2B273706E3E | A3AB60E7035882F0749C580E72CFF258 | C00189E62A613AEBAA3D62F503E79CF0 |
999700000062715 | 8988211000000627151 | 0020 | 9485 | 21058360 | 4872 | 96519362 | E27DB5641388DC88023383DF5B401EDB | 8D69C7534358D38261B6C259B80D3E98 | 68964860 | 286CB70291B4E834D9BA920732CDF591 | FDBC115504FCC08F0D63185695FE37E9 | 132475092A918257375F1D887AFDAE4F | 757C941FBD2A28F26CF0FE5E2AC5CC0E | 15FE9B2C1A2A31CEE3CE58CEF5B0DF96 | 397F4A5A0C526957E1F3318B367126D0 | AB7EEC36E89AEA1867FF156021927ADB | 2DE9C29710AB2B525557DEA1DA8C55FC | 839A9F164252E43764EBB26DC6614CD7 |
999700000062716 | 8988211000000627169 | 0040 | 1464 | 31198887 | 2057 | 36373760 | F359B8166EF46A372C88206B4462A324 | 6DCF65673267D500311D018623921072 | 41623193 | 3862501C98CBBD5152A6CDBAF9BD2434 | E80CD41BBBC89490042942CF27CB297B | 3D6141749CEB1F752B31A734E1E45CBC | F23E009CB9E7E5079C7ADB05580E979F | E47CCF8AD44E69557FAF0EB80BF6A6B7 | D98A7BEE33BB4CDF610C124AB98D6F07 | 36BC12C5136B7FD96CA3779C6BE02956 | 49471E50B41842C95614D4328F192068 | B52AB6D87E61E924E155D42FE8E3C2EA |
999700000062717 | 8988211000000627177 | 0080 | 3284 | 96140939 | 9643 | 93743379 | 028220E005F873F1A3284F42372B2988 | 43189F0995996E7E3679A066D24CEDED | 28160161 | 1183A8DB6724D3E2A74A75A3A62B92ED | 4B7DD9C10DC3DFE773DB599BD727DB9E | FAC3A5060796B04CE55AA51F4256E967 | 17306A88BCDDBB2616462DF486696980 | AC816E351D5D182DDB26F90D86306017 | B5E8CE7827E40E5919A85F7C5914B1DE | EA0EA0C3F684B22D138D6824E286DCE6 | D30D39E10FBFCF16A304AB5A15D85CB4 | 170CC01E43B52D37DA4D09F2CFB5AE70 |
999700000062718 | 8988211000000627185 | 0100 | 6127 | 10427798 | 6198 | 23000926 | F977E20E697D40B490705AEADE114FE0 | F69529E7DED8F8E43778D009E5D489B7 | 90356141 | 5BC9015E4E096DAD5CB0373F96AF62A4 | 8601A153D1158185113FD671BD43C58B | 66BC2351B1AA119F49C11173CBC0C6AC | CEB29AE0E2517E66A39E6BAE3E8A7F8E | FE59FBA49A16817FB3C66908220A7319 | 762B4058A6899BD1DDF7B2D435BA39BA | 6DFAC54B3C4DADCA8F3E15692200D117 | A70216CAF2EA3EFAAF4C44A58F7C002B | 948D229E5A5F827A79D591F2F6BAE13C |
999700000062719 | 8988211000000627193 | 0200 | 5640 | 25025736 | 1752 | 46086423 | BEC6CEAECF3A07451282A63FE32C3D8A | DC30FF0D150098F8F0D3F9FB5537AD72 | 96170539 | 613BCEAE8CB3F8EE5BEBD7AF47E19B73 | EA046F17FCB1A4FFA54E70DB9305C849 | 4602678689B82831CD7D49B6431AE55E | AEBF0E8647F3799DA00F00CB1941FCEF | 246C031FE66C05DDE1B753FBF7199515 | 65E67D61D2F122DFF88F76AE6DE08495 | C91FA25B7FFFF24CD85E69850554D6B8 | B0BACD46371DC420FA0ADAB4DEAFF583 | 9C917F1A5E5CFF85FDBA12E6E59B936F |
|
from: https://github.com/osmocom/pysim
Download pySim :
git clone https://github.com/osmocom/pysim
cd pysim
sudo apt-get install --no-install-recommends \
pcscd libpcsclite-dev \
python3 \
python3-setuptools \
python3-pyscard \
python3-pip
pip3 install -r requirements.txt
if cannot pip3 install may need to access venv
python3 -m venv myenv
source myenv/bin/activate
pip3 install -r requirements.txt
when finish deactivate the venv
deactivate
enter the pysim directory
cd pysim
check the current ISIM config
./pySim-read.py -p0
for adding subscriber via mongoDB, need to install open5gs-dbctl
curl https://raw.githubusercontent.com/open5gs/open5gs/main/misc/db/open5gs-dbctl > ./open5gs-dbctl
chmod +x ./open5gs-dbctl
./open5gs-dbctl help
to roaming, we need to config MCC, MNC, IMSI
to have plmn_id:00101
or plmn_id:90170
reconfig the isim
cd pysim
## check current sim config
./pySim-read.py -p0
## config new
./pySim-prog.py -p0 -s <ICCID> --mcc=<MCC> --mnc=<MNC> -a <ADM-KEY> --imsi=<IMSI> -k <KI> --opc=<OPC>
this is what we changed, be careful, after 3 wrong ADM-KEY
attempts, the SIM will be blocked and cannot be rewritten again.
./pySim-prog.py -p0 -s 8988211000000627136 --mcc=001 --mnc=01 -a 73947583 --imsi=001010000062713 -k 96E5235D7BD18E48BEF1B85521383C4E --opc=B1C0A05123C419D615B71EC0F8CE13AB
./pySim-prog.py -p0 -s 8988211000000627144 --mcc=901 --mnc=70 -a 76782966 --imsi=901700000062714 -k DF8CBC862DB172C13CF09C37D7077009 --opc=0357A1719313FE31EA8112131810C98F
./pySim-prog.py -p0 -s 8988211000000627151 --mcc=001 --mnc=01 -a 68964860 --imsi=001010000062715 -k E27DB5641388DC88023383DF5B401EDB --opc=8D69C7534358D38261B6C259B80D3E98
result of config
./pySim-prog.py -p0 -s 8988211000000627144 --mcc=901 --mnc=70 -a 76782966 --imsi=901700000062714 -k DF8CBC862DB172C13CF09C37D7077009 --opc=0357A1719313FE31EA8112131810C98F
Warning: Ignoring XDG_SESSION_TYPE=wayland on Gnome. Use QT_QPA_PLATFORM=wayland to run on Wayland anyway.
Using reader PCSC[Alcor Micro AU9540 00 00]
Ready for Programming: Insert card now (or CTRL-C to cancel)
Autodetected card type: sysmoISIM-SJA2
Generated card parameters :
> Name : Magic
> SMSP : e1ffffffffffffffffffffffff0581005155f5ffffffffffff000000
> ICCID : 8988211000000627144
> MCC/MNC : 901/70
> IMSI : 901700000062714
> Ki : DF8CBC862DB172C13CF09C37D7077009
> OPC : 0357A1719313FE31EA8112131810C98F
> ACC : None
> ADM1(hex): 3736373832393636
> OPMODE : None
Programming ...
Warning: Programming of the ICCID is not implemented for this type of card.
Programming successful: Remove card from reader
add script in pysim/script/srsran.script
to deactivate service 124 and 125
- the script enter
pyshell
-
verify_ADM
, if correct, returns nothing. If incorrect, after 3 wrong attempts the SIM will be blocked and cannot be rewritten again. - then deactivate UST service 124 and 125
# script to be used with pySim-shell.py which is part of the Osmocom pysim package,
# found at https://osmocom.org/projects/pysim/wiki
set echo true
# this script will deactivate all 5G related services and files. This can be used
# in case you do not wish to use any 5G services, or you do not wish to configure
# the 5G specific files on the USIM card. The card will then behave like a 3G USIM
# without any 5G capability, using the default fall-back mechanisms specified by 3GPP.
# TODO: add your card-specific ADM pin at the end of the verify_adm line below
verify_adm 76782966
# Key Provisioning
select MF
select ADF.USIM
select DF.5GS
select EF.SUCI_Calc_Info
update_binary_decoded '{ "prot_scheme_id_list": [ {"priority": 0, "identifier": 2, "key_index": 1}, {"priority": 1, "identifier": 1, "key_index": 2}, {"priority": 2, "identifier": 0, "key_index": 0}], "hnet_pubkey_list": [ {"hnet_pubkey_identifier": 27, "hnet_pubkey": "0272DA71976234CE833A6907425867B82E074D44EF907DFB4B3E21C1C2256EBCD1"}, {"hnet_pubkey_identifier": 30, "hnet_pubkey": "5A8D38864820197C3394B92613B20B91633CBD897119273BF8E4A6F4EEC0A650"}]}'
# Routing Indicator
select MF
select ADF.USIM
select DF.5GS
select EF.Routing_Indicator
update_binary 0071ffff
# Service Table
select MF
select ADF.USIM
select EF.UST
ust_service_deactivate 124
ust_service_deactivate 125
- run the above script to deactivate service 124 and 125
./pySim-shell.py -p0 --script ./scripts/srsran.script
- check that the services are no longer activate
./pySim-read.py -p0
## go to webui
cd webui
## run command
npm run dev
go to localhost:9999
or 127.0.0.1:9999
to add subscriber
username: admin
password: 1423
information required include
## subscriber configuration
IMSI: 901700000062714
K: DF8CBC862DB172C13CF09C37D7077009
AMF: 8000
OPc: 0357A1719313FE31EA8112131810C98F
## session configuration
DNN/APN: internet
Type: IPv4
the key of this configuration is
- IMSI after set PLMN to
90170...
or00101...
- K and OPc need to be correct
- APN need to match with UE config, or else UE cannot access internet
- Type must be
IPv4
only.
in case the webui keep spinning clear cache of your web browser
using open5gs-dbtcl
- install open5gs-dbtcl
curl https://raw.githubusercontent.com/open5gs/open5gs/main/misc/db/open5gs-dbctl > ./open5gs-dbctl
- add subscriber
./open5gs-dbctl add 901700000062714 DF8CBC862DB172C13CF09C37D7077009 0357A1719313FE31EA8112131810C98F
./open5gs-dbctl add 901700000062713 96E5235D7BD18E48BEF1B85521383C4E B1C0A05123C419D615B71EC0F8CE13AB
if you already add on localhost:9999
which is open5gs/webui, result will show
MongoServerError: E11000 duplicate key error collection: open5gs.subscribers index: imsi_1 dup key: { imsi: "001010000062713" }s
The Open5GS 5G SA Core contains the following functions:
NRF - NF Repository Function
SCP - Service Communication Proxy
SEPP - Security Edge Protection Proxy
AMF - Access and Mobility Management Function
SMF - Session Management Function
UPF - User Plane Function
AUSF - Authentication Server Function
UDM - Unified Data Management
UDR - Unified Data Repository
PCF - Policy and Charging Function
NSSF - Network Slice Selection Function
BSF - Binding Support Function
The configuration is in sample.yaml
. And the code ./build/test/apps/5gc
will run based on this config
The main modification:
- plmn_id to match what we set in the SIM
test:
serving:
- plmn_id:
mcc: 901
mnc: 70
- no sepp service
- [optional] mme is for config 4G
- in
amf
section
4.1. make surengap address
is matched withamf address
in gnb_config
4.2. make surePLMN
value is consistent across sectionsguami
,tai
, andplamn_support
4.3 settac: 7
intai
- in
upf
section, make suregtpu address
is matched withamf address
in gnb_config
amf:
sbi:
server:
- address: 127.0.0.5
port: 7777
client:
scp:
- uri: http://127.0.0.200:7777
ngap:
server:
- address: 127.0.0.2
metrics:
server:
- address: 127.0.0.5
port: 9090
guami:
- plmn_id:
mcc: 901
mnc: 70
amf_id:
region: 2
set: 1
tai:
- plmn_id:
mcc: 901
mnc: 70
tac: 7
plmn_support:
- plmn_id:
mcc: 901
mnc: 70
s_nssai:
- sst: 1
security:
integrity_order : [ NIA2, NIA1, NIA0 ]
ciphering_order : [ NEA0, NEA1, NEA2 ]
network_name:
full: Open5GS
amf_name: open5gs-amf0
time:
t3512:
value: 540 # 9 mintues * 60 = 540 seconds
upf:
pfcp:
server:
- address: 127.0.0.7
gtpu:
server:
- address: 127.0.0.2
session:
- subnet: 10.45.0.0/16
gateway: 10.45.0.1
- subnet: 2001:db8:cafe::/48
gateway: 2001:db8:cafe::1
metrics:
server:
- address: 127.0.0.7
port: 9090
The configuration is in /srsRAN_Project/build/apps/gnb
.
- make sure
amf adress
is match withopen5gs/amf/npgap address
andopen5gs/upf/gtpu address
-
amf bind_addr
is in the same network withamf_address
- include
cu_cp/ inactivity time
to make UE has enough time to properly config to connect to the network -
ru_sdr
dont includeclock
andsync
as we don't have external clock - in
cell_cfg
5.1 setdl_arfcn: 627340
5.2 setband: 78
5.3 make sureplmn
match with SIM config
5.4tac: 7
amf:
addr: 127.0.0.2 # The address or hostname of the AMF.
bind_addr: 127.0.0.1 # A local IP that the gNB binds to for traffic from the AMF.
cu_cp:
inactivity_timer: 7200 # allow UE to have enough time to properly config to connect to the internet
ru_sdr:
device_driver: uhd # The RF driver name.
device_args: type=b200,num_recv_frames=64,num_send_frames=64 # Optionally pass arguments to the selected RF driver.
# clock: internal # Specify the clock source used by the RF.
# sync: internal # Specify the sync source used by the RF.
srate: 23.04 # RF sample rate might need to be adjusted according to selected bandwidth.
otw_format: sc12
tx_gain: 89 # Transmit gain of the RF might need to adjusted to the given situation.
rx_gain: 60 # Receive gain of the RF might need to adjusted to the given situation.
cell_cfg:
dl_arfcn: 627340 # ARFCN of the downlink carrier (center frequency).
band: 78 # The NR band.
channel_bandwidth_MHz: 20 # Bandwith in MHz. Number of PRBs will be automatically derived.
common_scs: 30 # Subcarrier spacing in kHz used for data.
plmn: "90170" # PLMN broadcasted by the gNB.
tac: 7 # Tracking area code (needs to match the core configuration).
pci: 1 # Physical cell ID.
log:
filename: /tmp/gnb.log # Path of the log file.
all_level: debug # Logging level applied to all layers.
pcap:
mac_enable: true # Set to true to enable MAC-layer PCAPs.
mac_filename: /tmp/gnb_mac.pcap # Path where the MAC PCAP is stored.
ngap_enable: true # Set to true to enable NGAP PCAPs.
ngap_filename: /tmp/gnb_ngap.pcap # Path where the NGAP PCAP is stored.
- to prevent IP fragmentation
- to test UL BW: Core network (iPerf server), UE (iPerf client) from: https://github.com/srsran/srsRAN_Project/discussions/629
- set
mtu
ofsmf
insample.yaml
to1450
. The sample.yaml is the config file for running code./build/tests/app/5gc
smf:
mtu: 1450
- set
mtu
of UE interface, in this case iswwan0
to1400
, which is the interface of my UE
sudo ip link set wwan0 mtu 1400
ifconfig wwan0
wwan0: flags=4305<UP,POINTOPOINT,RUNNING,NOARP,MULTICAST> mtu 1400
inet 10.45.0.2 netmask 255.255.255.252 destination 10.45.0.2

- check IP address of gNB's machine and open5GS' machine
ip addr show
ifconfig -a
- set LAN interface (eno1) of open5gs' machine to a static IP address
192.168.8.2
6.1.1. Identify Netplan Configuration File \
- Find the Netplan Configuration file
ls /etc/netplan/
- If cannot find for this interface, create new file
sudo nano /etc/netplan/01-netcfg.yaml
6.1.2. Edit Netplan Configuration File
nano
in the file to modify the config
- set a static IP to
192.168.8.2
- with netmask
255.255.255.0
- with the default gateway of
192.168.8.1
network:
version: 2
renderer: NetworkManager
ethernets:
eno1:
dhcp4: no
addresses:
- 192.168.8.2/24
gateway4: 192.168.8.1
nameservers:
addresses:
- 8.8.8.8
- 8.8.4.4
-
dhcp4: no
: to disable DHCP and use a static IP -
nameservers
: specifies DNS server.8.8.8.8
,8.8.4.4
is Google DNS's server
6.1.3. Apply Netplan change
apply the change
sudo netplan apply
6.1.4. Verify the config \
ip addr show eno1
ifconfig eno1
IP address | addr match in open5GS | addr match in gNB | Netmask | Gateway | |
---|---|---|---|---|---|
open5GS | 192.168.8.2 | 255.255.255.0 | 192.168.8.1 | ||
gNB | 192.168.8.3 | AMF bind_addr | 255.255.255.0 | 192.168.8.1 | |
AMF | 192.168.8.4 | AMF NGAP addr UPF GTPU addr |
AMF addr | 255.255.255.0 |
- open5GS config file
amf:
ngap:
server:
# - address: 127.0.0.2 # gNB and CN on the same machine
- address: 192.168.8.4 # @1mm open5gs run on different machine
upf:
gtpu:
server:
#- address: 127.0.0.2 # gNB and CN on the same machine
- address: 192.168.8.4 # @1mm open5gs run on different machine
- gNB config file
amf:
addr: 192.168.8.4 # The address or hostname of the AMF.
bind_addr: 192.168.8.2 # A local IP that the gNB binds to for traffic from the AMF.
diagram of connected equipments
flowchart to start system
use operator SIM card with the CPE
- open webui
cd open5gs/webui
npm run dev
go to localhost:9999
or 127.0.0.1:9999
, with username: admin, password: 1423
- enable TUN device (not persistence after boot)
cd open5gs
sudo ./misc/netconf.sh
Cannot find device "ogstun2"
Cannot find device "ogstun2"
Cannot find device "ogstun3"
Cannot find device "ogstun3"
check ifconfig of ogstun
ifconfig ogstun
ogstun: flags=4241<UP,POINTOPOINT,NOARP,MULTICAST> mtu 1500
inet 10.45.0.1 netmask 255.255.0.0 destination 10.45.0.1
inet6 2001:db8:cafe::1 prefixlen 48 scopeid 0x0<global>
unspec 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00 txqueuelen 500 (UNSPEC)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
- enable IP forwarding and NAT rule
### 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
check IP table and NAT
>> sudo iptables -L -t nat
Chain PREROUTING (policy ACCEPT)
target prot opt source destination
DOCKER all -- anywhere anywhere ADDRTYPE match dst-type LOCAL
Chain INPUT (policy ACCEPT)
target prot opt source destination
Chain OUTPUT (policy ACCEPT)
target prot opt source destination
DOCKER all -- anywhere !localhost/8 ADDRTYPE match dst-type LOCAL
Chain POSTROUTING (policy ACCEPT)
target prot opt source destination
MASQUERADE all -- 172.17.0.0/16 anywhere
MASQUERADE all -- 10.53.1.0/24 anywhere
MASQUERADE all -- 172.19.1.0/24 anywhere
MASQUERADE all -- 10.45.0.0/16 anywhere
Chain DOCKER (2 references)
target prot opt source destination
RETURN all -- anywhere anywhere
RETURN all -- anywhere anywhere
RETURN all -- anywhere anywhere
- configure firewall and disable it, as some defualt Ubuntu enable firewall rules to block traffic
>> sudo ufw status
Status: inactive
>> sudo ufw disable
Firewall stopped and disabled on system startup
>> sudo ufw status
Status: inactive
- (obsolete) add security running this command help improve stability of network as it reject incoming package. However, you won't be able to receive anything including ping and iperf
### Prevent UE's from connecting to the host on which UPF is running
## sudo iptables -I INPUT -s 10.45.0.0/16 -j DROP
## sudo ip6tables -I INPUT -s 2001:db8:cafe::/48 -j DROP
- check IP table and NAT rule, and ifconfig again
sudo iptables -L -t nat
sudo iptables -L
ifconfig ogstun
- start Open5GS Service
5gc
which run on configuration insample.yml
sudo ./build/tests/app/5gc
check all open5gs services are running
ps aux | grep open5gs
sudo netstat -tupln | grep open5gs
- connect SDR to the port USB 3.0, or else the screen of gNB will show
timeout expired
check uhd device is connected
>> uhd_find_devices
[INFO] [UHD] linux; GNU C++ version 10.5.0; Boost_107400; UHD_4.0.0.HEAD-0-g90ce6062
--------------------------------------------------
-- UHD Device 0
--------------------------------------------------
Device Address:
serial: 326C096
name: MyB210
product: B210
type: b200
- run performance script
cd srsRAN_Project
./script/srsran_performance
- start gNB with config file
cd build/apps/gnb/
sudo ./gnb -c gnb_fllay.yml
if existed gNB is persisted, kill it
sudo netstat -tupln | grep gnb
sudo kill -9 <pid>
add metric_receieve.py to listen the gnb trace on UDP socket, and save the file to analyzer later
python3 metric_receiver.py > gnb_trace_150524.txt
if this warning shows, could be on issue with USB - fix it! (USB not connect to either end properly, wrong port, wrong cable)
[WARNING] [MULTI_USRP] The total sum of rates (23.040000 MSps on 1 channels) exceeds the maximum capacity of the connection.
This can cause underruns (U).
for ZLTX CPE, go to 192.168.0.1
with admin/admin
- set network mode to
SA/NSA
- config
APN
to match APN in subscriber_list -> then check APN information - enable
roaming
- toggle
NAT
rule again, so that the UE can connect to internet other things to try - disable VoLTE and/or VoNR
NAT rule