Article directory
startup code
- Start the OAI core network
#开启数据转发
sudo sysctl net.ipv4.conf.all.forwarding=1
sudo iptables -P FORWARD ACCEPT
#启动核心网
lab@lab-virtual-machine:~/5gc-slicing-v1/Slice1$ docker-compose -f docker-compose-basic-vpp-nrf-slice1.yaml up -d
lab@lab-virtual-machine:~/5gc-slicing-v1/Slice2$ docker-compose -f docker-compose-basic-vpp-nrf-slice2.yaml up -d
lab@lab-virtual-machine:~/5gc-slicing-v1/Slice3$ docker-compose -f docker-compose-basic-vpp-nrf-slice3.yaml up -d
- Centralized deployment starts ueranism base station
#启动ueransim
lab@lab-virtual-machine:~/5gc-slicing-v1/Slice1/gnb-slice$ docker-compose -f ueransim-slice1.yaml up -d
lab@lab-virtual-machine:~/5gc-slicing-v1/Slice2/gnb-slice$ docker-compose -f ueransim-slice2.yaml up -d
lab@lab-virtual-machine:~/5gc-slicing-v1/Slice3/gnb-slice$ docker-compose -f ueransim-slice3.yaml up -d
- Discrete deployment starts ueransim base station
#依次添加路由
sudo ip route add 192.168.10.0/24 via 192.168.16.6 dev ens41
sudo ip route add 192.168.12.0/24 via 192.168.16.6 dev ens41
sudo ip route add 192.168.20.0/24 via 192.168.26.6 dev ens39
sudo ip route add 192.168.22.0/24 via 192.168.26.6 dev ens39
sudo ip route add 192.168.30.0/24 via 192.168.36.6 dev ens40
sudo ip route add 192.168.32.0/24 via 192.168.36.6 dev ens40
#启动ueransim
lab@lab-virtual-machine:~/5gc-slicing-v1/Slice1/gnb-slice$ docker-compose -f ueransim-slice1.yaml up -d
lab@lab-virtual-machine:~/5gc-slicing-v1/Slice2/gnb-slice$ docker-compose -f ueransim-slice2.yaml up -d
lab@lab-virtual-machine:~/5gc-slicing-v1/Slice3/gnb-slice$ docker-compose -f ueransim-slice3.yaml up -d
- information viewing
#查看全部容器
docker ps
#查看指定docker-compose启动对应容器
docker-compose -f docker-compose-basic-vpp-nrf-slice1.yaml ps -a
docker-compose -f docker-compose-basic-vpp-nrf-slice2.yaml ps -a
docker-compose -f docker-compose-basic-vpp-nrf-slice3.yaml ps -a
#查看ueransim日志接入信息 仅显示后10行
docker logs ueransim-slice1 2>&1 | tail -10
docker logs ueransim-slice2 2>&1 | tail -10
docker logs ueransim-slice3 2>&1 | tail -10
#查看ueransim日志接入信息 显示全部
docker logs ueransim-slice1
#查看核心网网元amf日志 仅显示后10行
docker logs oai-amf-slice1 2>&1 | tail -20
docker logs oai-amf-slice2 2>&1 | tail -20
docker logs oai-amf-slice3 2>&1 | tail -20
Deploy the whole process
First of all, we need server A and host B. The two machines have three interconnected network cables for the communication of the three slices respectively. The two machines should be configured with as much RAM (greater than 12GB) and CPU (core * thread not less than 16) .
Network Configuration
Configure static IP
A two-machine network needs to be configured, and three network segments are used for three slices respectively.
- Server A
在这里插入代码片
- Host B
network:
version: 2
renderer: NetworkManager
ethernets:
ens39:
addresses: [192.168.16.66/24]
dhcp4: no
gateway4: 192.168.16.1
nameservers:
addresses: [8.8.8.8,144.144.144.144,255.255.255.255]
ens41:
addresses: [192.168.26.66/24]
dhcp4: no
gateway4: 192.168.26.1
nameservers:
addresses: [8.8.8.8,144.144.144.144,255.255.255.255]
ens40:
addresses: [192.168.36.66/24]
dhcp4: no
gateway4: 192.168.36.1
nameservers:
addresses: [8.8.8.8,144.144.144.144,255.255.255.255]
After configuration, ping to test
- on host B
lab@lab-virtual-machine:/$ ping 192.168.16.6
PING 192.168.16.6 (192.168.16.6) 56(84) bytes of data.
64 bytes from 192.168.16.6: icmp_seq=1 ttl=64 time=2.69 ms
^C
--- 192.168.16.6 ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 2.696/2.696/2.696/0.000 ms
lab@lab-virtual-machine:/$ ping 192.168.26.6
PING 192.168.26.6 (192.168.26.6) 56(84) bytes of data.
64 bytes from 192.168.26.6: icmp_seq=1 ttl=64 time=3.07 ms
^C
--- 192.168.26.6 ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 3.077/3.077/3.077/0.000 ms
lab@lab-virtual-machine:/$ ping 192.168.36.6
PING 192.168.36.6 (192.168.36.6) 56(84) bytes of data.
64 bytes from 192.168.36.6: icmp_seq=1 ttl=64 time=0.858 ms
^C
--- 192.168.36.6 ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 0.858/0.858/0.858/0.000 ms
Deploy the core network
- Enable data forwarding
sudo sysctl net.ipv4.conf.all.forwarding=1
sudo iptables -P FORWARD ACCEPT
- Deploy core network 1
lab@lab-virtual-machine:~/oai-cn5g-fed/5gc-slicing-v1/Slice1$ docker-compose -f docker-compose-basic-vpp-nrf-slice1.yml up -d
Creating network "demo-oai-public-net-slice1" with driver "bridge"
Creating network "oai-public-access-slice1" with the default driver
Creating network "oai-public-core-slice1" with the default driver
Creating oai-nrf-slice1 ... done
Creating mysql-slice1 ... done
Creating oai-ext-dn-slice1 ... done
Creating vpp-upf-slice1 ... done
Creating oai-udr-slice1 ... done
Creating oai-udm-slice1 ... done
Creating oai-ausf-slice1 ... done
Creating oai-amf-slice1 ... done
Creating oai-smf-slice1 ... done
- Deploy core network 2
lab@lab-virtual-machine:~/oai-cn5g-fed/5gc-slicing-v1/Slice2$ docker-compose -f docker-compose-basic-vpp-nrf-slice2.yaml up -d
Creating network "demo-oai-public-net-slice2" with driver "bridge"
Creating network "oai-public-access-slice2" with the default driver
Creating network "oai-public-core-slice2" with the default driver
Creating mysql-slice2 ... done
Creating oai-ext-dn-slice2 ... done
Creating oai-nrf-slice2 ... done
Creating oai-udr-slice2 ... done
Creating vpp-upf-slice2 ... done
Creating oai-udm-slice2 ... done
Creating oai-ausf-slice2 ... done
Creating oai-amf-slice2 ... done
Creating oai-smf-slice2 ... done
- Deploy the core network 3
lab@lab-virtual-machine:~/oai-cn5g-fed/5gc-slicing-v1/Slice3$ docker-compose -f docker-compose-basic-vpp-nrf-slice3.yaml up -d
Creating network "demo-oai-public-net-slice3" with driver "bridge"
Creating network "oai-public-access-slice3" with the default driver
Creating network "oai-public-core-slice3" with the default driver
Creating mysql-slice3 ... done
Creating oai-ext-dn-slice3 ... done
Creating oai-nrf-slice3 ... done
Creating vpp-upf-slice3 ... done
Creating oai-udr-slice3 ... done
Creating oai-udm-slice3 ... done
Creating oai-ausf-slice3 ... done
Creating oai-amf-slice3 ... done
Creating oai-smf-slice3 ... done
- View container running health status
lab@lab-virtual-machine:~/oai-cn5g-fed/5gc-slicing-v1/Slice3$ docker ps
WARNING: Error loading config file: /home/lab/.docker/config.json: open /home/lab/.docker/config.json: permission denied
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
2416217e8828 oaisoftwarealliance/oai-smf:v1.5.0 "python3 /openair-sm…" 2 hours ago Up 2 hours (healthy) 80/tcp, 8080/tcp, 8805/udp oai-smf-slice3
3af71b6090fc oaisoftwarealliance/oai-amf:v1.5.0 "python3 /openair-am…" 2 hours ago Up 2 hours (healthy) 80/tcp, 9090/tcp, 38412/sctp oai-amf-slice3
b9043ebb3d65 oaisoftwarealliance/oai-ausf:v1.5.0 "python3 /openair-au…" 2 hours ago Up 2 hours (healthy) 80/tcp oai-ausf-slice3
4f303272e239 oaisoftwarealliance/oai-udm:v1.5.0 "python3 /openair-ud…" 2 hours ago Up 2 hours (healthy) 80/tcp oai-udm-slice3
a62d8727acac oaisoftwarealliance/oai-upf-vpp:v1.5.0 "/openair-upf/bin/en…" 2 hours ago Up 2 hours (healthy) 2152/udp, 8085/udp vpp-upf-slice3
c0ef896af335 oaisoftwarealliance/oai-udr:v1.5.0 "python3 /openair-ud…" 2 hours ago Up 2 hours (healthy) 80/tcp oai-udr-slice3
daceb5ae81e4 oaisoftwarealliance/trf-gen-cn5g:latest "/bin/bash -c ' ipta…" 2 hours ago Up 2 hours (unhealthy) oai-ext-dn-slice3
cbfcc6385cc6 oaisoftwarealliance/oai-nrf:v1.5.0 "python3 /openair-nr…" 2 hours ago Up 2 hours (healthy) 80/tcp, 9090/tcp oai-nrf-slice3
0f0f4351db76 mysql:8.0 "docker-entrypoint.s…" 2 hours ago Up 2 hours (healthy) 3306/tcp, 33060/tcp mysql-slice3
c1a3ca606b80 oaisoftwarealliance/oai-smf:v1.5.0 "python3 /openair-sm…" 2 hours ago Up 2 hours (healthy) 80/tcp, 8080/tcp, 8805/udp oai-smf-slice2
8ca8d2d2cfa8 oaisoftwarealliance/oai-amf:v1.5.0 "python3 /openair-am…" 2 hours ago Up 2 hours (healthy) 80/tcp, 9090/tcp, 38412/sctp oai-amf-slice2
687c77bc6103 oaisoftwarealliance/oai-ausf:v1.5.0 "python3 /openair-au…" 2 hours ago Up 2 hours (healthy) 80/tcp oai-ausf-slice2
a58f9d114ea5 oaisoftwarealliance/oai-udm:v1.5.0 "python3 /openair-ud…" 2 hours ago Up 2 hours (healthy) 80/tcp oai-udm-slice2
d810ee1b0f45 oaisoftwarealliance/oai-upf-vpp:v1.5.0 "/openair-upf/bin/en…" 2 hours ago Up 2 hours (healthy) 2152/udp, 8085/udp vpp-upf-slice2
692c9157f4fc oaisoftwarealliance/oai-udr:v1.5.0 "python3 /openair-ud…" 2 hours ago Up 2 hours (healthy) 80/tcp oai-udr-slice2
10d432d29973 oaisoftwarealliance/trf-gen-cn5g:latest "/bin/bash -c ' ipta…" 2 hours ago Up 2 hours (unhealthy) oai-ext-dn-slice2
d34b0df56ac1 mysql:8.0 "docker-entrypoint.s…" 2 hours ago Up 2 hours (healthy) 3306/tcp, 33060/tcp mysql-slice2
13a8e6724d4b oaisoftwarealliance/oai-nrf:v1.5.0 "python3 /openair-nr…" 2 hours ago Up 2 hours (healthy) 80/tcp, 9090/tcp oai-nrf-slice2
438fe8754cac oaisoftwarealliance/oai-smf:v1.5.0 "python3 /openair-sm…" 2 hours ago Up 2 hours (healthy) 80/tcp, 8080/tcp, 8805/udp oai-smf-slice1
3ac2880593bf oaisoftwarealliance/oai-amf:v1.5.0 "python3 /openair-am…" 2 hours ago Up 2 hours (healthy) 80/tcp, 9090/tcp, 38412/sctp oai-amf-slice1
2a44d8f8bb28 oaisoftwarealliance/oai-ausf:v1.5.0 "python3 /openair-au…" 2 hours ago Up 2 hours (healthy) 80/tcp oai-ausf-slice1
647f75191241 oaisoftwarealliance/oai-udm:v1.5.0 "python3 /openair-ud…" 2 hours ago Up 2 hours (healthy) 80/tcp oai-udm-slice1
7857b089316b oaisoftwarealliance/oai-udr:v1.5.0 "python3 /openair-ud…" 2 hours ago Up 2 hours (healthy) 80/tcp oai-udr-slice1
dd3081176d02 oaisoftwarealliance/oai-upf-vpp:v1.5.0 "/openair-upf/bin/en…" 2 hours ago Up 2 hours (healthy) 2152/udp, 8085/udp vpp-upf-slice1
2ca1dc7042ed mysql:8.0 "docker-entrypoint.s…" 2 hours ago Up 2 hours (healthy) 3306/tcp, 33060/tcp mysql-slice1
2194f145d27c oaisoftwarealliance/oai-nrf:v1.5.0 "python3 /openair-nr…" 2 hours ago Up 2 hours (healthy) 80/tcp, 9090/tcp oai-nrf-slice1
a0be657d37e0 oaisoftwarealliance/trf-gen-cn5g:latest "/bin/bash -c ' ipta…" 2 hours ago Up 2 hours (unhealthy) oai-ext-dn-slice1
Deploy the base station
Deploy base station 1
- add route
lab@lab-virtual-machine:~/5gc-slicing-v1/Slice1$ sudo ip route add 192.168.10.0/24 via 192.168.16.6 dev ens39
lab@lab-virtual-machine:~/5gc-slicing-v1/Slice1$ sudo ip route add 192.168.12.0/24 via 192.168.16.6 dev ens39
- Test whether the communication with the core network segment and the amf network element is successful
lab@lab-virtual-machine:~/5gc-slicing-v1/Slice1$ ping 192.168.10.1
PING 192.168.10.1 (192.168.10.1) 56(84) bytes of data.
64 bytes from 192.168.10.1: icmp_seq=1 ttl=64 time=2.58 ms
^C
--- 192.168.10.1 ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 2.581/2.581/2.581/0.000 ms
lab@lab-virtual-machine:~/5gc-slicing-v1/Slice1$ ping 192.168.10.132
PING 192.168.10.132 (192.168.10.132) 56(84) bytes of data.
64 bytes from 192.168.10.132: icmp_seq=1 ttl=63 time=2.70 ms
^C
--- 192.168.10.132 ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 2.704/2.704/2.704/0.000 ms
- deploy ueransim-slice1
lab@lab-virtual-machine:~/5gc-slicing-v1/Slice1/gnb-slice$ docker-compose -f ueransim-slice1.yaml up -d
WARNING: Found orphan containers (ueransim1) for this project. If you removed or renamed this service in your compose file, you can run this command with the --remove-orphans flag to clean it up.
Creating ueransim-slice1 ... done
- View ueransim-slice1 container status
lab@lab-virtual-machine:~/5gc-slicing-v1/Slice1/gnb-slice$ docker ps
WARNING: Error loading config file: /home/lab/.docker/config.json: open /home/lab/.docker/config.json: permission denied
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
f540b53ad748 ueransim:latest "/ueransim/bin/entry…" 17 seconds ago Up 16 seconds (healthy) ueransim-slice1
- View ueransim-slice1 log
lab@lab-virtual-machine:~/5gc-slicing-v1/Slice1/gnb-slice$ docker logs ueransim-slice1 2>&1 | tail -10
[2023-05-13 03:09:41.188] [nas] [debug] Registration accept received
[2023-05-13 03:09:41.188] [nas] [info] UE switches to state [MM-REGISTERED/NORMAL-SERVICE]
[2023-05-13 03:09:41.188] [nas] [debug] Sending Registration Complete
[2023-05-13 03:09:41.188] [nas] [info] Initial Registration is successful
[2023-05-13 03:09:41.188] [nas] [debug] Sending PDU Session Establishment Request
[2023-05-13 03:09:41.188] [nas] [debug] UAC access attempt is allowed for identity[0], category[MO_sig]
[2023-05-13 03:09:41.410] [ngap] [info] PDU session resource(s) setup for UE[1] count[1]
[2023-05-13 03:09:41.411] [nas] [debug] PDU Session Establishment Accept received
[2023-05-13 03:09:41.411] [nas] [info] PDU Session establishment is successful PSI[1]
[2023-05-13 03:09:41.430] [app] [info] Connection setup for PDU session[1] is successful, TUN interface[uesimtun0, 12.1.1.2] is up.
Deploy base station 2
- add route
lab@lab-virtual-machine:~/5gc-slicing-v1/Slice2$ sudo ip route add 192.168.20.0/24 via 192.168.26.6 dev ens41
[sudo] password for lab:
lab@lab-virtual-machine:~/5gc-slicing-v1/Slice2$ sudo ip route add 192.168.22.0/24 via 192.168.26.6 dev ens41
- Test whether the communication with the core network segment and the amf network element is successful
lab@lab-virtual-machine:~/5gc-slicing-v1/Slice2$ ping 192.168.20.1
PING 192.168.20.1 (192.168.20.1) 56(84) bytes of data.
64 bytes from 192.168.20.1: icmp_seq=1 ttl=64 time=2.86 ms
^C
--- 192.168.20.1 ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 2.867/2.867/2.867/0.000 ms
lab@lab-virtual-machine:~/5gc-slicing-v1/Slice2$ ping 192.168.20.132
PING 192.168.20.132 (192.168.20.132) 56(84) bytes of data.
64 bytes from 192.168.20.132: icmp_seq=1 ttl=63 time=2.98 ms
^C
--- 192.168.20.132 ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 2.987/2.987/2.987/0.000 ms
- Deploy ueransim-slice2
lab@lab-virtual-machine:~/5gc-slicing-v1/Slice2/gnb-slice$ docker-compose -f ueransim-slice2.yaml up -d
WARNING: Found orphan containers (ueransim-slice1, ueransim1) for this project. If you removed or renamed this service in your compose file, you can run this command with the --remove-orphans flag to clean it up.
Creating ueransim-slice2 ... done
- View ueransim-slice2 container status
lab@lab-virtual-machine:~/5gc-slicing-v1/Slice2/gnb-slice$ docker-compose -f ueransim-slice2.yaml ps
Name Command State Ports
--------------------------------------------------------------------
ueransim-slice2 /ueransim/bin/entrypoint.sh Up (healthy)
- View ueransim-slice2 log
Deploy base station 3
- add route
lab@lab-virtual-machine:~/5gc-slicing-v1/Slice3$ sudo ip route add 192.168.30.0/24 via 192.168.36.6 dev ens40
[sudo] password for lab:
lab@lab-virtual-machine:~/5gc-slicing-v1/Slice3$ sudo ip route add 192.168.32.0/24 via 192.168.36.6 dev ens40
- Test whether the communication with the core network segment and the amf network element is successful
lab@lab-virtual-machine:~/5gc-slicing-v1/Slice3$ ping 192.168.30.1
PING 192.168.30.1 (192.168.30.1) 56(84) bytes of data.
64 bytes from 192.168.30.1: icmp_seq=1 ttl=64 time=1.69 ms
^C
--- 192.168.30.1 ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 1.699/1.699/1.699/0.000 ms
lab@lab-virtual-machine:~/5gc-slicing-v1/Slice3$ ping 192.168.30.132
PING 192.168.30.132 (192.168.30.132) 56(84) bytes of data.
64 bytes from 192.168.30.132: icmp_seq=1 ttl=63 time=0.934 ms
^C
--- 192.168.30.132 ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 0.934/0.934/0.934/0.000 ms
- Deploy ueransim-slice3
lab@lab-virtual-machine:~/5gc-slicing-v1/Slice3/gnb-slice$ docker-compose -f ueransim-slice3.yaml up -d
WARNING: Found orphan containers (ueransim-slice1, ueransim-slice2, ueransim1) for this project. If you removed or renamed this service in your compose file, you can run this command with the --remove-orphans flag to clean it up.
Creating ueransim-slice3 ... done
- View ueransim-slice2 container status
lab@lab-virtual-machine:~/5gc-slicing-v1/Slice3/gnb-slice$ docker-compose -f ueransim-slice3.yaml ps
Name Command State Ports
--------------------------------------------------------------------
ueransim-slice3 /ueransim/bin/entrypoint.sh Up (healthy)
- View ueransim-slice2 log
view amf log
lab@lab-virtual-machine:~/oai-cn5g-fed/5gc-slicing-v1/Slice3$ docker logs oai-amf-slice1 2>&1 | tail -10
[2023-05-13T07:24:13.345119] [AMF] [amf_app] [info ] | Index | Status | Global ID | gNB Name | PLMN |
[2023-05-13T07:24:13.345128] [AMF] [amf_app] [info ] | 1 | Connected | 0x1 | UERANSIM-gnb-208-95-1 | 208, 95 |
[2023-05-13T07:24:13.345132] [AMF] [amf_app] [info ] |----------------------------------------------------------------------------------------------------------------|
[2023-05-13T07:24:13.345135] [AMF] [amf_app] [info ]
[2023-05-13T07:24:13.345138] [AMF] [amf_app] [info ] |----------------------------------------------------------------------------------------------------------------|
[2023-05-13T07:24:13.345141] [AMF] [amf_app] [info ] |----------------------------------------------------UEs' information--------------------------------------------|
[2023-05-13T07:24:13.345144] [AMF] [amf_app] [info ] | Index | 5GMM state | IMSI | GUTI | RAN UE NGAP ID | AMF UE ID | PLMN |Cell ID|
[2023-05-13T07:24:13.345154] [AMF] [amf_app] [info ] | 1| 5GMM-REGISTERED| 208950000000031| | 1| 1| 208, 95 | 256|
[2023-05-13T07:24:13.345157] [AMF] [amf_app] [info ] |----------------------------------------------------------------------------------------------------------------|
[2023-05-13T07:24:13.345160] [AMF] [amf_app] [info ]
question
The second base station cannot be connected, there is a problem with the generation of the TUN interface, and the access of the base station and users can be seen on the core network
is allowed for identity[0], category[MO_sig]
ueransim-slice2 | [2023-05-13 08:21:40.652] [ngap] [info] PDU session resource(s) setup for UE[1] count[1]
ueransim-slice2 | [2023-05-13 08:21:40.653] [nas] [debug] PDU Session Establishment Accept received
ueransim-slice2 | [2023-05-13 08:21:40.653] [nas] [info] PDU Session establishment is successful PSI[1]
ueransim-slice2 | RTNETLINK answers: File exists
ueransim-slice2 | [2023-05-13 08:21:40.677] [app] [error] TUN configuration failure [Command execution failed. The command was: ip route add default dev uesimtun1 table rt_uesimtun1. The output is: 'Command execution failure]
S
I guess the reason for the problem is that there is a conflict when the network interface is generated. There is no problem with centralized deployment because the host is not used, and the internal network of the container does not interfere with each other. When generating uesimtun, the newly generated interface is the same as the first generated interface. There is a conflict.
Ueransim uses
https://github.com/aligungr/UERANSIM/issues/402
. It should be that a default route will be added when the uesimtun interface is generated, and there is a conflict between this default route and the previously added route.
uesimtun0: flags=369<UP,POINTOPOINT,NOTRAILERS,RUNNING,PROMISC> mtu 1400
inet 12.1.1.2 netmask 255.255.255.255 destination 12.1.1.2
inet6 fe80::a207:9689:3a4e:1f27 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 12 bytes 688 (688.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
uesimtun1: flags=369<UP,POINTOPOINT,NOTRAILERS,RUNNING,PROMISC> mtu 1400
inet 12.1.1.14 netmask 255.255.255.255 destination 12.1.1.14
inet6 fe80::1f8a:cd75:c43e:bfef 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 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
uesimtun2: flags=369<UP,POINTOPOINT,NOTRAILERS,RUNNING,PROMISC> mtu 1400
inet 12.1.1.6 netmask 255.255.255.255 destination 12.1.1.6
inet6 fe80::52a0:6b1f:4656:b89f 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 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
Routing-config problem
- Start ue without routing rules
docker exec -it ueransim-slice1 /bin/bash
root@lab-virtual-machine:/ueransim/bin# /ueransim/bin/nr-ue --no-routing-config -c /ueransim/etc/custom-ue.yaml
Comparison without adding routing-config and adding
root@lab-virtual-machine:/ueransim/bin# /ueransim/bin/nr-ue -c /ueransim/etc/custom-ue.yaml
UERANSIM v3.2.5
[2023-05-13 12:02:03.052] [nas] [info] UE switches to state [MM-DEREGISTERED/PLMN-SEARCH]
[2023-05-13 12:02:03.052] [rrc] [debug] New signal detected for cell[1], total [1] cells in coverage
[2023-05-13 12:02:03.053] [nas] [info] Selected plmn[208/95]
[2023-05-13 12:02:03.053] [rrc] [info] Selected cell plmn[208/95] tac[40960] category[SUITABLE]
[2023-05-13 12:02:03.053] [nas] [info] UE switches to state [MM-DEREGISTERED/PS]
[2023-05-13 12:02:03.053] [nas] [info] UE switches to state [MM-DEREGISTERED/NORMAL-SERVICE]
[2023-05-13 12:02:03.053] [nas] [debug] Initial registration required due to [MM-DEREG-NORMAL-SERVICE]
[2023-05-13 12:02:03.053] [nas] [debug] UAC access attempt is allowed for identity[0], category[MO_sig]
[2023-05-13 12:02:03.053] [nas] [debug] Sending Initial Registration
[2023-05-13 12:02:03.053] [nas] [info] UE switches to state [MM-REGISTER-INITIATED]
[2023-05-13 12:02:03.053] [rrc] [debug] Sending RRC Setup Request
[2023-05-13 12:02:03.055] [rrc] [info] RRC connection established
[2023-05-13 12:02:03.055] [rrc] [info] UE switches to state [RRC-CONNECTED]
[2023-05-13 12:02:03.055] [nas] [info] UE switches to state [CM-CONNECTED]
[2023-05-13 12:02:03.080] [nas] [debug] Authentication Request received
[2023-05-13 12:02:03.100] [nas] [debug] Security Mode Command received
[2023-05-13 12:02:03.100] [nas] [debug] Selected integrity[1] ciphering[1]
[2023-05-13 12:02:03.111] [nas] [debug] Registration accept received
[2023-05-13 12:02:03.111] [nas] [info] UE switches to state [MM-REGISTERED/NORMAL-SERVICE]
[2023-05-13 12:02:03.111] [nas] [debug] Sending Registration Complete
[2023-05-13 12:02:03.112] [nas] [info] Initial Registration is successful
[2023-05-13 12:02:03.112] [nas] [debug] Sending PDU Session Establishment Request
[2023-05-13 12:02:03.112] [nas] [debug] UAC access attempt is allowed for identity[0], category[MO_sig]
root@lab-virtual-machine:/ueransim/bin# /ueransim/bin/nr-ue --no-routing-config -c /ueransim/etc/custom-ue.yaml
UERANSIM v3.2.5
[2023-05-13 12:02:13.339] [nas] [info] UE switches to state [MM-DEREGISTERED/PLMN-SEARCH]
[2023-05-13 12:02:13.340] [rrc] [debug] New signal detected for cell[1], total [1] cells in coverage
[2023-05-13 12:02:13.341] [nas] [info] Selected plmn[208/95]
[2023-05-13 12:02:13.341] [rrc] [info] Selected cell plmn[208/95] tac[40960] category[SUITABLE]
[2023-05-13 12:02:13.341] [nas] [info] UE switches to state [MM-DEREGISTERED/PS]
[2023-05-13 12:02:13.341] [nas] [info] UE switches to state [MM-DEREGISTERED/NORMAL-SERVICE]
[2023-05-13 12:02:13.341] [nas] [debug] Initial registration required due to [MM-DEREG-NORMAL-SERVICE]
[2023-05-13 12:02:13.341] [nas] [debug] UAC access attempt is allowed for identity[0], category[MO_sig]
[2023-05-13 12:02:13.341] [nas] [debug] Sending Initial Registration
[2023-05-13 12:02:13.341] [nas] [info] UE switches to state [MM-REGISTER-INITIATED]
[2023-05-13 12:02:13.341] [rrc] [debug] Sending RRC Setup Request
[2023-05-13 12:02:13.342] [rrc] [info] RRC connection established
[2023-05-13 12:02:13.342] [rrc] [info] UE switches to state [RRC-CONNECTED]
[2023-05-13 12:02:13.342] [nas] [info] UE switches to state [CM-CONNECTED]
[2023-05-13 12:02:13.367] [nas] [debug] Authentication Request received
[2023-05-13 12:02:13.387] [nas] [debug] Security Mode Command received
[2023-05-13 12:02:13.388] [nas] [debug] Selected integrity[1] ciphering[1]
[2023-05-13 12:02:13.398] [nas] [debug] Registration accept received
[2023-05-13 12:02:13.398] [nas] [info] UE switches to state [MM-REGISTERED/NORMAL-SERVICE]
[2023-05-13 12:02:13.398] [nas] [debug] Sending Registration Complete
[2023-05-13 12:02:13.398] [nas] [info] Initial Registration is successful
[2023-05-13 12:02:13.398] [nas] [debug] Sending PDU Session Establishment Request
[2023-05-13 12:02:13.398] [nas] [debug] UAC access attempt is allowed for identity[0], category[MO_sig]
[2023-05-13 12:02:13.633] [nas] [debug] PDU Session Establishment Accept received
[2023-05-13 12:02:13.633] [nas] [info] PDU Session establishment is successful PSI[1]
[2023-05-13 12:02:13.635] [app] [info] Connection setup for PDU session[1] is successful, TUN interface[uesimtun2, 12.1.1.3] is up.
It can be seen that without adding --no-routing-config, tun cannot be generated manually by using routing rules, but adding --no-routing-config can be successfully generated. It is necessary to test the function of generating the
tun interface in this way
investigation
Add routing distinction configuration to ueransim configuration file
https://github.com/aligungr/UERANSIM/pull/611
https://github.com/aligungr/UERANSIM/pull/611/commits/fd565dbac77d4501e0a0de1d4e072e2efcd168a4
routingIndicator=0000
Useless after modification
ueransim only guarantees the generation of tun, and does not guarantee that the routing
https://github.com/aligungr/UERANSIM/issues/425
will have a similar error answer
https://github.com/aligungr/UERANSIM/issues/257
nr-binder function test
base station 1
lab@lab-virtual-machine:~/5gc-slicing-v1/Slice1/gnb-slice$ docker-compose -f ueransim-slice1.yaml up
WARNING: Found orphan containers (ueransim-slice2, ueransim1) for this project. If you removed or renamed this service in your compose file, you can run this command with the --remove-orphans flag to clean it up.
Recreating ueransim-slice1 ... done
Attaching to ueransim-slice1
ueransim-slice1 | Now setting these variables '@GTP_IP@ @IGNORE_STREAM_IDS@ @LINK_IP@ @MCC@ @MNC@ @NCI@ @NGAP_IP@ @NGAP_PEER_IP@ @SD_0@ @SD_1@ @SD_2@ @SST_0@ @SST_1@ @SST_2@ @TAC@'
ueransim-slice1 | Now setting these variables '@AMF_VALUE@ @APN@ @GNB_IP_ADDRESS@ @IMEI@ @IMEI_SV@ @IMSI@ @KEY@ @MCC@ @MNC@ @OP@ @OP_TYPE@ @PDU_TYPE@ @SD_C@ @SD_D@ @SD_R@ @SST_C@ @SST_D@ @SST_R@'
ueransim-slice1 | Done setting the configuration
ueransim-slice1 | ### Running ueransim ###
ueransim-slice1 | Running gnb
ueransim-slice1 | UERANSIM v3.2.5
ueransim-slice1 | [2023-05-13 11:37:47.954] [sctp] [info] Trying to establish SCTP connection... (192.168.10.132:38412)
ueransim-slice1 | [2023-05-13 11:37:47.962] [sctp] [info] SCTP connection established (192.168.10.132:38412)
ueransim-slice1 | [2023-05-13 11:37:47.962] [sctp] [debug] SCTP association setup ascId[35]
ueransim-slice1 | [2023-05-13 11:37:47.962] [ngap] [debug] Sending NG Setup Request
ueransim-slice1 | [2023-05-13 11:37:47.967] [ngap] [debug] NG Setup Response received
ueransim-slice1 | [2023-05-13 11:37:47.967] [ngap] [info] NG Setup procedure is successful
ueransim-slice1 | Running ue
ueransim-slice1 | UERANSIM v3.2.5
ueransim-slice1 | [2023-05-13 11:37:48.954] [nas] [info] UE switches to state [MM-DEREGISTERED/PLMN-SEARCH]
ueransim-slice1 | [2023-05-13 11:37:48.954] [rrc] [debug] UE[1] new signal detected
ueransim-slice1 | [2023-05-13 11:37:48.955] [rrc] [debug] New signal detected for cell[1], total [1] cells in coverage
ueransim-slice1 | [2023-05-13 11:37:48.955] [nas] [info] Selected plmn[208/95]
ueransim-slice1 | [2023-05-13 11:37:48.955] [rrc] [info] Selected cell plmn[208/95] tac[40960] category[SUITABLE]
ueransim-slice1 | [2023-05-13 11:37:48.955] [nas] [info] UE switches to state [MM-DEREGISTERED/PS]
ueransim-slice1 | [2023-05-13 11:37:48.955] [nas] [info] UE switches to state [MM-DEREGISTERED/NORMAL-SERVICE]
ueransim-slice1 | [2023-05-13 11:37:48.955] [nas] [debug] Initial registration required due to [MM-DEREG-NORMAL-SERVICE]
ueransim-slice1 | [2023-05-13 11:37:48.955] [nas] [debug] UAC access attempt is allowed for identity[0], category[MO_sig]
ueransim-slice1 | [2023-05-13 11:37:48.955] [nas] [debug] Sending Initial Registration
ueransim-slice1 | [2023-05-13 11:37:48.955] [nas] [info] UE switches to state [MM-REGISTER-INITIATED]
ueransim-slice1 | [2023-05-13 11:37:48.956] [rrc] [debug] Sending RRC Setup Request
ueransim-slice1 | [2023-05-13 11:37:48.956] [rrc] [info] RRC Setup for UE[1]
ueransim-slice1 | [2023-05-13 11:37:48.957] [rrc] [info] RRC connection established
ueransim-slice1 | [2023-05-13 11:37:48.957] [rrc] [info] UE switches to state [RRC-CONNECTED]
ueransim-slice1 | [2023-05-13 11:37:48.957] [nas] [info] UE switches to state [CM-CONNECTED]
ueransim-slice1 | [2023-05-13 11:37:48.957] [ngap] [debug] Initial NAS message received from UE[1]
ueransim-slice1 | [2023-05-13 11:37:48.995] [nas] [debug] Authentication Request received
ueransim-slice1 | [2023-05-13 11:37:49.018] [nas] [debug] Security Mode Command received
ueransim-slice1 | [2023-05-13 11:37:49.018] [nas] [debug] Selected integrity[1] ciphering[1]
ueransim-slice1 | [2023-05-13 11:37:49.028] [ngap] [debug] Initial Context Setup Request received
ueransim-slice1 | [2023-05-13 11:37:49.029] [nas] [debug] Registration accept received
ueransim-slice1 | [2023-05-13 11:37:49.029] [nas] [info] UE switches to state [MM-REGISTERED/NORMAL-SERVICE]
ueransim-slice1 | [2023-05-13 11:37:49.029] [nas] [debug] Sending Registration Complete
ueransim-slice1 | [2023-05-13 11:37:49.029] [nas] [info] Initial Registration is successful
ueransim-slice1 | [2023-05-13 11:37:49.029] [nas] [debug] Sending PDU Session Establishment Request
ueransim-slice1 | [2023-05-13 11:37:49.029] [nas] [debug] UAC access attempt is allowed for identity[0], category[MO_sig]
ueransim-slice1 | [2023-05-13 11:37:49.266] [ngap] [info] PDU session resource(s) setup for UE[1] count[1]
ueransim-slice1 | [2023-05-13 11:37:49.266] [nas] [debug] PDU Session Establishment Accept received
ueransim-slice1 | [2023-05-13 11:37:49.266] [nas] [info] PDU Session establishment is successful PSI[1]
ueransim-slice1 | [2023-05-13 11:37:49.290] [app] [info] Connection setup for PDU session[1] is successful, TUN interface[uesimtun0, 12.1.1.2] is up.
base station 2
lab@lab-virtual-machine:~/5gc-slicing-v1/Slice2/gnb-slice$ docker-compose -f ueransim-slice2.yaml up
WARNING: Found orphan containers (ueransim-slice1, ueransim1) for this project. If you removed or renamed this service in your compose file, you can run this command with the --remove-orphans flag to clean it up.
Recreating ueransim-slice2 ... done
Attaching to ueransim-slice2
ueransim-slice2 | Now setting these variables '@GTP_IP@ @IGNORE_STREAM_IDS@ @LINK_IP@ @MCC@ @MNC@ @NCI@ @NGAP_IP@ @NGAP_PEER_IP@ @SD_0@ @SD_1@ @SD_2@ @SST_0@ @SST_1@ @SST_2@ @TAC@'
ueransim-slice2 | Now setting these variables '@AMF_VALUE@ @APN@ @GNB_IP_ADDRESS@ @IMEI@ @IMEI_SV@ @IMSI@ @KEY@ @MCC@ @MNC@ @OP@ @OP_TYPE@ @PDU_TYPE@ @SD_C@ @SD_D@ @SD_R@ @SST_C@ @SST_D@ @SST_R@'
ueransim-slice2 | Done setting the configuration
ueransim-slice2 | ### Running ueransim ###
ueransim-slice2 | Running gnb
ueransim-slice2 | UERANSIM v3.2.5
ueransim-slice2 | [2023-05-13 11:38:04.364] [sctp] [info] Trying to establish SCTP connection... (192.168.20.132:38412)
ueransim-slice2 | [2023-05-13 11:38:04.374] [sctp] [info] SCTP connection established (192.168.20.132:38412)
ueransim-slice2 | [2023-05-13 11:38:04.374] [sctp] [debug] SCTP association setup ascId[36]
ueransim-slice2 | [2023-05-13 11:38:04.375] [ngap] [debug] Sending NG Setup Request
ueransim-slice2 | [2023-05-13 11:38:04.381] [ngap] [debug] NG Setup Response received
ueransim-slice2 | [2023-05-13 11:38:04.381] [ngap] [info] NG Setup procedure is successful
ueransim-slice2 | Running ue
ueransim-slice2 | UERANSIM v3.2.5
ueransim-slice2 | [2023-05-13 11:38:05.365] [nas] [info] UE switches to state [MM-DEREGISTERED/PLMN-SEARCH]
ueransim-slice2 | [2023-05-13 11:38:05.366] [rrc] [debug] UE[1] new signal detected
ueransim-slice2 | [2023-05-13 11:38:05.366] [rrc] [debug] New signal detected for cell[1], total [1] cells in coverage
ueransim-slice2 | [2023-05-13 11:38:05.367] [nas] [info] Selected plmn[208/95]
ueransim-slice2 | [2023-05-13 11:38:05.367] [rrc] [info] Selected cell plmn[208/95] tac[40960] category[SUITABLE]
ueransim-slice2 | [2023-05-13 11:38:05.367] [nas] [info] UE switches to state [MM-DEREGISTERED/PS]
ueransim-slice2 | [2023-05-13 11:38:05.367] [nas] [info] UE switches to state [MM-DEREGISTERED/NORMAL-SERVICE]
ueransim-slice2 | [2023-05-13 11:38:05.367] [nas] [debug] Initial registration required due to [MM-DEREG-NORMAL-SERVICE]
ueransim-slice2 | [2023-05-13 11:38:05.367] [nas] [debug] UAC access attempt is allowed for identity[0], category[MO_sig]
ueransim-slice2 | [2023-05-13 11:38:05.367] [nas] [debug] Sending Initial Registration
ueransim-slice2 | [2023-05-13 11:38:05.367] [nas] [info] UE switches to state [MM-REGISTER-INITIATED]
ueransim-slice2 | [2023-05-13 11:38:05.367] [rrc] [debug] Sending RRC Setup Request
ueransim-slice2 | [2023-05-13 11:38:05.368] [rrc] [info] RRC Setup for UE[1]
ueransim-slice2 | [2023-05-13 11:38:05.368] [rrc] [info] RRC connection established
ueransim-slice2 | [2023-05-13 11:38:05.368] [rrc] [info] UE switches to state [RRC-CONNECTED]
ueransim-slice2 | [2023-05-13 11:38:05.368] [nas] [info] UE switches to state [CM-CONNECTED]
ueransim-slice2 | [2023-05-13 11:38:05.369] [ngap] [debug] Initial NAS message received from UE[1]
ueransim-slice2 | [2023-05-13 11:38:05.398] [nas] [debug] Authentication Request received
ueransim-slice2 | [2023-05-13 11:38:05.423] [nas] [debug] Security Mode Command received
ueransim-slice2 | [2023-05-13 11:38:05.423] [nas] [debug] Selected integrity[1] ciphering[1]
ueransim-slice2 | [2023-05-13 11:38:05.432] [ngap] [debug] Initial Context Setup Request received
ueransim-slice2 | [2023-05-13 11:38:05.433] [nas] [debug] Registration accept received
ueransim-slice2 | [2023-05-13 11:38:05.433] [nas] [info] UE switches to state [MM-REGISTERED/NORMAL-SERVICE]
ueransim-slice2 | [2023-05-13 11:38:05.433] [nas] [debug] Sending Registration Complete
ueransim-slice2 | [2023-05-13 11:38:05.433] [nas] [info] Initial Registration is successful
ueransim-slice2 | [2023-05-13 11:38:05.433] [nas] [debug] Sending PDU Session Establishment Request
ueransim-slice2 | [2023-05-13 11:38:05.433] [nas] [debug] UAC access attempt is allowed for identity[0], category[MO_sig]
ueransim-slice2 | [2023-05-13 11:38:05.661] [ngap] [info] PDU session resource(s) setup for UE[1] count[1]
ueransim-slice2 | [2023-05-13 11:38:05.662] [nas] [debug] PDU Session Establishment Accept received
ueransim-slice2 | [2023-05-13 11:38:05.662] [nas] [info] PDU Session establishment is successful PSI[1]
ueransim-slice2 | RTNETLINK answers: File exists
ueransim-slice2 | [2023-05-13 11:38:05.685] [app] [error] TUN configuration failure [Command execution failed. The command was: ip route add default dev uesimtun1 table rt_uesimtun1. The output is: 'Command execution failure]
ifconfig
lab@lab-virtual-machine:~/5gc-slicing-v1/Slice1/gnb-slice$ ifconfig
docker0: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500
inet 172.17.0.1 netmask 255.255.0.0 broadcast 172.17.255.255
ether 02:42:f7:40:5e:5a txqueuelen 0 (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
ens33: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.19.66 netmask 255.255.255.0 broadcast 192.168.19.255
inet6 fe80::20c:29ff:fe90:987d prefixlen 64 scopeid 0x20<link>
ether 00:0c:29:90:98:7d txqueuelen 1000 (Ethernet)
RX packets 9816 bytes 2279431 (2.2 MB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 32311 bytes 1948266 (1.9 MB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
ens39: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.16.66 netmask 255.255.255.0 broadcast 192.168.16.255
inet6 fe80::20c:29ff:fe90:98af prefixlen 64 scopeid 0x20<link>
ether 00:0c:29:90:98:af txqueuelen 1000 (Ethernet)
RX packets 39061 bytes 3507517 (3.5 MB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 3082 bytes 278862 (278.8 KB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
ens40: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.36.66 netmask 255.255.255.0 broadcast 192.168.36.255
inet6 fe80::20c:29ff:fe90:989b prefixlen 64 scopeid 0x20<link>
ether 00:0c:29:90:98:9b txqueuelen 1000 (Ethernet)
RX packets 42861 bytes 3680074 (3.6 MB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 19757 bytes 1342275 (1.3 MB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
ens41: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.26.66 netmask 255.255.255.0 broadcast 192.168.26.255
inet6 fe80::20c:29ff:fe90:98a5 prefixlen 64 scopeid 0x20<link>
ether 00:0c:29:90:98:a5 txqueuelen 1000 (Ethernet)
RX packets 7829 bytes 1256394 (1.2 MB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 19866 bytes 1363935 (1.3 MB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0x10<host>
loop txqueuelen 1000 (Local Loopback)
RX packets 259322 bytes 18925066 (18.9 MB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 259322 bytes 18925066 (18.9 MB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
uesimtun0: flags=369<UP,POINTOPOINT,NOTRAILERS,RUNNING,PROMISC> mtu 1400
inet 12.1.1.2 netmask 255.255.255.255 destination 12.1.1.2
inet6 fe80::72a3:65fe:7691:1418 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 10 bytes 628 (628.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
uesimtun1: flags=369<UP,POINTOPOINT,NOTRAILERS,RUNNING,PROMISC> mtu 1400
inet 12.1.1.2 netmask 255.255.255.255 destination 12.1.1.2
inet6 fe80::5968:5197:a58:37f3 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 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
Actually generated uesimtun0 with the same ip
Consider distinguishing the ue ip allocated by the three core networks on the core network
#切片1
DNN_RANGE2=12.1.1.2 - 12.1.1.50
#切片2
DNN_RANGE2=12.1.1.51 - 12.1.1.99
#切片3
DNN_RANGE2=12.1.1.101 - 12.1.1.150
Then do the same:
uesimtun0: flags=369<UP,POINTOPOINT,NOTRAILERS,RUNNING,PROMISC> mtu 1400
inet 12.1.1.2 netmask 255.255.255.255 destination 12.1.1.2
inet6 fe80::a9c1:e01:a55b:4ed2 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 7 bytes 448 (448.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
uesimtun1: flags=369<UP,POINTOPOINT,NOTRAILERS,RUNNING,PROMISC> mtu 1400
inet 12.1.1.51 netmask 255.255.255.255 destination 12.1.1.51
inet6 fe80::b182:5544:dbb7:25fb 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 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
The ip was generated according to the modification, but the error still exists
- veransim-slice1
ueransim-slice1 | [2023-05-13 11:46:53.128] [ngap] [info] PDU session resource(s) setup for UE[1] count[1]
ueransim-slice1 | [2023-05-13 11:46:53.129] [nas] [debug] PDU Session Establishment Accept received
ueransim-slice1 | [2023-05-13 11:46:53.129] [nas] [info] PDU Session establishment is successful PSI[1]
ueransim-slice1 | [2023-05-13 11:46:53.148] [app] [info] Connection setup for PDU session[1] is successful, TUN interface[uesimtun0, 12.1.1.2] is up.
- veransim-slice2
Establishment Accept received
ueransim-slice2 | [2023-05-13 11:47:00.213] [nas] [info] PDU Session establishment is successful PSI[1]
ueransim-slice2 | RTNETLINK answers: File exists
ueransim-slice2 | [2023-05-13 11:47:00.232] [app] [error] TUN configuration failure [Command execution failed. The command was: ip route add default dev uesimtun1 table rt_uesimtun1. The output is: 'Command execution failure]
It seems that it is not such a simple problem
Routing Table Direction Resolution
https://github.com/aligungr/UERANSIM/issues/425
lab@lab-virtual-machine:~/5gc-slicing-v1/Slice3$ cat /etc/iproute2/rt_tables
#
# reserved values
#
255 local
254 main
253 default
0 unspec
#
# local
#
#1 inr.ruhep
1000 rt_uesimtun0
lab@lab-virtual-machine:~/5gc-slicing-v1/Slice3$ ip rule show table rt_uesimtun0
32737: from 12.1.1.51 lookup rt_uesimtun0
32738: from 12.1.1.2 lookup rt_uesimtun0
32739: from 12.1.1.21 lookup rt_uesimtun0
32740: from 12.1.1.10 lookup rt_uesimtun0
32741: from 12.1.1.20 lookup rt_uesimtun0
32742: from 12.1.1.9 lookup rt_uesimtun0
32743: from 12.1.1.8 lookup rt_uesimtun0
32744: from 12.1.1.19 lookup rt_uesimtun0
32747: from 12.1.1.6 lookup rt_uesimtun0
32748: from 12.1.1.14 lookup rt_uesimtun0
32757: from 12.1.1.5 lookup rt_uesimtun0
32758: from 12.1.1.4 lookup rt_uesimtun0
32759: from 12.1.1.3 lookup rt_uesimtun0
Different base stations generate ue to the same rt_uesimtun1, instead of having their own routes
-
tun+route
https://github.com/search?q=repo%3Aaligungr%2FUERANSIM%20%20route&type=code
https://github.com/aligungr/UERANSIM/blob/3a96298fa284b0da261a60439b21c1adf1677aea/src/ue/tun/config. cpp#L154 -
re
https://github.com/aligungr/UERANSIM/tree/3a96298fa284b0da261a60439b21c1adf1677aea/src/ue/re
routing rules
Routing not started:
lab@lab-virtual-machine:~/5gc-slicing-v1/Slice1/gnb-slice$ route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
0.0.0.0 192.168.3.1 0.0.0.0 UG 104 0 0 ens37
0.0.0.0 192.168.19.1 0.0.0.0 UG 20100 0 0 ens33
0.0.0.0 192.168.16.1 0.0.0.0 UG 20101 0 0 ens39
0.0.0.0 192.168.36.1 0.0.0.0 UG 20102 0 0 ens40
0.0.0.0 192.168.26.1 0.0.0.0 UG 20103 0 0 ens41
169.254.0.0 0.0.0.0 255.255.0.0 U 1000 0 0 ens33
172.17.0.0 0.0.0.0 255.255.0.0 U 0 0 0 docker0
192.168.3.0 0.0.0.0 255.255.255.0 U 104 0 0 ens37
192.168.10.0 192.168.16.6 255.255.255.0 UG 0 0 0 ens39
192.168.12.0 192.168.16.6 255.255.255.0 UG 0 0 0 ens39
192.168.16.0 0.0.0.0 255.255.255.0 U 101 0 0 ens39
192.168.19.0 0.0.0.0 255.255.255.0 U 100 0 0 ens33
192.168.20.0 192.168.26.6 255.255.255.0 UG 0 0 0 ens41
192.168.22.0 192.168.26.6 255.255.255.0 UG 0 0 0 ens41
192.168.26.0 0.0.0.0 255.255.255.0 U 103 0 0 ens41
192.168.30.0 192.168.36.6 255.255.255.0 UG 0 0 0 ens40
192.168.32.0 192.168.36.6 255.255.255.0 UG 0 0 0 ens40
192.168.36.0 0.0.0.0 255.255.255.0 U 102 0 0 ens40
Start slice1:
[2023-05-15 10:17:00.740] [app] [info] Connection setup for PDU session[1] is successful, TUN interface[uesimtun0, 12.1.1.10] is up.
lab@lab-virtual-machine:~/5gc-slicing-v1/Slice1/gnb-slice$ route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
0.0.0.0 192.168.3.1 0.0.0.0 UG 104 0 0 ens37
0.0.0.0 192.168.19.1 0.0.0.0 UG 20100 0 0 ens33
0.0.0.0 192.168.16.1 0.0.0.0 UG 20101 0 0 ens39
0.0.0.0 192.168.36.1 0.0.0.0 UG 20102 0 0 ens40
0.0.0.0 192.168.26.1 0.0.0.0 UG 20103 0 0 ens41
169.254.0.0 0.0.0.0 255.255.0.0 U 1000 0 0 ens33
172.17.0.0 0.0.0.0 255.255.0.0 U 0 0 0 docker0
192.168.3.0 0.0.0.0 255.255.255.0 U 104 0 0 ens37
192.168.10.0 192.168.16.6 255.255.255.0 UG 0 0 0 ens39
192.168.12.0 192.168.16.6 255.255.255.0 UG 0 0 0 ens39
192.168.16.0 0.0.0.0 255.255.255.0 U 101 0 0 ens39
192.168.19.0 0.0.0.0 255.255.255.0 U 100 0 0 ens33
192.168.20.0 192.168.26.6 255.255.255.0 UG 0 0 0 ens41
192.168.22.0 192.168.26.6 255.255.255.0 UG 0 0 0 ens41
192.168.26.0 0.0.0.0 255.255.255.0 U 103 0 0 ens41
192.168.30.0 192.168.36.6 255.255.255.0 UG 0 0 0 ens40
192.168.32.0 192.168.36.6 255.255.255.0 UG 0 0 0 ens40
192.168.36.0 0.0.0.0 255.255.255.0 U 102 0 0 ens40
start slice2
lab@lab-virtual-machine:~/5gc-slicing-v1/Slice2/gnb-slice$ route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
0.0.0.0 192.168.3.1 0.0.0.0 UG 104 0 0 ens37
0.0.0.0 192.168.19.1 0.0.0.0 UG 20100 0 0 ens33
0.0.0.0 192.168.16.1 0.0.0.0 UG 20101 0 0 ens39
0.0.0.0 192.168.36.1 0.0.0.0 UG 20102 0 0 ens40
0.0.0.0 192.168.26.1 0.0.0.0 UG 20103 0 0 ens41
169.254.0.0 0.0.0.0 255.255.0.0 U 1000 0 0 ens33
172.17.0.0 0.0.0.0 255.255.0.0 U 0 0 0 docker0
192.168.3.0 0.0.0.0 255.255.255.0 U 104 0 0 ens37
192.168.10.0 192.168.16.6 255.255.255.0 UG 0 0 0 ens39
192.168.12.0 192.168.16.6 255.255.255.0 UG 0 0 0 ens39
192.168.16.0 0.0.0.0 255.255.255.0 U 101 0 0 ens39
192.168.19.0 0.0.0.0 255.255.255.0 U 100 0 0 ens33
192.168.20.0 192.168.26.6 255.255.255.0 UG 0 0 0 ens41
192.168.22.0 192.168.26.6 255.255.255.0 UG 0 0 0 ens41
192.168.26.0 0.0.0.0 255.255.255.0 U 103 0 0 ens41
192.168.30.0 192.168.36.6 255.255.255.0 UG 0 0 0 ens40
192.168.32.0 192.168.36.6 255.255.255.0 UG 0 0 0 ens40
192.168.36.0 0.0.0.0 255.255.255.0 U 102 0 0 ens40
The routing table is the same in both cases
- traceroute View the route to an ip
-q only trace once -s xxxx set the source address
traceroute -q 1 192.168.20.132 -s 12.1.1.52
lab@lab-virtual-machine:~/5gc-slicing-v1/Slice2/gnb-slice$ traceroute -q 1 192.168.20.132
traceroute to 192.168.20.132 (192.168.20.132), 30 hops max, 60 byte packets
1 192.168.26.6 (192.168.26.6) 2.760 ms
2 192.168.20.132 (192.168.20.132) 2.610 ms
lab@lab-virtual-machine:~/5gc-slicing-v1/Slice2/gnb-slice$ traceroute -q 1 192.168.20.132 -s 12.1.1.51
traceroute to 192.168.20.132 (192.168.20.132), 30 hops max, 60 byte packets
bind: Cannot assign requested address
lab@lab-virtual-machine:~/5gc-slicing-v1/Slice2/gnb-slice$ traceroute -q 1 192.168.20.132 -s 12.1.1.52
traceroute to 192.168.20.132 (192.168.20.132), 30 hops max, 60 byte packets
1 *
2 *
3 192.168.23.1 (192.168.23.1) 75.157 ms
4 *
5 *
6 *
7 *
8 *
9 *
10 *
11 *
12 *
13 *
14 *
15 *
16 *
17 *
18 *
19 *
20 *
21 *
22 *
23 *
24 *
25 *
26 *
27 *
28 *
29 *
30 *
lab@lab-virtual-machine:~/5gc-slicing-v1/Slice2/gnb-slice$ traceroute -q 1 192.168.20.1 -s 12.1.1.52
traceroute to 192.168.20.1 (192.168.20.1), 30 hops max, 60 byte packets
1 *
2 192.168.23.135 (192.168.23.135) 5.352 ms
3 192.168.20.1 (192.168.20.1) 5.371 ms
source code routing code
https://github.com/aligungr/UERANSIM/blob/master/src/ue/tun/config.cpp
https://github.com/aligungr/UERANSIM/blob/master/src/ue/tun/tun.cpp
在这里插入代码片