文章目录
- 启动代码
- 部署全流程
- 网络配置
- 配置静态IP
- 部署核心网
- 部署基站
- 部署基站1
- 部署基站2
- 部署基站3
- 查看amf日志
- 问题
- routing-config的问题
- 不加routing-config与加的对比
- 调查
- nr-binder功能测试
- 基站1
- 基站2
- ifconfig
- 路由表方向解决
- 路由规则
启动代码
- 启动OAI核心网
#开启数据转发
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
- 集中式部署启动ueranism基站
#启动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
- 分立式部署启动ueransim基站
#依次添加路由
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
- 信息查看
#查看全部容器
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
部署全流程
首先我们需要服务器A与主机B,两个机器有三条互相连接的网线分别用于三个切片的通信,两机器应该配置尽量多的RAM(大于12GB)与CPU(核*线程不小于16个)。
网络配置
配置静态IP
需要配置两机器网络,用到三个网段分别用于三个切片。
- 服务器A
在这里插入代码片
- 主机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]
配置完后ping进行测试
- 在主机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
部署核心网
- 开启数据转发
sudo sysctl net.ipv4.conf.all.forwarding=1
sudo iptables -P FORWARD ACCEPT
- 部署核心网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
- 部署核心网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
- 部署核心网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
- 查看容器运行健康状态
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
部署基站
部署基站1
- 添加路由
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
- 测试是否成功与核心网网段及amf网元通信
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
- 部署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
- 查看ueransim-slice1容器状态
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
- 查看ueransim-slice1日志
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.
部署基站2
- 添加路由
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
- 测试是否成功与核心网网段及amf网元通信
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
- 部署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
- 查看ueransim-slice2容器状态
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)
- 查看ueransim-slice2日志
部署基站3
- 添加路由
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
- 测试是否成功与核心网网段及amf网元通信
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
- 部署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
- 查看ueransim-slice2容器状态
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)
- 查看ueransim-slice2日志
查看amf日志
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 ]
问题
第二个基站无法接入,TUN接口生成有点问题,在核心网可以看见基站与用户的接入
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
我估计问题出现的原因是网络接口生成时出现冲突,集中部署没有问题是因为没有使用host,容器内部网络互不干扰,而这里在生成uesimtun的时候,新生成的接口与第一个生成的接口有冲突
ueransim使用
https://github.com/aligungr/UERANSIM/issues/402
应该就是在生成uesimtun接口时会添加一个默认路由,而这个默认路由与之前添加的路由之间有冲突
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的问题
- 不加路由规则启动ue
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
不加routing-config与加的对比
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.
可以看到,不加–no-routing-config,即使用路由规则,无法手动生成tun,而加了–no-routing-config可以成功生成
需要测试这样生成tun接口的功能
调查
ueransim配置文件中添加路由区分配置
https://github.com/aligungr/UERANSIM/pull/611
https://github.com/aligungr/UERANSIM/pull/611/commits/fd565dbac77d4501e0a0de1d4e072e2efcd168a4
routingIndicator=0000
修改后无用
ueransim仅保证生成tun,不保证路由
https://github.com/aligungr/UERANSIM/issues/425
出现相似报错的回答
https://github.com/aligungr/UERANSIM/issues/257
nr-binder功能测试
基站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.
基站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
居然生成了同ip的uesimtun0
考虑核心网上将三个核心网分配的ue ip区分
#切片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
然后进行同样的操作:
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
按照修改生成了ip,但错误依旧有
- ueransim-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.
- ueransim-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]
看样子不是这么简单的问题
路由表方向解决
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
不同基站生成ue都到了同一个rt_uesimtun1上,而不是有各自的路由
-
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 -
tun
https://github.com/aligungr/UERANSIM/tree/3a96298fa284b0da261a60439b21c1adf1677aea/src/ue/tun
路由规则
未启动路由:
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
启动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
启动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
两种情况路由表一致
- traceroute 查看到一个ip的路由
-q 只追踪一次 -s x.x.x.x 设置源地址
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