Multiple UEs in RFsimulator

2023/09/15


Introduction

Laurent has a tutorial on how to connect multiple UEs over RFsimulator using network namespaces. While this tutorial gets the basics across, it is not very convenient as you have many commands to type manually. Since the parameters can be inferred automatically, I wrote the script multi-ue.sh that automates the creation and management of namespaces, and it is particularly useful when deploying multiple UEs.

In the following, I assume you have a core network deployed; further, I assume you have OAI compiled. It has been tested with tag 2023.w36.

Run and execute multiple UEs

Running multiple UEs on the same host leads to OAI trying the open multiple interfaces with the same name. You can avoid this by using the script. First, run the gNB, which will be on the “main” namespace:

sudo ./nr-softmodem -O gnb.conf --sa --rfsim.serveraddr server

Then, start multiple UEs with different IMSIs in their respective namespaces. For the first UE, create the namespace ue1 (-c1) and then execute bash inside (-e):

sudo ./multi-ue.sh -c1 -e
./nr-uesoftmodem -r 106 --numerology 1 --band 78 -C 3619200000 -O ue.conf --rfsimulator.serveraddr 10.201.1.100 --sa --rfsim

The RFsim server address is changed as we need to reach to the main namespace through an interface that acts as a proxy.

Afterwards, start the second UE in namespace ue2 with a different IMSI:

sudo ./multi-ue.sh -c2 -e
./nr-uesoftmodem -r 106 --numerology 1 --band 78 -C 3619200000 -O ue.conf --uicc0.imsi 208950000000032 --rfsimulator.serveraddr 10.202.1.100

If the core is correctly configured, both UEs should get an IP address. After you are done, delete each namespace using

sudo ./multi-ue.sh -d1
sudo ./multi-ue.sh -d2

Note that you can create multiple namespaces at once (and also delete them):

sudo ./multi-ue.sh -c{1..8} # is equivalent to -c1 -c2 ...
sudo ./multi-ue.sh -d{1..8}

You can execute bash inside a previously generated namespace using -o NUM:

sudo ./multi-ue.sh -o1
sudo ip netns exec ue1 bash # equivalent

Hence, you can also run the softmodems from the current shell:

sudo ip netns exec ue1 ./nr-uesoftmodem -r 106 --numerology 1 --band 78 -C 3619200000 -O ue.conf --uicc0.imsi 208950000000032 --rfsimulator.serveraddr 10.202.1.100

Use it with the noS1 mode

Tho noS1 is a mode in which both the gNB and UE open TUN interfaces to exchange data, circumventing any core network. This can be useful, e.g., to test with the do-ra mode. The do-ra mode allows to skip any RRC procedures between gNB and UE after random access. In this mode, the gNB pregenerates configuration to be read by the UE before connecting, and it is therefore similar to NSA, where the UE gets all configuration for the gNB through the eNB before doing random access.

Combining noS1 and do-ra therefore allows to connect a UE to a gNB without the core network, and exchange data between both. However, if both UE and gNB are on the same host, they both open a network interface with IP addresses in the same subnetwork. For instance, in this case you cannot send ping packets between gNB and UE, because even if forcing the ping into one of both interfaces, the reply will not go through the OAI tunnel.

However, you can use the above method to use it on the same host. Again, start the gNB

sudo ./nr-softmodem -O ../../../ci-scripts/conf_files/gnb.band78.106prb.rfsim.phytest-dora.conf --do-ra --rfsim --noS1

Afterwards, create a namespace and execute bash inside, and start the UE:

sudo ./multi-ue.sh -c1 -e
sudo ./nr-uesoftmodem --do-ra --rfsim --noS1 --rfsimulator.serveraddr 10.201.1.100

After this, start iperf on gNB side:

iperf3 -si1 -B 10.0.1.1

and another iperf inside the namespace of the UE:

sudo ./multi-ue.sh -o1
iperf3 -B 10.0.1.2 -c 10.0.1.1 -t10 -i1

You should now have all traffic go through the NR tunnel.