[デバッグ] ディスクリート ネットワーク スライスの展開

スタートアップコード

  • 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 が必要です。2 台のマシンには、それぞれ 3 つのスライスの通信用に 3 本のネットワーク ケーブルが相互接続されています。2 台のマシンは、同じくらい多くの RAM (12GB 以上) と CPU (コア * スレッド) で構成されている必要があります16以上)。

ネットワーク設定

静的 IP を構成する

2 台のマシンのネットワークを構成する必要があり、3 つのネットワーク セグメントが 3 つのスライスにそれぞれ使用されます。

  • サーバー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 ] 

質問

2 番目の基地局に接続できません。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

問題の原因は、ネットワークインターフェース生成時に競合が発生しているためだと思われますが、集中デプロイではホストを使用しないため、コンテナの内部ネットワークが相互に干渉しないので問題ありません。 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

ルーティング構成の問題

  • ルーティングルールなしで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 を生成しました

コア ネットワーク上の 3 つのコア ネットワークによって割り当てられた 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は変更に従って生成されましたが、エラーはまだ存在します

  • veransim-スライス1
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.
  • ベランシムスライス2
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 

異なる基地局は独自のルートを持つのではなく、同じ rt_uesimtun1 への ue を生成します

  • 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


  • https://github.com/aligungr/UERANSIM/tree/3a96298fa284b0da261a60439b21c1adf1677aea/src/ue/reについて

ルーティングルール

ルーティングが開始されていません:

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

スライス 1 を開始します:

[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

スライス2の開始

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 1 回だけトレースします -s xxxx 送信元アドレスを設定します
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

ソースコード ルーティングコード

https://github.com/aligungr/UERANSIM/blob/master/src/ue/tun/config.cpp

https://github.com/aligungr/UERANSIM/blob/master/src/ue/tun/tun.cpp

在这里插入代码片

おすすめ

転載: blog.csdn.net/qq_41224270/article/details/130655227