LoginSignup
1
1

More than 1 year has passed since last update.

free5gc + UERANSIM でPDU Session Establishmentしてみた

Last updated at Posted at 2022-02-07

環境

  • HW
    • MacbookPro(2020)
      • OS : Monterey(12.1)
    • CPU : 2GHz クアッドコアIntel Core i5
    • Memory : 16GB
  • SW
    • VirtualBox 6.1.32
      • Ubuntu 18.04 (5.4.0-87-generic)
    • free5gc 3.0.6
    • UERANSIM 3.25
  • 構成 g.png

構築

1.VM環境構築

使用するUbuntuは18.04。versionが新しすぎるとgtp5gが対応しているkernelではないためmakeが失敗する。20.04.3だと失敗した。
イメージファイルはosboxes.orgのものを使用。
osboxes.org

方針としては、一つのVM上にfree5gcとUERANSIMをインストールしてそのVMを複製して環境を構築。
VirtualboxでUbuntu構築する際、ネットワークアダプタを追加。free5gcとUERANSIM用(上記構成図の192.168.100.0/24セグメント)として「ブリッジアダプター」の「bridge0」で追加
b.png
このアダプタがenp0s9となる。
※作業効率のためアダプター2にホストオンリーアダプターを追加しているので、アダプター2にブリッジアダプターを追加した場合はenp0s8かも。
※macOSをMontereyにupしてからvboxnet0の調子がおかしいので、普通にアダプター1をブリッジアダプターにした方が早いかも

Ubuntuが立ち上がったらよしなに以下を実施
 ・apt update/upgrade
 ・hostname設定
 ・ssh設定 (PasswordAuthentication yes設定)
 ・interface設定 (enp0s9にstatic address設定)

まずはapt update。これを実行しないと以降のsshがインストールできない。
このイメージにはsshがインストールされてないので、apt install sshを実行。
その際タイミングによっては、
E: Unable to acquire the dpkg frontend lock (/var/lib/dpkg/lock-frontend), is another process using it?
のようなエラーが発生する可能性がある。
その場合は、ps aux | grep apt で表示されているプロセスが終了するまで待つか再起動でインストールできるようになる。

2.free5gcインストール

基本的には下記サイト記載内容通りに実施。
free5gc
下記コマンドをコピペで流し込むだけで構築が完了している、はず。

cd ~
wget https://golang.org/dl/go1.15.8.linux-amd64.tar.gz
tar -C /usr/local -xzf go1.15.8.linux-amd64.tar.gz
mkdir -p ~/go/{bin,pkg,src}
echo 'export GOPATH=$HOME/go' >> ~/.bashrc
echo 'export GOROOT=/usr/local/go' >> ~/.bashrc
echo 'export PATH=$PATH:$GOPATH/bin:$GOROOT/bin' >> ~/.bashrc
echo 'export GO111MODULE=auto' >> ~/.bashrc
source ~/.bashrc


apt -y install curl mongodb git gcc g++ autoconf libtool pkg-config libmnl-dev libyaml-dev make libsctp-dev lksctp-tools iproute2 linux-headers-5.0.0-23-generic
snap install cmake --classic
systemctl start mongodb

sysctl -w net.ipv4.ip_forward=1
iptables -t nat -A POSTROUTING -o enp0s3 -j MASQUERADE
systemctl stop ufw
systemctl disable ufw

git clone --recursive https://github.com/free5gc/free5gc.git
cd ~/free5gc
make

cd ~
git clone https://github.com/free5gc/gtp5g.git
cd gtp5g
make
make install

curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -                                          
echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
apt-get update
apt-get install -y nodejs yarn
cd ~/free5gc
make webconsole

・最初mongodb起動と合わせてsystemctl enableしなくてよいのかと思ってたけど、「systemctl list-unit-files -t service」でインストール後に確認したところenabledになっていたので不要。
・cmakeはこのインストール方法じゃないとgtp5gのmakeで失敗した。
・何故かvirtualbox-guest-dkms-hweをインストールしないとgtp5gのmake installで失敗する。/lib/modules/5.0.0-23-genericが見つからないとかなんとか。理由は不明だがapt installにvirtualbox-guest-dkms-hweを追加するとmake installに成功する。そして一番の謎は最初っからインストールしておいてもmake installに失敗する。一度失敗した後にapt installすると二回目のmake installに成功する。 → VirualBox6.1.32では、一発でmake install成功するようになっていたので、この対応は不要。

gtp5gが正しく起動しているかは下記コマンドを実施して同様の結果になっていれば問題なし

root@f5g:~# lsmod | grep 5g
gtp5g                 102400  0
udp_tunnel             16384  1 gtp5g

正しくfree5gcが構築されているか下記コマンドでテストを行い、最後に「pass」が表示されれば構築完了。

root@f5g:~# cd free5gc
root@f5g:~/free5gc# ./test.sh TestRegistration

ただおそらくこのversionだと以下のようなエラーが表示される

root@osboxes:~/free5gc# ./test.sh TestRegistration
./bin/free5gc-upfd: invalid option -- 'f'

NAME:
   upf - 5G User Plane Function (UPF)

USAGE:
   main [global options] command [command options] [arguments...]

COMMANDS:
   help, h  Shows a list of commands or help for one command

GLOBAL OPTIONS:
   -c FILE  Load configuration from FILE
   -l FILE  Output NF log to FILE
   -g FILE  Output free5gc log to FILE
   -h       show help
2022-02-04T23:08:31-05:00 [ERRO][UPF][Util] Illigal option: f
2022-02-04T23:08:31-05:00 [ERRO][UPF][Util] Error parsing args

test.sh内のfree5gc-upfdのオプションコマンドが間違っているぽい。
-f ではなく -c に修正する必要がある。

root@osboxes:~/free5gc# diff -u test.sh.org test.sh
--- test.sh.org 2022-02-04 23:17:46.046065563 -0500
+++ test.sh 2022-02-04 23:16:00.317227559 -0500
@@ -162,7 +162,7 @@
     sudo -E tcpdump -U -i lo -w ${PCAP_PATH}/default_ns.pcap &
 fi

-cd NFs/upf/build && ${EXEC_UPFNS} ./bin/free5gc-upfd -f config/upfcfg.test.yaml &
+cd NFs/upf/build && ${EXEC_UPFNS} ./bin/free5gc-upfd -c config/upfcfg.test.yaml &
 sleep 2

 if [[ "$1" == "TestNon3GPP" ]]

再度実行すると下記のようにpassが表示される

root@f5g:~/free5gc# ./test.sh TestRegistration
2022-02-04T23:24:58-05:00 [INFO][UPF][Util] UPF log: /root/free5gc/NFs/upf/build/log/upf.log
2022-02-04T23:24:58-05:00 [INFO][UPF][Util] Config: /root/free5gc/NFs/upf/build/config/upfcfg.test.yaml
2022-02-04T23:24:58-05:00 [INFO][UPF][Util] UPF config version [1.0.0]
2022-02-04T23:24:58-05:00 [INFO][UPF][Util] Set log level: info
2022-02-04T23:24:58-05:00 [INFO][UPF][Util] DNN routes added, main routing table:
2022-02-04T23:24:58-05:00 [INFO][UPF][Util] DstIp               Gateway        Iface     Priority RtProto   Type
2022-02-04T23:24:58-05:00 [INFO][UPF][Util] 60.60.0.0 /24       0.0.0.0        upfgtp    0        static    unicast
2022-02-04T23:24:58-05:00 [INFO][UPF][Util] 10.200.200.0 /24    0.0.0.0        veth1     0        kernel    unicast
2022-02-04T23:25:04-05:00 [INFO][NRF][Init] NRF Log level is set to [info] level

### 省略 ###

--- PASS: TestRegistration (9.41s)
PASS
ok      test    11.092s
2022-02-04T23:25:18-05:00 [INFO][UPF][Util] Removing DNN routes
root@f5g:~/free5gc#

3.UERANSIMインストール

cd ~
git clone https://github.com/aligungr/UERANSIM
cd ~/UERANSIM
make

これで基本となるVM作成は完了

4.VM複製

RAN側用VMとUPF用VMをクローンで作成。
c.png

ブリッジアダプターのbrige0に割り当てているifのaddressを192.168.100.10/24に変更し、コア側用VMの192.168.100.100、UPF用VMの192.168.100.200にpingが到達することを確認

root@ueran:~# ping 192.168.100.100
PING 192.168.100.100 (192.168.100.100) 56(84) bytes of data.
64 bytes from 192.168.100.100: icmp_seq=1 ttl=64 time=0.713 ms
64 bytes from 192.168.100.100: icmp_seq=2 ttl=64 time=0.578 ms

root@ueran:~# ping 192.168.100.200
PING 192.168.100.200 (192.168.100.200) 56(84) bytes of data.
64 bytes from 192.168.100.200: icmp_seq=1 ttl=64 time=0.454 ms
64 bytes from 192.168.100.200: icmp_seq=2 ttl=64 time=0.610 ms

これでVMとしての準備は完了。

5.加入者情報登録

webconsoleを利用して加入者情報を登録する。
コア側用VM上でwebconsoleを起動

root@f5g:~# 
root@f5g:~# cd free5gc/webconsole/
root@f5g:~/free5gc/webconsole# go run server.go 

5000番portでアクセス可能となるので、ブラウザ上からアクセス
d.png
ID : admin
PW : free5gc

ログインできるとこんな感じ
e.png

今回はPLMNやSUPIなどはデフォルトのものを利用するとので、加入者情報もデフォルトのまま登録
左の「SUBSCRIBERS」を選択して右の「NEW Subscriber」をクリック。
色々と設定できるパラメータが表示されるが、今回はこのまま登録するので一番下の「submit」をクリック。
このように表示されれば登録完了。
f.png

6.RANとコアの接続

いよいよRANとコアの接続を実施。
まずは、UPF用VMにてconfig編集。
upfのconfigは以下フォルダの「upfcfg.yaml」
※当初はコアとUPFを同一VM構成で検討していたが、smfとupfのpfcpで使用するportがかち合いpfcpがestablishしなかったので、今後のupf selection等も考えてupf用のVMを作成することにした。

root@upf:~# cd free5gc/config/
root@upf:~/free5gc/config# ll
total 100
drwxr-xr-x  4 root root  4096 Feb  4 22:57 ./
drwxr-xr-x 12 root root  4096 Feb  4 23:31 ../
-rw-r--r--  1 root root  5211 Feb  4 22:57 amfcfg.n3test.yaml
-rw-r--r--  1 root root  5419 Feb  4 22:57 amfcfg.yaml
-rw-r--r--  1 root root  1434 Feb  4 22:57 ausfcfg.yaml
drwxr-xr-x  2 root root  4096 Feb  4 22:57 multiUPF/
-rw-r--r--  1 root root  2888 Feb  4 22:57 n3iwfcfg.yaml
-rw-r--r--  1 root root  1234 Feb  4 22:57 nrfcfg.yaml
-rw-r--r--  1 root root 23220 Feb  4 22:57 nssfcfg.yaml
-rw-r--r--  1 root root  2060 Feb  4 22:57 pcfcfg.yaml
-rw-r--r--  1 root root  4304 Feb  4 22:57 smfcfg.yaml
drwxr-xr-x  2 root root  4096 Feb  4 23:08 test/
-rw-r--r--  1 root root  1895 Feb  4 22:57 udmcfg.yaml
-rw-r--r--  1 root root   938 Feb  4 22:57 udrcfg.yaml
-rw-r--r--  1 root root  1452 Feb  4 22:57 uerouting.yaml
-rw-r--r--  1 root root  1048 Feb  4 22:57 upfcfg.yaml
-rw-r--r--  1 root root   709 Feb  4 22:57 webuicfg.yaml
root@f5g:~/free5gc/config# 

UPFの設定変更箇所
・N4 interface address
・N3/N9 interface address

root@upf:~/free5gc/config# diff -u upfcfg.yaml.org upfcfg.yaml
--- upfcfg.yaml.org 2022-02-06 09:25:18.249000000 -0500
+++ upfcfg.yaml 2022-02-07 08:19:02.245376540 -0500
@@ -15,12 +15,12 @@

   # The IP list of the N4 interface on this UPF (Can't set to 0.0.0.0)
   pfcp:
-    - addr: 127.0.0.8
+    - addr: 192.168.100.200

   # The IP list of the N3/N9 interfaces on this UPF
   # If there are multiple connection, set addr to 0.0.0.0 or list all the addresses
   gtpu:
-    - addr: 127.0.0.8
+    - addr: 0.0.0.0
     # [optional] gtpu.name
     # - name: upf.5gc.nctu.me
     # [optional] gtpu.ifname
root@upf:~/free5gc/config# 

upfプロセスを起動。これでUPF用VMでの作業は完了。
※PFCP Association RequestはSMF側から一定回数しか出ないため、先にupfを起動させる必要あり。

root@upf:~# cd free5gc/
root@upf:~/free5gc# ./NFs/upf/build/bin/free5gc-upfd -c ./config/upfcfg.yaml
2022-02-07T08:19:12-05:00 [INFO][UPF][Util] UPF log: /root/free5gc/log/upf.log
2022-02-07T08:19:12-05:00 [INFO][UPF][Util] Config: /root/free5gc/config/upfcfg.yaml
2022-02-07T08:19:12-05:00 [INFO][UPF][Util] UPF config version [1.0.0]
2022-02-07T08:19:12-05:00 [INFO][UPF][Util] Set log level: info
2022-02-07T08:19:12-05:00 [INFO][UPF][Util] DNN routes added, main routing table:
2022-02-07T08:19:12-05:00 [INFO][UPF][Util] DstIp               Gateway        Iface     Priority RtProto   Type
2022-02-07T08:19:12-05:00 [INFO][UPF][Util] 192.168.100.0 /24   0.0.0.0        enp0s9    102      kernel    unicast
2022-02-07T08:19:12-05:00 [INFO][UPF][Util] 192.168.1.0 /24     0.0.0.0        enp0s8    101      kernel    unicast
2022-02-07T08:19:12-05:00 [INFO][UPF][Util] 169.254.0.0 /16     0.0.0.0        enp0s8    1000     boot      unicast
2022-02-07T08:19:12-05:00 [INFO][UPF][Util] 60.60.0.0 /24       0.0.0.0        upfgtp    0        static    unicast
2022-02-07T08:19:12-05:00 [INFO][UPF][Util] 10.0.2.0 /24        0.0.0.0        enp0s3    100      kernel    unicast
2022-02-07T08:19:12-05:00 [INFO][UPF][Util] 0.0.0.0 /0          10.0.2.2       enp0s3    20100    dhcp      unicast

続いてコア用VM。
free5gcの各NFのconfigは以下。変更する設定ファイルは「amfcfg.yaml」と「smfcfg.yaml」

root@f5g:~# cd free5gc/config/
root@f5g:~/free5gc/config# ll
total 100
drwxr-xr-x  4 root root  4096 Feb  4 22:57 ./
drwxr-xr-x 12 root root  4096 Feb  4 23:31 ../
-rw-r--r--  1 root root  5211 Feb  4 22:57 amfcfg.n3test.yaml
-rw-r--r--  1 root root  5419 Feb  4 22:57 amfcfg.yaml
-rw-r--r--  1 root root  1434 Feb  4 22:57 ausfcfg.yaml
drwxr-xr-x  2 root root  4096 Feb  4 22:57 multiUPF/
-rw-r--r--  1 root root  2888 Feb  4 22:57 n3iwfcfg.yaml
-rw-r--r--  1 root root  1234 Feb  4 22:57 nrfcfg.yaml
-rw-r--r--  1 root root 23220 Feb  4 22:57 nssfcfg.yaml
-rw-r--r--  1 root root  2060 Feb  4 22:57 pcfcfg.yaml
-rw-r--r--  1 root root  4304 Feb  4 22:57 smfcfg.yaml
drwxr-xr-x  2 root root  4096 Feb  4 23:08 test/
-rw-r--r--  1 root root  1895 Feb  4 22:57 udmcfg.yaml
-rw-r--r--  1 root root   938 Feb  4 22:57 udrcfg.yaml
-rw-r--r--  1 root root  1452 Feb  4 22:57 uerouting.yaml
-rw-r--r--  1 root root  1048 Feb  4 22:57 upfcfg.yaml
-rw-r--r--  1 root root   709 Feb  4 22:57 webuicfg.yaml
root@f5g:~/free5gc/config# 

まずはAMF
AMFでは下記の変更を実施。
・N2 interface address

amfcfg.yamlは下記の表に変更

root@f5g:~/free5gc/config# diff -u amfcfg.yaml.org amfcfg.yaml
--- amfcfg.yaml.org 2022-02-05 03:38:55.963028585 -0500
+++ amfcfg.yaml 2022-02-05 03:40:46.790414589 -0500
@@ -5,7 +5,7 @@
 configuration:
   amfName: AMF # the name of this AMF
   ngapIpList:  # the IP list of N2 interfaces on this AMF
-    - 127.0.0.1
+    - 192.168.100.100
   sbi: # Service-based interface information
     scheme: http # the protocol for sbi (http or https)
     registerIPv4: 127.0.0.18 # IP used to register to NRF

続いてSMF
SMFでは下記の変更を実施。
・ N4 interface address(smf)
・ N4 interface address(upf)
・ N3 interface address(upf)

root@f5g:~/free5gc/config# diff -u smfcfg.yaml.org smfcfg.yaml
--- smfcfg.yaml.org 2022-02-06 08:44:12.480283877 -0500
+++ smfcfg.yaml 2022-02-07 08:21:51.757173050 -0500
@@ -35,14 +35,14 @@
     - mcc: "208" # Mobile Country Code (3 digits string, digit: 0~9)
       mnc: "93" # Mobile Network Code (2 or 3 digits string, digit: 0~9)
   pfcp: # the IP address of N4 interface on this SMF (PFCP)
-    addr: 127.0.0.1
+    addr: 192.168.100.100
   userplane_information: # list of userplane information
     up_nodes: # information of userplane node (AN or UPF)
       gNB1: # the name of the node
         type: AN # the type of the node (AN or UPF)
       UPF:  # the name of the node
         type: UPF # the type of the node (AN or UPF)
-        node_id: 127.0.0.8 # the IP/FQDN of N4 interface on this UPF (PFCP)
+        node_id: 192.168.100.200 # the IP/FQDN of N4 interface on this UPF (PFCP)
         sNssaiUpfInfos: # S-NSSAI information list for this UPF
           - sNssai: # S-NSSAI (Single Network Slice Selection Assistance Information)
               sst: 1 # Slice/Service Type (uinteger, range: 0~255)
@@ -61,7 +61,7 @@
         interfaces: # Interface list for this UPF
           - interfaceType: N3 # the type of the interface (N3 or N9)
             endpoints: # the IP address of this N3/N9 interface on this UPF
-              - 127.0.0.8
+              - 192.168.100.200
             networkInstance: internet # Data Network Name (DNN)
     links: # the topology graph of userplane, A and B represent the two nodes of each link
       - A: gNB1
root@f5g:~/free5gc/config# 

そしてコア側のfree5gcを起動。
run.shを実行することで関連するNF(AMF/SMF/NSSF等)が起動
コア側VMではupfを起動させないので、起動前にrun.shを下記のように編集。

root@f5g:~/free5gc# diff -u run.sh.org run.sh
--- run.sh.org  2022-02-04 23:15:03.869017552 -0500
+++ run.sh  2022-02-07 08:53:49.201146591 -0500
@@ -2,7 +2,7 @@

 PID_LIST=()

-sudo -E ./NFs/upf/build/bin/free5gc-upfd -c ./config/upfcfg.yaml -l ./log/nf/upf.log -g ./log/free5gc.log &
+#sudo -E ./NFs/upf/build/bin/free5gc-upfd -c ./config/upfcfg.yaml -l ./log/nf/upf.log -g ./log/free5gc.log &
 PID_LIST+=($!)

 sleep 1
root@f5g:~/free5gc# 

run.sh実行。

root@f5g:~/free5gc# ./run.sh
nrf
2022-02-05T03:33:44-05:00 [INFO][NRF][App] NRF version:  
    free5GC version: v3.0.6-10-gfa56062
    build time:      2022-02-05T03:58:51Z
    commit hash:     e74af1f5
    commit time:     2021-08-27T07:54:21Z
    go version:      go1.15.8 linux/amd64
2022-02-05T03:33:44-05:00 [INFO][NRF][Init] NRF Log level is set to [info] level
2022-02-05T03:33:44-05:00 [INFO][LIB][Path] set log level : info
2022-02-05T03:33:44-05:00 [INFO][LIB][Path] set report call : false
2022-02-05T03:33:44-05:00 [INFO][LIB][OAPI] set log level : info

### 省略 ###

これでコア側の準備完了。
upf側のログを見て下記のようなログが表示されていればSMFとUPFとのN4接続は問題なし。

2022-02-07T08:58:43-05:00 [INFO][UPF][Util] [PFCP] Handle PFCP association setup request
2022-02-07T08:58:43-05:00 [INFO][UPF][Util] [PFCP] Association Setup Response

最後にRAN側
UERANSIMはgNB用とUE用と二つプロセスを別々で実行する必要がある。
まずは設定ファイルの編集下記フォルダの「free5gc-ue.yaml」と「free5gc-gnb.yaml」を編集

root@ueran:~# cd UERANSIM/config/
root@ueran:~/UERANSIM/config# ll
total 32
drwxr-xr-x 2 root root 4096 Feb  4 23:34 ./
drwxr-xr-x 9 root root 4096 Feb  4 23:35 ../
-rw-r--r-- 1 root root  794 Feb  4 23:34 custom-gnb.yaml
-rw-r--r-- 1 root root 1557 Feb  4 23:34 custom-ue.yaml
-rw-r--r-- 1 root root  803 Feb  4 23:34 free5gc-gnb.yaml
-rw-r--r-- 1 root root 1578 Feb  4 23:34 free5gc-ue.yaml
-rw-r--r-- 1 root root  784 Feb  4 23:34 open5gs-gnb.yaml
-rw-r--r-- 1 root root 1536 Feb  4 23:34 open5gs-ue.yaml
root@ueran:~/UERANSIM/config# 

まずはUE用ファイルを編集。
・gNBのアドレス編集

root@ueran:~/UERANSIM/config# diff -u free5gc-ue.yaml.org free5gc-ue.yaml
--- free5gc-ue.yaml.org 2022-02-05 08:08:45.838449700 -0500
+++ free5gc-ue.yaml 2022-02-05 08:09:19.662449700 -0500
@@ -20,7 +20,7 @@

 # List of gNB IP addresses for Radio Link Simulation
 gnbSearchList:
-  - 127.0.0.1
+  - 192.168.100.10

 # UAC Access Identities Configuration
 uacAic:

続いてgNB用ファイルを編集。
・gNBのアドレス編集
・AMFのアドレス編集

root@ueran:~/UERANSIM/config# diff -u free5gc-gnb.yaml.org free5gc-gnb.yaml
--- free5gc-gnb.yaml.org    2022-02-05 08:08:54.410449700 -0500
+++ free5gc-gnb.yaml    2022-02-05 08:10:13.110449700 -0500
@@ -5,13 +5,13 @@
 idLength: 32        # NR gNB ID length in bits [22...32]
 tac: 1              # Tracking Area Code

-linkIp: 127.0.0.1   # gNB's local IP address for Radio Link Simulation (Usually same with local IP)
-ngapIp: 127.0.0.1   # gNB's local IP address for N2 Interface (Usually same with local IP)
-gtpIp: 127.0.0.1    # gNB's local IP address for N3 Interface (Usually same with local IP)
+linkIp: 192.168.100.10   # gNB's local IP address for Radio Link Simulation (Usually same with local IP)
+ngapIp: 192.168.100.10   # gNB's local IP address for N2 Interface (Usually same with local IP)
+gtpIp: 192.168.100.10    # gNB's local IP address for N3 Interface (Usually same with local IP)

 # List of AMF address information
 amfConfigs:
-  - address: 127.0.0.1
+  - address: 192.168.100.100
     port: 38412

 # List of supported S-NSSAIs by this gNB

これでRAN側の設定ファイル準備も完了。
gNBを起動させる。

root@ueran:~# cd UERANSIM/build/
root@ueran:~/UERANSIM/build# ./nr-gnb -c ../config/free5gc-gnb.yaml
UERANSIM v3.2.6
[2022-02-06 08:19:12.661] [sctp] [info] Trying to establish SCTP connection... (192.168.100.100:38412)
[2022-02-06 08:19:12.707] [sctp] [info] SCTP connection established (192.168.100.100:38412)
[2022-02-06 08:19:12.707] [sctp] [debug] SCTP association setup ascId[1]
[2022-02-06 08:19:12.708] [ngap] [debug] Sending NG Setup Request
[2022-02-06 08:19:12.722] [ngap] [debug] NG Setup Response received
[2022-02-06 08:19:12.722] [ngap] [info] NG Setup procedure is successful

ログとしてNG Setup procedure is successfulと表示されれば、AMFとgNBとの接続は完了。

コア側のログとしては以下のように表示される。

2022-02-06T08:19:12-05:00 [INFO][AMF][NGAP] [AMF] SCTP Accept from: 192.168.100.10:37395
2022-02-06T08:19:12-05:00 [INFO][AMF][NGAP] Create a new NG connection for: 192.168.100.10:37395
2022-02-06T08:19:12-05:00 [INFO][AMF][NGAP][192.168.100.10:37395] Handle NG Setup request
2022-02-06T08:19:12-05:00 [INFO][AMF][NGAP][192.168.100.10:37395] Send NG-Setup response

続いてUE。RAN側のVMに対してもう一つsshセッション貼っておくとgNBとUE両方のログが確認しやすい。
UEを起動させる。

root@ueran:~# 
root@ueran:~# cd UERANSIM/build/
root@ueran:~/UERANSIM/build# 
root@ueran:~/UERANSIM/build# ./nr-ue -c ../config/free5gc-ue.yaml
UERANSIM v3.2.6
[2022-02-07 08:24:10.925] [rrc] [debug] New signal detected for cell[1], total [1] cells in coverage
[2022-02-07 08:24:10.925] [nas] [info] UE switches to state [MM-DEREGISTERED/PLMN-SEARCH]
[2022-02-07 08:24:10.926] [nas] [info] Selected plmn[208/93]
[2022-02-07 08:24:10.926] [rrc] [info] Selected cell plmn[208/93] tac[1] category[SUITABLE]
[2022-02-07 08:24:10.926] [nas] [info] UE switches to state [MM-DEREGISTERED/PS]
[2022-02-07 08:24:10.926] [nas] [info] UE switches to state [MM-DEREGISTERED/NORMAL-SERVICE]
[2022-02-07 08:24:10.927] [nas] [debug] Initial registration required due to [MM-DEREG-NORMAL-SERVICE]
[2022-02-07 08:24:10.930] [nas] [debug] UAC access attempt is allowed for identity[0], category[MO_sig]
[2022-02-07 08:24:10.930] [nas] [debug] Sending Initial Registration
[2022-02-07 08:24:10.930] [rrc] [debug] Sending RRC Setup Request
[2022-02-07 08:24:10.931] [rrc] [info] RRC connection established
[2022-02-07 08:24:10.932] [rrc] [info] UE switches to state [RRC-CONNECTED]
[2022-02-07 08:24:10.932] [nas] [info] UE switches to state [MM-REGISTER-INITIATED]
[2022-02-07 08:24:10.933] [nas] [info] UE switches to state [CM-CONNECTED]
[2022-02-07 08:24:10.988] [nas] [debug] Authentication Request received
[2022-02-07 08:24:11.001] [nas] [debug] Security Mode Command received
[2022-02-07 08:24:11.002] [nas] [debug] Selected integrity[2] ciphering[0]
[2022-02-07 08:24:11.103] [nas] [debug] Registration accept received
[2022-02-07 08:24:11.103] [nas] [info] UE switches to state [MM-REGISTERED/NORMAL-SERVICE]
[2022-02-07 08:24:11.103] [nas] [debug] Sending Registration Complete
[2022-02-07 08:24:11.104] [nas] [info] Initial Registration is successful
[2022-02-07 08:24:11.104] [nas] [debug] Sending PDU Session Establishment Request
[2022-02-07 08:24:11.104] [nas] [debug] UAC access attempt is allowed for identity[0], category[MO_sig]
[2022-02-07 08:24:11.404] [nas] [debug] PDU Session Establishment Accept received
[2022-02-07 08:24:11.413] [nas] [info] PDU Session establishment is successful PSI[1]
[2022-02-07 08:24:11.446] [app] [info] Connection setup for PDU session[1] is successful, TUN interface[uesimtun0, 60.60.0.1] is up.

PDU session is successfulと表示されれば、無事にPDU Session Establishment成功。

7.疎通確認

「ip a」でUEに割り当てられたアドレスを確認。

root@ueran:~# ip a

### 省略 ###

10: uesimtun0: <POINTOPOINT,PROMISC,NOTRAILERS,UP,LOWER_UP> mtu 1400 qdisc fq_codel state UNKNOWN group default qlen 500
    link/none 
    inet 60.60.0.1/32 scope global uesimtun0
       valid_lft forever preferred_lft forever
    inet6 fe80::eec1:f5a2:7ffa:4b70/64 scope link stable-privacy 
       valid_lft forever preferred_lft forever

疎通性も確認。uesimtun0 interfaceからでも疎通性問題なし。

root@ueran:~# ping -I uesimtun0 8.8.8.8
PING 8.8.8.8 (8.8.8.8) from 60.60.0.1 uesimtun0: 56(84) bytes of data.
64 bytes from 8.8.8.8: icmp_seq=1 ttl=61 time=21.1 ms
64 bytes from 8.8.8.8: icmp_seq=2 ttl=61 time=23.9 ms

UPF用VMのpcap上でも確認

h.png

outer-headerのIP src:192.168.100.10はRAN側VM、dst:192.168.100.200はUPF側VM
inner-headerのIP src:60.60.0.1はUE払い出しアドレス、dst:8.8.8.8はping宛先
という感じで、ちゃんとRAN用VMからGTP-UでUPF用に転送され、その後decapされIPでインターネット側に転送されていることが確認できる。

というわけで、無事free5gc + UERANSIMでPDU Session Establishmentを確認することができた。
ゼロから上記手順で二回ほど構築して共に疎通まで確認できたので、基本的に同環境であれば記載している手順通り実施で誰でもPDU Session Establishmentを確認できるはず。

次回の予定はUPF Selection。

1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1