free-ran-ue with Namespace
Note
Namespace provides an alternative to using a physical machine.
With namespaces, you can simulate isolated network environments on a single machine, making it possible to run both free5GC and free-ran-ue without the need for multiple physical devices.
For detailed namespace implementation, please refer to this implementation article: Namespace-Based GTP5G Conflict Resolution for free5GC and PacketRusher.
Architecture Overview
Since the network port and routing table will get in conflict, we can set up three namespaces for free5GC/RAN/UE, which means you don't need to bring up real machines.
Here is the deployment of these three namespaces:
A. Prerequisites
-
Golang
wget https://dl.google.com/go/go1.24.5.linux-amd64.tar.gz sudo tar -C /usr/local -zxvf go1.24.5.linux-amd64.tar.gz mkdir -p ~/go/{bin,pkg,src} # The following assume that your shell is bash: echo 'export GOPATH=$HOME/go' >> ~/.bashrc echo 'export GOROOT=/usr/local/go' >> ~/.bashrc echo 'export PATH=$PATH:$GOPATH/bin:$GOROOT/bin' >> ~/.bashrc echo 'export GO111MODULE=auto' >> ~/.bashrc source ~/.bashrc
-
gtp5g
-
MongoDB
sudo apt install -y gnupg curl curl -fsSL https://www.mongodb.org/static/pgp/server-7.0.asc | \ sudo gpg -o /usr/share/keyrings/mongodb-server-7.0.gpg --dearmor echo "deb [ arch=amd64,arm64 signed-by=/usr/share/keyrings/mongodb-server-7.0.gpg ] https://repo.mongodb.org/apt/ubuntu jammy/mongodb-org/7.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-7.0.list sudo apt update sudo apt install -y mongodb-org sudo systemctl enable mongod --now
B. Namespace Setup
-
Clone and build free-ran-ue
-
Bring up namespaces (under
free-ran-ue
)After using, there is
down
command to clean up the namespaces:
C. Configure free5GC
-
Clone free5GC and build
-
Modify NF configuration:
-
~/free5gc/config/amfcfg.yaml
Replace
ngapIpList
IP from127.0.0.18
to10.0.1.1
: -
~/free5gc/config/smfcfg.yaml
Replace N3 interface's endpoints IP from
127.0.0.8
to your10.0.1.1
: -
~/free5gc/config/upfcfg.yaml
Replace N6 interface address IP from
127.0.0.8
to10.0.1.1
:
-
-
Check IP Forward is enabled
If you have rebooted your machine, remember to run these command with setting your export network interface:
-
Run free5GC (under
free5gc
) -
Run webconsole and create a subscriber by default (under
free5gc
)For creating a subscriber, please refer to: Create Subscriber via Webconsole
D. Start gNB
The configuration file config/gnb.yaml
has already been set up with the environment values. No need to modify the configuration.
-
Enter the RAN-namespace (under
free-ran-ue
) -
Start gNB
E. Start UE
The configuration file config/ue.yaml
has already been set up with the environment values. No need to modify the configuration.
-
Enter the UE-namespace (under
free-ran-ue
) -
Start UE
F. ICMP Test
-
Enter the UE-namespace (under
free-ran-ue
) -
Check the
ueTun0
interfaceExpected output included:
ueTun0: flags=4305<UP,POINTOPOINT,RUNNING,NOARP,MULTICAST> mtu 1500 inet 10.60.0.1 netmask 255.255.255.255 destination 10.60.0.1 inet6 fe80::b1e9:2933:3c64:b981 prefixlen 64 scopeid 0x20<link> 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 3 bytes 144 (144.0 B) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
-
ping
testExpected successful output:
PING 8.8.8.8 (8.8.8.8) from 10.60.0.1 ueTun0: 56(84) bytes of data. 64 bytes from 8.8.8.8: icmp_seq=1 ttl=116 time=3.99 ms 64 bytes from 8.8.8.8: icmp_seq=2 ttl=116 time=3.90 ms 64 bytes from 8.8.8.8: icmp_seq=3 ttl=116 time=3.84 ms 64 bytes from 8.8.8.8: icmp_seq=4 ttl=116 time=4.07 ms 64 bytes from 8.8.8.8: icmp_seq=5 ttl=116 time=3.62 ms --- 8.8.8.8 ping statistics --- 5 packets transmitted, 5 received, 0% packet loss, time 4007ms rtt min/avg/max/mdev = 3.618/3.881/4.067/0.152 ms
Now, both gNB and UE are running successfully in the RAN-namespace and UE-namespace respectively.