[[Include(WikiToC)]] == Amarisoft 5G Network with COTS UEs == === Description === This tutorial contains instructions for setting up [https://www.amarisoft.com/ amarisoft] 5G NR network using COTS user equipment. Amarisoft provides software based gNB, 5GCore (eNB,EPC), and UE simulator that run on commodity off-the-shelf devices. A typical software-based cellular basestation/UE consists of a host PC and an SDR, where host PC is used for processing the baseband signals sent to and received from the SDR. Amarisoft supports various SDRs including USRPs such as N310, X310. In this tutorial, we run 5GCore, gNB(SA) on a host server+USRP N310 in COSMOS SB1. The UEs used in this experiment are 1)SIMCOM SIM8200EA-M2 USB modem on sdr1-in3.sb1.cosmos 2)OnePlus8T KB2005 phone (remotely accessible on srv1-in3.sb1.cosmos) === Prerequisites === In order to access the test bed, create a reservation and have it approved by the reservation service. Access to the resources is granted after the reservation is confirmed. Please follow the process shown on the COSMOS [wiki:GettingStarted getting started] page to get started. === Resources required === 1 server, 1 USRP N310 for the base station and sdr1-in3 or srv1-in3 to access the UE in [https://wiki.cosmos-lab.org/wiki/Architecture/Domains/cosmos_sb1 COSMOS SB1] domain === Tutorial Setup === Follow the steps below to gain access to the [wiki:/Architecture/Domains/cosmos_sb1 sandbox 1 console] and set up nodes with appropriate images. 1. If you don't have one already, sign up for a [https://www.cosmos-lab.org/portal-2/ COSMOS account] 1. [wiki:/GettingStarted#MakeaReservation Create a resource reservation] on sandbox 1 1. [wiki:/GettingStarted#LogintoyourReservation Login] into sandbox 1 console (console.sb1.cosmos-lab.org). 1. Make sure all the resources in the domain are turned off: {{{#!shell omf tell -a offh -t system:topo:allres }}} In this tutorial, for the Amarisoft base station we will be using the SB1 server srv2-lg1, and the USRP N310 sdr1-s1-lg1. 1. Load amarisoft-tutorial-cosmos.ndz on srv2-lg1. {{{#!shell omf load -i amarisoft-tutorial-cosmos.ndz -t srv2-lg1 }}} 1. To access the UE, Waveshare SIM8200 USB modem connected to sdr1-in3, load the image waveshare-sim8200.ndz on sdr1-in3. This image has the SIMCOM network drivers installed to control the modem. {{{#!shell omf load -i waveshare-sim8200.ndz -t sdr1-in3 }}} 1. To access the phones connected to srv1-in3, load the image vysor-cosmos.ndz on srv1-in3. This image has [Vysor https://www.vysor.io/] and chrome remote desktop client installed in order to provide remote access to the phones. {{{#!shell omf load -i vysor-cosmos.ndz -t srv1-in3 }}} 1. Turn all the required resources on and check the status {{{#!shell omf tell -a on -t srv2-lg1,sdr1-s1-lg1,sdr1-in3,srv1-in3 }}} {{{#!shell omf stat -t system:topo:allres }}} === Tutorial Execution === [[CollapsibleStart(Run the Amarisoft base station)]] ==== Check the USRP ==== * Log in to the server srv2-lg1 with 2 SSH sessions. {{{#!shell ssh root@srv2-lg1 }}} * Upon logging into the server, run eth_config.sh. This sets up the 10G data interfaces DATA1, DATA2. After running the script, you should see that the data interfaces have the appropriate IP addresses assigned, as per this [https://wiki.cosmos-lab.org/wiki/Architecture/Domains/cosmos_sb1#IPAddressAssignment table]. The server should then be able to access the USRP N310 sdr1-md1 which can be checked by running uhd_find_devices. {{{#!td {{{#!shell root@srv2-lg1:~# ./eth_config.sh }}} {{{#!shell root@srv2-lg1:~# ifconfig DATA1 DATA1: flags=4163 mtu 9000 inet 10.38.1.2 netmask 255.255.0.0 broadcast 10.38.255.255 inet6 fe80::ba59:9fff:fedd:bd94 prefixlen 64 scopeid 0x20 ether b8:59:9f:dd:bd:94 txqueuelen 1000 (Ethernet) RX packets 2764979088 bytes 8198039666643 (8.1 TB) RX errors 0 dropped 295845 overruns 0 frame 0 TX packets 3653147129 bytes 11884176775843 (11.8 TB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 root@srv2-lg1:~# ifconfig DATA2 DATA2: flags=4163 mtu 9000 inet 10.39.1.2 netmask 255.255.0.0 broadcast 10.39.255.255 inet6 fe80::ba59:9fff:fedd:bd95 prefixlen 64 scopeid 0x20 ether b8:59:9f:dd:bd:95 txqueuelen 1000 (Ethernet) RX packets 334886 bytes 31982544 (31.9 MB) RX errors 0 dropped 295867 overruns 0 frame 0 TX packets 10148 bytes 3378247 (3.3 MB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 }}} }}} {{{#!td {{{#!shell root@srv2-lg1:~# uhd_find_devices [INFO] [UHD] linux; GNU C++ version 7.5.0; Boost_106501; UHD_3.15.0.0-release -------------------------------------------------- -- UHD Device 0 -------------------------------------------------- Device Address: serial: 3176DF5 addr: 10.38.2.1 claimed: False mgmt_addr: 10.37.2.1 mgmt_addr: 10.38.2.1 mgmt_addr: 10.39.2.1 product: n310 type: n3xx }}} }}} * Notice the IP addresses of the N310 - 10.37.2.1 is the 1G management interface, where as the other 2 are 10G data interfaces. ==== Run the MME ==== * We are going to run the MME, gNodeB on srv2-lg1. * Run the Amarisoft MME on srv2-lg1. Run lte_init.sh to setup IP forwarding so that the UEs can connect to the Internet, once they establish a connection with the base station. This network uses PLMN 310014 (USA Test network) as configured in mme.cfg. {{{#!shell root@srv2-lg1:~# cd /opt/amarisoft/ltemme-linux-2022-09-16 root@srv2-lg1:/opt/amarisoft/ltemme-linux-2022-09-16# ./lte_init.sh Select CTRL default interface Configure NAT for CTRL net.ipv4.tcp_congestion_control = bbr net.core.rmem_max = 50000000 net.core.wmem_max = 5000000 root@srv2-lg1:/opt/amarisoft/ltemme-linux-2022-09-16# ./ltemme config/mme.cfg Core version 2022-09-16, Copyright (C) 2012-2022 Amarisoft This software is licensed to Rutgers University (The State University of New Jersey). License server: license.orbit-lab.org (0b-b4-46-dc-2f-83-58-cb) Support and software update available until 2023-08-18. (mme) }}} * Type 'help' at the prompt to explore the available mme commands. ==== Run the gNodeB ==== * Run Amarisoft 5G NR Stand alone gNodeB as shown below by passing the gNodeB configuration file as an argument. The configuration file defines SDR(USRP N310) address, operating band, bandwidth and other parameters. {{{#!shell root@srv2-lg1:~# cd /opt/amarisoft/lteenb-linux-2022-09-16 root@srv2-lg1:/opt/amarisoft/lteenb-linux-2022-09-16# root@srv2-lg1:/opt/amarisoft/lteenb-linux-2022-09-16# ./lteenb config/gnb-sa-n310.cfg Base Station version 2022-09-16, Copyright (C) 2012-2022 Amarisoft This software is licensed to Rutgers University (The State University of New Jersey). License server: license.orbit-lab.org (0b-b4-46-dc-2f-83-58-cb) Support and software update available until 2023-08-18. [INFO] [UHD] linux; GNU C++ version 7.5.0; Boost_106501; UHD_3.15.0.0-release [INFO] [MPMD] Initializing 1 device(s) in parallel with args: mgmt_addr=10.38.2.1,type=n3xx,product=n310,serial=3176DF5,claimed=False,addr=10.38.2.1,master_clock_rate=122.88e6 [INFO] [MPM.PeriphManager] init() called with device args `master_clock_rate=122.88e6,clock_source=internal,product=n310,time_source=internal,mgmt_addr=10.38.2.1'. [INFO] [0/Replay_0] Initializing block control (NOC ID: 0x4E91A00000000004) [INFO] [0/Radio_0] Initializing block control (NOC ID: 0x12AD100000011312) [INFO] [0/Radio_1] Initializing block control (NOC ID: 0x12AD100000011312) [INFO] [0/DDC_0] Initializing block control (NOC ID: 0xDDC0000000000000) [INFO] [0/DDC_1] Initializing block control (NOC ID: 0xDDC0000000000000) [INFO] [0/DUC_0] Initializing block control (NOC ID: 0xD0C0000000000002) [INFO] [0/DUC_1] Initializing block control (NOC ID: 0xD0C0000000000002) [INFO] [0/FIFO_0] Initializing block control (NOC ID: 0xF1F0000000000000) [INFO] [0/FIFO_1] Initializing block control (NOC ID: 0xF1F0000000000000) [INFO] [0/FIFO_2] Initializing block control (NOC ID: 0xF1F0000000000000) [INFO] [0/FIFO_3] Initializing block control (NOC ID: 0xF1F0000000000000) RF0: sample_rate=30.720 MHz dl_freq=2589.420 MHz ul_freq=2589.420 MHz (band n41) dl_ant=2 ul_ant=1 Warning, CPU hyperthreading is enabled, we do not recommend using it. (enb) WARNING: The GPS is not locked. If you need time synchronization, you should restart the program when the GPS is locked. Chan Gain(dB) Freq(MHz) TX1 45.0 2589.420000 TX2 45.0 2589.420000 RX1 50.0 2589.420000 (enb) ng gNB NG connection state: - server=127.0.1.100:38412 state=setup_done PLMN=310014 (enb) cell phy [gnb0012345] PLMN=310014 gNB_ID=0x12345 --------Global-------- -----------DL---------- -----------UL---------- -----SSB--- Cell RAT BAND BW P ARFCN ANT NL SCS QAM ARCFN ANT NL SCS QAM ARFCN SCS 0x001 NR n41 20 0 517884 2 2 30 256 517884 1 1 30 256 517710 30 (enb) }}} * Type 'help' at the prompt and use commands like 'cell phy' to look at the various parameters of the base station. [[CollapsibleEnd]] [[CollapsibleStart(SIM8200 UE)]] * As the base station runs,SIM8200 modem on srv1-in1 communicates with the base station and registers to the network. You can see eNodeb trace similar to the one below. {{{#!shell (enb) t Press [return] to stop the trace PRACH: cell=01 seq=5 ta=18 snr=16.7 dB ----DL----------------------- ----UL------------------------------------------------ UE_ID CL RNTI C cqi ri mcs retx txok brate C snr puc1 mcs rxko rxok brate #its phr pl ta 11 001 460b 1 15 2 16.8 4 9 5.53k 1 33.1 - 20.5 0 5 2.18k 1/1.4/2 28 50 -0.2 11 001 460b 1 15 2 24.0 1 4 3.24k 1 33.1 - - 0 0 0 - 28 50 - 11 001 460b 1 15 2 24.0 1 4 3.24k 1 33.1 - - 0 0 0 - 28 50 - 11 001 460b 1 15 2 23.0 0 4 3.60k 1 33.1 - - 0 0 0 - 28 50 - 11 001 460b 1 15 2 23.0 0 4 3.03k 1 33.1 - - 0 0 0 - 28 50 - }}} * In the MME session you can check the gNodeb and registered UE. The modem has a SIM card with IMSI 310014000000021 as shown in the MME log below. IP address 192.168.2.2 has been allocated to the modem. In the trace below you can see the CN listed as 5GC for the 5GNR SA network. {{{#!shell (mme) gnb PLMN RAN_ID IP:Port #UEctx TACs 310014 0x12345 127.0.1.1:47084 0 0x64 (mme) ue SUPI IMEISV CN M-TMSI/5G-TMSI REG TAC #BEARER IP_ADDR 310014000000021 8642840402469000 5GC 0x73208a4b Y 310014. 0x64 2 192.168.4.6 2001:468:3000:2:: 192.168.2.2 (mme) }}} * On sdr1-in3, you can see that the modem shows up as a wwan interface wwp0s20u3i5. {{{#!shell root@sdr1-in3:~# ifconfig -a CTRL: flags=4163 mtu 1500 inet 10.37.13.1 netmask 255.255.0.0 broadcast 10.37.255.255 inet6 fe80::d250:99ff:fed1:5cc8 prefixlen 64 scopeid 0x20 ether d0:50:99:d1:5c:c8 txqueuelen 1000 (Ethernet) RX packets 379688 bytes 91792578 (91.7 MB) RX errors 0 dropped 9 overruns 0 frame 0 TX packets 100257 bytes 7433170 (7.4 MB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 device memory 0x92120000-9213ffff DATA1: flags=4163 mtu 1500 inet6 fe80::92e2:baff:fe8f:a114 prefixlen 64 scopeid 0x20 ether 90:e2:ba:8f:a1:14 txqueuelen 1000 (Ethernet) RX packets 373708 bytes 44790598 (44.7 MB) RX errors 0 dropped 297144 overruns 0 frame 0 TX packets 10120 bytes 3386934 (3.3 MB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 DATA2: flags=4163 mtu 1500 inet6 fe80::92e2:baff:fe8f:a115 prefixlen 64 scopeid 0x20 ether 90:e2:ba:8f:a1:15 txqueuelen 1000 (Ethernet) RX packets 336359 bytes 32135668 (32.1 MB) RX errors 0 dropped 297144 overruns 0 frame 0 TX packets 10136 bytes 3388196 (3.3 MB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 enx00e05ce8172d: flags=4098 mtu 1500 ether 00:e0:5c:e8:17:2d txqueuelen 1000 (Ethernet) 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 lo: flags=73 mtu 65536 inet 127.0.0.1 netmask 255.0.0.0 inet6 ::1 prefixlen 128 scopeid 0x10 loop txqueuelen 1000 (Local Loopback) RX packets 216 bytes 16383 (16.3 KB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 216 bytes 16383 (16.3 KB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 notused: flags=4099 mtu 1500 ether d0:50:99:d1:5c:c9 txqueuelen 1000 (Ethernet) 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 device memory 0x92100000-9211ffff wwp0s20f0u4u4i5: flags=4291 mtu 1500 inet 192.168.2.2 netmask 255.255.255.252 broadcast 192.168.2.3 inet6 fe80::e090:63ff:fe1f:6ead prefixlen 64 scopeid 0x20 ether e2:90:63:1f:6e:ad txqueuelen 1000 (Ethernet) 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 225 dropped 0 overruns 0 carrier 0 collisions 0 }}} * Set the IP address of the wwan interface to the one allocated by the MME (192.168.2.2 in this case) {{{#!shell root@sdr1-in3:~# ifconfig wwp0s20f0u4u4i5 192.168.2.2 netmask 255.255.255.0 }}} * You can now communicate with the base station over the air(5G). The data connection can be tested with ping or iperf as below. {{{#!shell root@sdr1-in3:~# ping 192.168.2.1 PING 192.168.2.1 (192.168.2.1) 56(84) bytes of data. 64 bytes from 192.168.2.1: icmp_seq=1 ttl=64 time=226 ms 64 bytes from 192.168.2.1: icmp_seq=2 ttl=64 time=17.2 ms 64 bytes from 192.168.2.1: icmp_seq=3 ttl=64 time=16.2 ms 64 bytes from 192.168.2.1: icmp_seq=4 ttl=64 time=12.6 ms 64 bytes from 192.168.2.1: icmp_seq=5 ttl=64 time=32.7 ms 64 bytes from 192.168.2.1: icmp_seq=6 ttl=64 time=30.7 ms 64 bytes from 192.168.2.1: icmp_seq=7 ttl=64 time=46.7 ms 64 bytes from 192.168.2.1: icmp_seq=8 ttl=64 time=37.2 ms 64 bytes from 192.168.2.1: icmp_seq=9 ttl=64 time=25.6 ms 64 bytes from 192.168.2.1: icmp_seq=10 ttl=64 time=34.2 ms ^C --- 192.168.2.1 ping statistics --- 10 packets transmitted, 10 received, 0% packet loss, time 9014ms rtt min/avg/max/mdev = 12.687/47.963/226.198/60.248 ms }}} * iperf testing with server on sdr1-in3 bound to the SIM8200 network interface wwp0s20f0u4u4i5 with IP address 192.168.2.2 {{{#!shell root@sdr1-in3:~# iperf3 -s -B 192.168.2.2 ----------------------------------------------------------- Server listening on 5201 ----------------------------------------------------------- }}} {{{#!shell root@srv2-lg1:~# iperf3 -c 192.168.2.2 --port 5201 -t 10 -b 0 Connecting to host 192.168.2.2, port 5201 [ 4] local 192.168.2.1 port 46572 connected to 192.168.2.2 port 5201 [ ID] Interval Transfer Bandwidth Retr Cwnd [ 4] 0.00-1.00 sec 8.48 MBytes 71.1 Mbits/sec 62 602 KBytes [ 4] 1.00-2.00 sec 7.50 MBytes 62.9 Mbits/sec 159 672 KBytes [ 4] 2.00-3.00 sec 9.34 MBytes 78.4 Mbits/sec 349 854 KBytes [ 4] 3.00-4.00 sec 9.88 MBytes 82.9 Mbits/sec 762 871 KBytes [ 4] 4.00-5.00 sec 8.95 MBytes 75.1 Mbits/sec 948 1.01 MBytes [ 4] 5.00-6.00 sec 10.5 MBytes 88.1 Mbits/sec 267 701 KBytes [ 4] 6.00-7.00 sec 9.51 MBytes 79.7 Mbits/sec 667 693 KBytes [ 4] 7.00-8.00 sec 9.88 MBytes 82.9 Mbits/sec 454 444 KBytes [ 4] 8.00-9.00 sec 9.21 MBytes 77.3 Mbits/sec 486 656 KBytes [ 4] 9.00-10.00 sec 9.63 MBytes 80.8 Mbits/sec 420 645 KBytes - - - - - - - - - - - - - - - - - - - - - - - - - [ ID] Interval Transfer Bandwidth Retr [ 4] 0.00-10.00 sec 92.9 MBytes 77.9 Mbits/sec 4574 sender [ 4] 0.00-10.00 sec 89.1 MBytes 74.7 Mbits/sec receiver }}} * The gNodeb trace looks as follows showing DL data rates around 90Mbps {{{#!shell 2 001 4602 1 14 2 23.4 103 2223 91.5M 1 30.8 - 16.2 51 425 5.09M 1/1.6/5 24 48 -0.2 2 001 4602 1 15 2 23.3 90 2193 90.7M 1 30.4 - 16.0 63 438 5.21M 1/1.7/5 21 45 -0.2 2 001 4602 1 15 2 22.8 89 1811 73.6M 1 29.8 - 16.0 68 360 4.14M 1/1.9/5 15 46 -0.2 ----DL----------------------- ----UL------------------------------------------------ UE_ID CL RNTI C cqi ri mcs retx txok brate C snr puc1 mcs rxko rxok brate #its phr pl ta 2 001 4602 1 15 2 23.1 93 1993 81.3M 1 30.3 - 16.0 57 390 4.42M 1/1.7/5 28 47 -0.2 2 001 4602 1 15 2 23.4 100 2223 92.5M 1 30.1 - 16.0 65 437 5.30M 1/1.8/5 28 45 -0.2 2 001 4602 1 15 2 23.1 62 2235 91.2M 1 29.5 - 16.1 53 430 5.13M 1/1.6/5 15 46 -0.2 2 001 4602 1 15 2 22.6 105 2145 85.9M 1 27.8 - 16.0 77 411 4.77M 1/1.9/5 28 48 -0.2 }}} [[CollapsibleEnd]] [[CollapsibleStart(Phone)]] * Log into srv1-in3 as 'native' with password 'native' {{{#!shell ssh native@srv1-in3 }}} * Access srv1-in3 via Chrome remote desktop by following the steps in this [https://wiki.cosmos-lab.org/wiki/UserGuide/RemoteAccess/ChromeRemoteDesktop tutorial] Note that this step of authorizing remote access needs to be performed after every reboot. On getting access, you should see the desktop as below [[Image(chromedesktop.JPG, width=500px)]] * Launch Vysor to see the phones [[Image(vysorphone.JPG, width=500px)]] * When the Amarisoft base station is running in band n41, you can see that the phone connects to it displaying "Amarisoft - Magic". UE list at the MME shows the phone connected with IMSI 310014000000019. [[Image(uelistMME.JPG, width=500px)]] {{{#!td [[Image(kb2005Amarisoft.JPG, width=200px)]] }}} {{{#!td [[Image(kb2005Speedtest.JPG, width=200px)]] }}} [[CollapsibleEnd]] [[CollapsibleStart(Using the Web Interface)]] * Amarisoft Web Interface can be used to analyze software logs and get information in real time. * Point your web browser to http://10.37.1.2/lte/ (10.37.1.2 is the CTRL IP address of srv2-lg1, where the MME and gNodeB are running) * Click 'server' in the left client panel, and add MME, gNodeB. Use the appropriate IP addresses and ports as shown below {{{#!td [[Image(amarisoft_add_server.JPG, width=500px)]] }}} {{{#!td ||= Server =||= IP addr =||= Port =|| || MME || 10.37.1.2 || 9000 || || gNodeB || 10.37.1.2 || 9001 || }}} [[Image(amarisoft_web_interface.JPG, width=1000px)]] [[CollapsibleEnd]]