├── images └── network-overview.png └── README.md /images/network-overview.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/s5uishida/open5gs_5gc_ueransim_snssai_upf_sample_config/HEAD/images/network-overview.png -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Open5GS 5GC & UERANSIM UE / RAN Sample Configuration - Select UPF based on S-NSSAI 2 | This describes a very simple configuration that uses Open5GS and UERANSIM to select the UPF based on S-NSSAI. 3 | 4 | --- 5 | 6 | ### [Sample Configurations and Miscellaneous for Mobile Network](https://github.com/s5uishida/sample_config_misc_for_mobile_network) 7 | 8 | --- 9 | 10 | 11 | 12 | ## Table of Contents 13 | 14 | - [Overview of Open5GS 5GC Simulation Mobile Network](#overview) 15 | - [Changes in configuration files of Open5GS 5GC and UERANSIM UE / RAN](#changes) 16 | - [Changes in configuration files of Open5GS 5GC C-Plane](#changes_cp) 17 | - [Changes in configuration files of Open5GS 5GC U-Plane1](#changes_up1) 18 | - [Changes in configuration files of Open5GS 5GC U-Plane2](#changes_up2) 19 | - [Changes in configuration files of UERANSIM UE / RAN](#changes_ueransim) 20 | - [Changes in configuration files of RAN (gNodeB)](#changes_ran) 21 | - [Changes in configuration files of UE[SST:1, SD:0x000001] (IMSI-001010000000000)](#changes_ue_sd1) 22 | - [Changes in configuration files of UE[SST:1, SD:0x000002] (IMSI-001010000000000)](#changes_ue_sd2) 23 | - [Network settings of Open5GS 5GC and UERANSIM UE / RAN](#network_settings) 24 | - [Network settings of Open5GS 5GC C-Plane](#network_settings_cp) 25 | - [Network settings of Open5GS 5GC U-Plane1](#network_settings_up1) 26 | - [Network settings of Open5GS 5GC U-Plane2](#network_settings_up2) 27 | - [Build Open5GS and UERANSIM](#build) 28 | - [Run Open5GS 5GC and UERANSIM UE / RAN](#run) 29 | - [Run Open5GS 5GC C-Plane](#run_cp) 30 | - [Run Open5GS 5GC U-Plane1 & U-Plane2](#run_up) 31 | - [Run UERANSIM (gNodeB)](#run_ran) 32 | - [Run UERANSIM (UE[SST:1, SD:0x000001])](#run_sd1) 33 | - [UE connects to U-Plane1 based on SST:1 and SD:0x000001](#con_sd1) 34 | - [Ping google.com going through DN=10.45.0.0/16 on U-Plane1](#ping_sd1) 35 | - [Run UERANSIM (UE[SST:1, SD:0x000002])](#run_sd2) 36 | - [UE connects to U-Plane2 based on SST:1 and SD:0x000002](#con_sd2) 37 | - [Ping google.com going through DN=10.46.0.0/16 on U-Plane2](#ping_sd2) 38 | - [Changelog (summary)](#changelog) 39 | 40 | --- 41 | 42 | 43 | ## Overview of Open5GS 5GC Simulation Mobile Network 44 | 45 | The following minimum configuration was set as a condition. 46 | - The UE selects a pair of SMF and UPF based on S-NSSAI. 47 | 48 | The built simulation environment is as follows. 49 | 50 | 51 | 52 | The 5GC / UE / RAN used are as follows. 53 | - 5GC - Open5GS v2.7.0 (2024.03.24) - https://github.com/open5gs/open5gs 54 | - UE / RAN - UERANSIM v3.2.6 (2024.03.08) - https://github.com/aligungr/UERANSIM 55 | 56 | Each VMs are as follows. 57 | | VM # | SW & Role | IP address | OS | Memory (Min) | HDD (Min) | 58 | | --- | --- | --- | --- | --- | --- | 59 | | VM1 | Open5GS 5GC C-Plane | 192.168.0.111/24
192.168.0.112/24
192.168.0.113/24 | Ubuntu 22.04 | 2GB | 20GB | 60 | | VM2 | Open5GS 5GC U-Plane1 | 192.168.0.114/24 | Ubuntu 22.04 | 1GB | 20GB | 61 | | VM3 | Open5GS 5GC U-Plane2 | 192.168.0.115/24 | Ubuntu 22.04 | 1GB | 20GB | 62 | | VM4 | UERANSIM RAN (gNodeB) | 192.168.0.131/24 | Ubuntu 22.04 | 1GB | 10GB | 63 | | VM5 | UERANSIM UE | 192.168.0.132/24 | Ubuntu 22.04 | 1GB | 10GB | 64 | 65 | AMF & SMF addresses are as follows. 66 | | NF | IP address | IP address on SBI | Supported S-NSSAI | 67 | | --- | --- | --- | --- | 68 | | AMF | 192.168.0.111 | 127.0.0.5 | SST:1, SD:0x000001
SST:1, SD:0x000002 | 69 | | SMF1 | 192.168.0.112 | 127.0.0.4 | SST:1, SD:0x000001 | 70 | | SMF2 | 192.168.0.113 | 127.0.0.24 | SST:1, SD:0x000002 | 71 | 72 | gNodeB Information (other information is default) is as follows. 73 | | IP address | Supported S-NSSAI | 74 | | --- | --- | 75 | | 192.168.0.131 | SST:1, SD:0x000001
SST:1, SD:0x000002 | 76 | 77 | Subscriber Information (other information is default) is as follows. 78 | **Note. Please select OP or OPc according to the setting of UERANSIM UE configuration files.** 79 | | UE | IMSI | DNN | OP/OPc | S-NSSAI | 80 | | --- | --- | --- | --- | --- | 81 | | UE | 001010000000000 | internet | OPc | SST:1, SD:0x000001
SST:1, SD:0x000002| 82 | 83 | I registered these information with the Open5GS WebUI. 84 | In addition, [3GPP TS 35.208](https://www.3gpp.org/DynaReport/35208.htm) "4.3 Test Sets" is published by 3GPP as test data for the 3GPP authentication and key generation functions (MILENAGE). 85 | 86 | Each DNs are as follows. 87 | | DN | S-NSSAI | TUNnel interface of DN | DNN | TUNnel interface of UE | U-Plane # | 88 | | --- | --- | --- | --- | --- | --- | 89 | | 10.45.0.0/16 | SST:1
SD:0x000001 | ogstun | internet | uesimtun0 | U-Plane1 | 90 | | 10.46.0.0/16 | SST:1
SD:0x000002 | ogstun | internet | uesimtun0 | U-Plane2 | 91 | 92 | 93 | 94 | ## Changes in configuration files of Open5GS 5GC and UERANSIM UE / RAN 95 | 96 | Please refer to the following for building Open5GS and UERANSIM respectively. 97 | - Open5GS v2.7.0 (2024.03.24) - https://open5gs.org/open5gs/docs/guide/02-building-open5gs-from-sources/ 98 | - UERANSIM v3.2.6 (2024.03.08) - https://github.com/aligungr/UERANSIM/wiki/Installation 99 | 100 | 101 | 102 | ### Changes in configuration files of Open5GS 5GC C-Plane 103 | 104 | - `open5gs/install/etc/open5gs/amf.yaml` 105 | ```diff 106 | --- amf.yaml.orig 2024-03-24 15:36:48.000000000 +0900 107 | +++ amf.yaml 2024-03-25 19:49:01.896848576 +0900 108 | @@ -19,29 +19,32 @@ 109 | - uri: http://127.0.0.200:7777 110 | ngap: 111 | server: 112 | - - address: 127.0.0.5 113 | + - address: 192.168.0.111 114 | metrics: 115 | server: 116 | - address: 127.0.0.5 117 | port: 9090 118 | guami: 119 | - plmn_id: 120 | - mcc: 999 121 | - mnc: 70 122 | + mcc: 001 123 | + mnc: 01 124 | amf_id: 125 | region: 2 126 | set: 1 127 | tai: 128 | - plmn_id: 129 | - mcc: 999 130 | - mnc: 70 131 | + mcc: 001 132 | + mnc: 01 133 | tac: 1 134 | plmn_support: 135 | - plmn_id: 136 | - mcc: 999 137 | - mnc: 70 138 | + mcc: 001 139 | + mnc: 01 140 | s_nssai: 141 | - sst: 1 142 | + sd: 000001 143 | + - sst: 1 144 | + sd: 000002 145 | security: 146 | integrity_order : [ NIA2, NIA1, NIA0 ] 147 | ciphering_order : [ NEA0, NEA1, NEA2 ] 148 | ``` 149 | - `open5gs/install/etc/open5gs/nrf.yaml` 150 | ```diff 151 | --- nrf.yaml.orig 2024-03-24 15:36:48.000000000 +0900 152 | +++ nrf.yaml 2024-03-25 19:46:56.184797762 +0900 153 | @@ -10,8 +10,8 @@ 154 | nrf: 155 | serving: # 5G roaming requires PLMN in NRF 156 | - plmn_id: 157 | - mcc: 999 158 | - mnc: 70 159 | + mcc: 001 160 | + mnc: 01 161 | sbi: 162 | server: 163 | - address: 127.0.0.10 164 | ``` 165 | - `open5gs/install/etc/open5gs/nssf.yaml` 166 | ```diff 167 | --- nssf.yaml.orig 2024-03-24 15:36:48.000000000 +0900 168 | +++ nssf.yaml 2024-03-25 19:53:57.788260085 +0900 169 | @@ -21,6 +21,11 @@ 170 | - uri: http://127.0.0.10:7777 171 | s_nssai: 172 | sst: 1 173 | + sd: 000001 174 | + - uri: http://127.0.0.10:7777 175 | + s_nssai: 176 | + sst: 1 177 | + sd: 000002 178 | ################################################################################ 179 | # SBI Server 180 | ################################################################################ 181 | ``` 182 | - `open5gs/install/etc/open5gs/smf1.yaml` 183 | ```diff 184 | --- smf.yaml.orig 2024-03-24 15:36:48.000000000 +0900 185 | +++ smf1.yaml 2024-03-31 22:50:41.758088024 +0900 186 | @@ -1,5 +1,5 @@ 187 | logger: 188 | - file: /root/open5gs/install/var/log/open5gs/smf.log 189 | + file: /root/open5gs/install/var/log/open5gs/smf1.log 190 | # level: info # fatal|error|warn|info(default)|debug|trace 191 | 192 | global: 193 | @@ -19,35 +19,42 @@ 194 | - uri: http://127.0.0.200:7777 195 | pfcp: 196 | server: 197 | - - address: 127.0.0.4 198 | + - address: 192.168.0.112 199 | client: 200 | upf: 201 | - - address: 127.0.0.7 202 | - gtpc: 203 | - server: 204 | - - address: 127.0.0.4 205 | + - address: 192.168.0.114 206 | + dnn: internet 207 | gtpu: 208 | server: 209 | - - address: 127.0.0.4 210 | + - address: 192.168.0.112 211 | metrics: 212 | server: 213 | - address: 127.0.0.4 214 | port: 9090 215 | session: 216 | - subnet: 10.45.0.1/16 217 | - - subnet: 2001:db8:cafe::1/48 218 | + dnn: internet 219 | dns: 220 | - 8.8.8.8 221 | - 8.8.4.4 222 | - - 2001:4860:4860::8888 223 | - - 2001:4860:4860::8844 224 | mtu: 1400 225 | # p-cscf: 226 | # - 127.0.0.1 227 | # - ::1 228 | # ctf: 229 | # enabled: auto # auto(default)|yes|no 230 | - freeDiameter: /root/open5gs/install/etc/freeDiameter/smf.conf 231 | +# freeDiameter: /root/open5gs/install/etc/freeDiameter/smf.conf 232 | + info: 233 | + - s_nssai: 234 | + - sst: 1 235 | + sd: 000001 236 | + dnn: 237 | + - internet 238 | + tai: 239 | + - plmn_id: 240 | + mcc: 001 241 | + mnc: 01 242 | + tac: 1 243 | 244 | ################################################################################ 245 | # SMF Info 246 | ``` 247 | - `open5gs/install/etc/open5gs/smf2.yaml` 248 | ```diff 249 | --- smf.yaml.orig 2024-03-24 15:36:48.000000000 +0900 250 | +++ smf2.yaml 2024-03-31 22:50:49.806176520 +0900 251 | @@ -1,5 +1,5 @@ 252 | logger: 253 | - file: /root/open5gs/install/var/log/open5gs/smf.log 254 | + file: /root/open5gs/install/var/log/open5gs/smf2.log 255 | # level: info # fatal|error|warn|info(default)|debug|trace 256 | 257 | global: 258 | @@ -10,7 +10,7 @@ 259 | smf: 260 | sbi: 261 | server: 262 | - - address: 127.0.0.4 263 | + - address: 127.0.0.24 264 | port: 7777 265 | client: 266 | # nrf: 267 | @@ -19,35 +19,42 @@ 268 | - uri: http://127.0.0.200:7777 269 | pfcp: 270 | server: 271 | - - address: 127.0.0.4 272 | + - address: 192.168.0.113 273 | client: 274 | upf: 275 | - - address: 127.0.0.7 276 | - gtpc: 277 | - server: 278 | - - address: 127.0.0.4 279 | + - address: 192.168.0.115 280 | + dnn: internet 281 | gtpu: 282 | server: 283 | - - address: 127.0.0.4 284 | + - address: 192.168.0.113 285 | metrics: 286 | server: 287 | - - address: 127.0.0.4 288 | + - address: 127.0.0.24 289 | port: 9090 290 | session: 291 | - - subnet: 10.45.0.1/16 292 | - - subnet: 2001:db8:cafe::1/48 293 | + - subnet: 10.46.0.1/16 294 | + dnn: internet 295 | dns: 296 | - 8.8.8.8 297 | - 8.8.4.4 298 | - - 2001:4860:4860::8888 299 | - - 2001:4860:4860::8844 300 | mtu: 1400 301 | # p-cscf: 302 | # - 127.0.0.1 303 | # - ::1 304 | # ctf: 305 | # enabled: auto # auto(default)|yes|no 306 | - freeDiameter: /root/open5gs/install/etc/freeDiameter/smf.conf 307 | +# freeDiameter: /root/open5gs/install/etc/freeDiameter/smf.conf 308 | + info: 309 | + - s_nssai: 310 | + - sst: 1 311 | + sd: 000002 312 | + dnn: 313 | + - internet 314 | + tai: 315 | + - plmn_id: 316 | + mcc: 001 317 | + mnc: 01 318 | + tac: 1 319 | 320 | ################################################################################ 321 | # SMF Info 322 | ``` 323 | 324 | 325 | 326 | ### Changes in configuration files of Open5GS 5GC U-Plane1 327 | 328 | - `open5gs/install/etc/open5gs/upf.yaml` 329 | ```diff 330 | --- upf.yaml.orig 2024-03-24 15:36:48.000000000 +0900 331 | +++ upf.yaml 2024-03-25 20:16:20.324142755 +0900 332 | @@ -10,16 +10,17 @@ 333 | upf: 334 | pfcp: 335 | server: 336 | - - address: 127.0.0.7 337 | + - address: 192.168.0.114 338 | client: 339 | # smf: # UPF PFCP Client try to associate SMF PFCP Server 340 | # - address: 127.0.0.4 341 | gtpu: 342 | server: 343 | - - address: 127.0.0.7 344 | + - address: 192.168.0.114 345 | session: 346 | - subnet: 10.45.0.1/16 347 | - - subnet: 2001:db8:cafe::1/48 348 | + dnn: internet 349 | + dev: ogstun 350 | metrics: 351 | server: 352 | - address: 127.0.0.7 353 | ``` 354 | 355 | 356 | 357 | ### Changes in configuration files of Open5GS 5GC U-Plane2 358 | 359 | - `open5gs/install/etc/open5gs/upf.yaml` 360 | ```diff 361 | --- upf.yaml.orig 2024-03-24 15:36:48.000000000 +0900 362 | +++ upf.yaml 2024-03-25 20:18:50.813311682 +0900 363 | @@ -10,16 +10,17 @@ 364 | upf: 365 | pfcp: 366 | server: 367 | - - address: 127.0.0.7 368 | + - address: 192.168.0.115 369 | client: 370 | # smf: # UPF PFCP Client try to associate SMF PFCP Server 371 | # - address: 127.0.0.4 372 | gtpu: 373 | server: 374 | - - address: 127.0.0.7 375 | + - address: 192.168.0.115 376 | session: 377 | - - subnet: 10.45.0.1/16 378 | - - subnet: 2001:db8:cafe::1/48 379 | + - subnet: 10.46.0.1/16 380 | + dnn: internet 381 | + dev: ogstun 382 | metrics: 383 | server: 384 | - address: 127.0.0.7 385 | ``` 386 | 387 | 388 | 389 | ### Changes in configuration files of UERANSIM UE / RAN 390 | 391 | 392 | 393 | #### Changes in configuration files of RAN (gNodeB) 394 | 395 | - `UERANSIM/config/open5gs-gnb.yaml` 396 | ```diff 397 | --- open5gs-gnb.yaml.orig 2022-07-03 13:06:43.000000000 +0900 398 | +++ open5gs-gnb.yaml 2023-01-12 23:39:36.000000000 +0900 399 | @@ -1,22 +1,25 @@ 400 | -mcc: '999' # Mobile Country Code value 401 | -mnc: '70' # Mobile Network Code value (2 or 3 digits) 402 | +mcc: '001' # Mobile Country Code value 403 | +mnc: '01' # Mobile Network Code value (2 or 3 digits) 404 | 405 | nci: '0x000000010' # NR Cell Identity (36-bit) 406 | idLength: 32 # NR gNB ID length in bits [22...32] 407 | tac: 1 # Tracking Area Code 408 | 409 | -linkIp: 127.0.0.1 # gNB's local IP address for Radio Link Simulation (Usually same with local IP) 410 | -ngapIp: 127.0.0.1 # gNB's local IP address for N2 Interface (Usually same with local IP) 411 | -gtpIp: 127.0.0.1 # gNB's local IP address for N3 Interface (Usually same with local IP) 412 | +linkIp: 192.168.0.131 # gNB's local IP address for Radio Link Simulation (Usually same with local IP) 413 | +ngapIp: 192.168.0.131 # gNB's local IP address for N2 Interface (Usually same with local IP) 414 | +gtpIp: 192.168.0.131 # gNB's local IP address for N3 Interface (Usually same with local IP) 415 | 416 | # List of AMF address information 417 | amfConfigs: 418 | - - address: 127.0.0.5 419 | + - address: 192.168.0.111 420 | port: 38412 421 | 422 | # List of supported S-NSSAIs by this gNB 423 | slices: 424 | - sst: 1 425 | + sd: 0x000001 426 | + - sst: 1 427 | + sd: 0x000002 428 | 429 | # Indicates whether or not SCTP stream number errors should be ignored. 430 | ignoreStreamIds: true 431 | ``` 432 | 433 | 434 | 435 | #### Changes in configuration files of UE[SST:1, SD:0x000001] (IMSI-001010000000000) 436 | 437 | - `UERANSIM/config/open5gs-ue-sd1.yaml` 438 | ```diff 439 | --- open5gs-ue.yaml.orig 2023-12-02 06:14:20.000000000 +0900 440 | +++ open5gs-ue-sd1.yaml 2024-03-25 20:40:16.465891137 +0900 441 | @@ -1,9 +1,9 @@ 442 | # IMSI number of the UE. IMSI = [MCC|MNC|MSISDN] (In total 15 digits) 443 | -supi: 'imsi-999700000000001' 444 | +supi: 'imsi-001010000000000' 445 | # Mobile Country Code value of HPLMN 446 | -mcc: '999' 447 | +mcc: '001' 448 | # Mobile Network Code value of HPLMN (2 or 3 digits) 449 | -mnc: '70' 450 | +mnc: '01' 451 | # SUCI Protection Scheme : 0 for Null-scheme, 1 for Profile A and 2 for Profile B 452 | protectionScheme: 0 453 | # Home Network Public Key for protecting with SUCI Profile A 454 | @@ -28,7 +28,7 @@ 455 | 456 | # List of gNB IP addresses for Radio Link Simulation 457 | gnbSearchList: 458 | - - 127.0.0.1 459 | + - 192.168.0.131 460 | 461 | # UAC Access Identities Configuration 462 | uacAic: 463 | @@ -50,15 +50,17 @@ 464 | apn: 'internet' 465 | slice: 466 | sst: 1 467 | + sd: 0x000001 468 | 469 | # Configured NSSAI for this UE by HPLMN 470 | configured-nssai: 471 | - sst: 1 472 | + sd: 0x000001 473 | 474 | # Default Configured NSSAI for this UE 475 | default-nssai: 476 | - sst: 1 477 | - sd: 1 478 | + sd: 0x000001 479 | 480 | # Supported integrity algorithms by this UE 481 | integrity: 482 | ``` 483 | 484 | 485 | 486 | #### Changes in configuration files of UE[SST:1, SD:0x000002] (IMSI-001010000000000) 487 | 488 | - `UERANSIM/config/open5gs-ue-sd2.yaml` 489 | ```diff 490 | --- open5gs-ue.yaml.orig 2023-12-02 06:14:20.000000000 +0900 491 | +++ open5gs-ue-sd2.yaml 2024-03-25 20:41:32.181352946 +0900 492 | @@ -1,9 +1,9 @@ 493 | # IMSI number of the UE. IMSI = [MCC|MNC|MSISDN] (In total 15 digits) 494 | -supi: 'imsi-999700000000001' 495 | +supi: 'imsi-001010000000000' 496 | # Mobile Country Code value of HPLMN 497 | -mcc: '999' 498 | +mcc: '001' 499 | # Mobile Network Code value of HPLMN (2 or 3 digits) 500 | -mnc: '70' 501 | +mnc: '01' 502 | # SUCI Protection Scheme : 0 for Null-scheme, 1 for Profile A and 2 for Profile B 503 | protectionScheme: 0 504 | # Home Network Public Key for protecting with SUCI Profile A 505 | @@ -28,7 +28,7 @@ 506 | 507 | # List of gNB IP addresses for Radio Link Simulation 508 | gnbSearchList: 509 | - - 127.0.0.1 510 | + - 192.168.0.131 511 | 512 | # UAC Access Identities Configuration 513 | uacAic: 514 | @@ -50,15 +50,17 @@ 515 | apn: 'internet' 516 | slice: 517 | sst: 1 518 | + sd: 0x000002 519 | 520 | # Configured NSSAI for this UE by HPLMN 521 | configured-nssai: 522 | - sst: 1 523 | + sd: 0x000002 524 | 525 | # Default Configured NSSAI for this UE 526 | default-nssai: 527 | - sst: 1 528 | - sd: 1 529 | + sd: 0x000002 530 | 531 | # Supported integrity algorithms by this UE 532 | integrity: 533 | ``` 534 | 535 | 536 | 537 | ## Network settings of Open5GS 5GC and UERANSIM UE / RAN 538 | 539 | 540 | 541 | ### Network settings of Open5GS 5GC C-Plane 542 | 543 | Add IP addresses for SMF1 and SMF2. 544 | ``` 545 | ip addr add 192.168.0.112/24 dev enp0s8 546 | ip addr add 192.168.0.113/24 dev enp0s8 547 | ``` 548 | **Note. `enp0s8` is the network interface of `192.168.0.0/24` in my VirtualBox environment. 549 | Please change it according to your environment.** 550 | 551 | 552 | 553 | ### Network settings of Open5GS 5GC U-Plane1 554 | 555 | First, uncomment the next line in the `/etc/sysctl.conf` file and reflect it in the OS. 556 | ``` 557 | net.ipv4.ip_forward=1 558 | ``` 559 | ``` 560 | # sysctl -p 561 | ``` 562 | Next, configure the TUNnel interface and NAPT. 563 | ``` 564 | ip tuntap add name ogstun mode tun 565 | ip addr add 10.45.0.1/16 dev ogstun 566 | ip link set ogstun up 567 | 568 | iptables -t nat -A POSTROUTING -s 10.45.0.0/16 ! -o ogstun -j MASQUERADE 569 | ``` 570 | 571 | 572 | 573 | ### Network settings of Open5GS 5GC U-Plane2 574 | 575 | First, uncomment the next line in the `/etc/sysctl.conf` file and reflect it in the OS. 576 | ``` 577 | net.ipv4.ip_forward=1 578 | ``` 579 | ``` 580 | # sysctl -p 581 | ``` 582 | Next, configure the TUNnel interface and NAPT. 583 | ``` 584 | ip tuntap add name ogstun mode tun 585 | ip addr add 10.46.0.1/16 dev ogstun 586 | ip link set ogstun up 587 | 588 | iptables -t nat -A POSTROUTING -s 10.46.0.0/16 ! -o ogstun -j MASQUERADE 589 | ``` 590 | 591 | 592 | 593 | ## Build Open5GS and UERANSIM 594 | 595 | Please refer to the following for building Open5GS and UERANSIM respectively. 596 | - Open5GS v2.7.0 (2024.03.24) - https://open5gs.org/open5gs/docs/guide/02-building-open5gs-from-sources/ 597 | - UERANSIM v3.2.6 (2024.03.08) - https://github.com/aligungr/UERANSIM/wiki/Installation 598 | 599 | Install MongoDB on Open5GS 5GC C-Plane machine. 600 | It is not necessary to install MongoDB on Open5GS 5GC U-Plane machines. 601 | [MongoDB Compass](https://www.mongodb.com/products/compass) is a convenient tool to look at the MongoDB database. 602 | 603 | 604 | 605 | ## Run Open5GS 5GC and UERANSIM UE / RAN 606 | 607 | First run the 5GC, then UERANSIM (UE & RAN implementation). 608 | 609 | 610 | 611 | ### Run Open5GS 5GC C-Plane 612 | 613 | First, run Open5GS 5GC C-Plane. 614 | 615 | - Open5GS 5GC C-Plane 616 | ``` 617 | ./install/bin/open5gs-nrfd & 618 | sleep 2 619 | ./install/bin/open5gs-scpd & 620 | sleep 2 621 | ./install/bin/open5gs-amfd & 622 | sleep 2 623 | ./install/bin/open5gs-smfd -c install/etc/open5gs/smf1.yaml & 624 | ./install/bin/open5gs-smfd -c install/etc/open5gs/smf2.yaml & 625 | ./install/bin/open5gs-ausfd & 626 | ./install/bin/open5gs-udmd & 627 | ./install/bin/open5gs-udrd & 628 | ./install/bin/open5gs-pcfd & 629 | ./install/bin/open5gs-nssfd & 630 | ./install/bin/open5gs-bsfd & 631 | ``` 632 | 633 | 634 | 635 | ### Run Open5GS 5GC U-Plane1 & U-Plane2 636 | 637 | Next, run Open5GS 5GC U-Plane. 638 | 639 | - Open5GS 5GC U-Plane1 640 | ``` 641 | ./install/bin/open5gs-upfd & 642 | ``` 643 | - Open5GS 5GC U-Plane2 644 | ``` 645 | ./install/bin/open5gs-upfd & 646 | ``` 647 | Then run `tcpdump` on one more terminal for each U-Plane. 648 | - Run `tcpdump` on VM2 (U-Plane1) 649 | ``` 650 | # tcpdump -i ogstun -n 651 | tcpdump: verbose output suppressed, use -v or -vv for full protocol decode 652 | listening on ogstun, link-type RAW (Raw IP), capture size 262144 bytes 653 | ``` 654 | - Run `tcpdump` on VM3 (U-Plane2) 655 | ``` 656 | # tcpdump -i ogstun -n 657 | tcpdump: verbose output suppressed, use -v or -vv for full protocol decode 658 | listening on ogstun, link-type RAW (Raw IP), capture size 262144 bytes 659 | ``` 660 | 661 | 662 | 663 | ### Run UERANSIM (gNodeB) 664 | 665 | Please refer to the following for usage of UERANSIM. 666 | 667 | https://github.com/aligungr/UERANSIM/wiki/Usage 668 | 669 | ``` 670 | # ./nr-gnb -c ../config/open5gs-gnb.yaml 671 | UERANSIM v3.2.6 672 | [2024-03-25 21:36:11.999] [sctp] [info] Trying to establish SCTP connection... (192.168.0.111:38412) 673 | [2024-03-25 21:36:12.011] [sctp] [info] SCTP connection established (192.168.0.111:38412) 674 | [2024-03-25 21:36:12.012] [sctp] [debug] SCTP association setup ascId[8] 675 | [2024-03-25 21:36:12.013] [ngap] [debug] Sending NG Setup Request 676 | [2024-03-25 21:36:12.038] [ngap] [debug] NG Setup Response received 677 | [2024-03-25 21:36:12.038] [ngap] [info] NG Setup procedure is successful 678 | ``` 679 | The Open5GS C-Plane log when executed is as follows. 680 | ``` 681 | 03/25 21:36:12.006: [amf] INFO: gNB-N2 accepted[192.168.0.131]:52087 in ng-path module (../src/amf/ngap-sctp.c:113) 682 | 03/25 21:36:12.006: [amf] INFO: gNB-N2 accepted[192.168.0.131] in master_sm module (../src/amf/amf-sm.c:754) 683 | 03/25 21:36:12.029: [amf] INFO: [Added] Number of gNBs is now 1 (../src/amf/context.c:1236) 684 | 03/25 21:36:12.030: [amf] INFO: gNB-N2[192.168.0.131] max_num_of_ostreams : 10 (../src/amf/amf-sm.c:793) 685 | ``` 686 | 687 | 688 | 689 | ### Run UERANSIM (UE[SST:1, SD:0x000001]) 690 | 691 | Confirm that the packet goes through the DN of U-Plane1 based on SST:1 and SD:0x000001. 692 | 693 | 694 | 695 | #### UE connects to U-Plane1 based on SST:1 and SD:0x000001 696 | 697 | ``` 698 | # ./nr-ue -c ../config/open5gs-ue-sd1.yaml 699 | UERANSIM v3.2.6 700 | [2024-03-25 21:36:48.677] [nas] [info] UE switches to state [MM-DEREGISTERED/PLMN-SEARCH] 701 | [2024-03-25 21:36:48.678] [rrc] [debug] New signal detected for cell[1], total [1] cells in coverage 702 | [2024-03-25 21:36:48.679] [nas] [info] Selected plmn[001/01] 703 | [2024-03-25 21:36:48.679] [rrc] [info] Selected cell plmn[001/01] tac[1] category[SUITABLE] 704 | [2024-03-25 21:36:48.680] [nas] [info] UE switches to state [MM-DEREGISTERED/PS] 705 | [2024-03-25 21:36:48.681] [nas] [info] UE switches to state [MM-DEREGISTERED/NORMAL-SERVICE] 706 | [2024-03-25 21:36:48.681] [nas] [debug] Initial registration required due to [MM-DEREG-NORMAL-SERVICE] 707 | [2024-03-25 21:36:48.684] [nas] [debug] UAC access attempt is allowed for identity[0], category[MO_sig] 708 | [2024-03-25 21:36:48.685] [nas] [debug] Sending Initial Registration 709 | [2024-03-25 21:36:48.685] [rrc] [debug] Sending RRC Setup Request 710 | [2024-03-25 21:36:48.686] [nas] [info] UE switches to state [MM-REGISTER-INITIATED] 711 | [2024-03-25 21:36:48.687] [rrc] [info] RRC connection established 712 | [2024-03-25 21:36:48.687] [rrc] [info] UE switches to state [RRC-CONNECTED] 713 | [2024-03-25 21:36:48.688] [nas] [info] UE switches to state [CM-CONNECTED] 714 | [2024-03-25 21:36:48.714] [nas] [debug] Authentication Request received 715 | [2024-03-25 21:36:48.715] [nas] [debug] Received SQN [000000000181] 716 | [2024-03-25 21:36:48.715] [nas] [debug] SQN-MS [000000000000] 717 | [2024-03-25 21:36:48.731] [nas] [debug] Security Mode Command received 718 | [2024-03-25 21:36:48.732] [nas] [debug] Selected integrity[2] ciphering[0] 719 | [2024-03-25 21:36:48.776] [nas] [debug] Registration accept received 720 | [2024-03-25 21:36:48.777] [nas] [info] UE switches to state [MM-REGISTERED/NORMAL-SERVICE] 721 | [2024-03-25 21:36:48.777] [nas] [debug] Sending Registration Complete 722 | [2024-03-25 21:36:48.778] [nas] [info] Initial Registration is successful 723 | [2024-03-25 21:36:48.778] [nas] [debug] Sending PDU Session Establishment Request 724 | [2024-03-25 21:36:48.778] [nas] [debug] UAC access attempt is allowed for identity[0], category[MO_sig] 725 | [2024-03-25 21:36:48.986] [nas] [debug] Configuration Update Command received 726 | [2024-03-25 21:36:49.041] [nas] [debug] PDU Session Establishment Accept received 727 | [2024-03-25 21:36:49.047] [nas] [info] PDU Session establishment is successful PSI[1] 728 | [2024-03-25 21:36:49.091] [app] [info] Connection setup for PDU session[1] is successful, TUN interface[uesimtun0, 10.45.0.2] is up. 729 | ``` 730 | The Open5GS C-Plane log when executed is as follows. 731 | ``` 732 | 03/25 21:36:48.679: [amf] INFO: InitialUEMessage (../src/amf/ngap-handler.c:401) 733 | 03/25 21:36:48.679: [amf] INFO: [Added] Number of gNB-UEs is now 1 (../src/amf/context.c:2656) 734 | 03/25 21:36:48.679: [amf] INFO: RAN_UE_NGAP_ID[1] AMF_UE_NGAP_ID[1] TAC[1] CellID[0x10] (../src/amf/ngap-handler.c:562) 735 | 03/25 21:36:48.680: [amf] INFO: [suci-0-001-01-0000-0-0-0000000000] Unknown UE by SUCI (../src/amf/context.c:1840) 736 | 03/25 21:36:48.680: [amf] INFO: [Added] Number of AMF-UEs is now 1 (../src/amf/context.c:1621) 737 | 03/25 21:36:48.680: [gmm] INFO: Registration request (../src/amf/gmm-sm.c:1224) 738 | 03/25 21:36:48.680: [gmm] INFO: [suci-0-001-01-0000-0-0-0000000000] SUCI (../src/amf/gmm-handler.c:172) 739 | 03/25 21:36:48.687: [sbi] WARNING: [UDM] (NRF-discover) NF has already been added [41918884-eaa4-41ee-ac2d-15ec8e524490:1] (../lib/sbi/nnrf-handler.c:1162) 740 | 03/25 21:36:48.687: [sbi] WARNING: NF EndPoint(addr) updated [127.0.0.12:80] (../lib/sbi/context.c:2210) 741 | 03/25 21:36:48.688: [sbi] WARNING: NF EndPoint(addr) updated [127.0.0.12:7777] (../lib/sbi/context.c:1946) 742 | 03/25 21:36:48.689: [sbi] WARNING: NF EndPoint(addr) updated [127.0.0.12:7777] (../lib/sbi/context.c:1946) 743 | 03/25 21:36:48.689: [sbi] WARNING: NF EndPoint(addr) updated [127.0.0.12:7777] (../lib/sbi/context.c:1946) 744 | 03/25 21:36:48.690: [sbi] INFO: [UDM] (NF-discover) NF Profile updated [41918884-eaa4-41ee-ac2d-15ec8e524490:1] (../lib/sbi/nnrf-handler.c:1200) 745 | 03/25 21:36:48.700: [sbi] INFO: [UDM] (SCP-discover) NF registered [41918884-eaa4-41ee-ac2d-15ec8e524490:1] (../lib/sbi/path.c:211) 746 | 03/25 21:36:48.756: [sbi] WARNING: [UDR] (NRF-discover) NF has already been added [4199dfa2-eaa4-41ee-92fa-a9d99a609a0f:1] (../lib/sbi/nnrf-handler.c:1162) 747 | 03/25 21:36:48.757: [sbi] WARNING: NF EndPoint(addr) updated [127.0.0.20:80] (../lib/sbi/context.c:2210) 748 | 03/25 21:36:48.758: [sbi] WARNING: NF EndPoint(addr) updated [127.0.0.20:7777] (../lib/sbi/context.c:1946) 749 | 03/25 21:36:48.758: [sbi] INFO: [UDR] (NF-discover) NF Profile updated [4199dfa2-eaa4-41ee-92fa-a9d99a609a0f:1] (../lib/sbi/nnrf-handler.c:1200) 750 | 03/25 21:36:48.761: [sbi] INFO: [UDR] (SCP-discover) NF registered [4199dfa2-eaa4-41ee-92fa-a9d99a609a0f:1] (../lib/sbi/path.c:211) 751 | 03/25 21:36:48.973: [gmm] INFO: [imsi-001010000000000] Registration complete (../src/amf/gmm-sm.c:2321) 752 | 03/25 21:36:48.973: [amf] INFO: [imsi-001010000000000] Configuration update command (../src/amf/nas-path.c:591) 753 | 03/25 21:36:48.974: [gmm] INFO: UTC [2024-03-25T12:36:48] Timezone[0]/DST[0] (../src/amf/gmm-build.c:558) 754 | 03/25 21:36:48.974: [gmm] INFO: LOCAL [2024-03-25T21:36:48] Timezone[32400]/DST[0] (../src/amf/gmm-build.c:563) 755 | 03/25 21:36:48.975: [amf] INFO: [Added] Number of AMF-Sessions is now 1 (../src/amf/context.c:2677) 756 | 03/25 21:36:48.976: [gmm] INFO: UE SUPI[imsi-001010000000000] DNN[internet] S_NSSAI[SST:1 SD:0x1] smContextRef [NULL] (../src/amf/gmm-handler.c:1285) 757 | 03/25 21:36:48.976: [gmm] INFO: SMF Instance [41ae89f2-eaa4-41ee-b083-05ab4ba5684f] (../src/amf/gmm-handler.c:1324) 758 | 03/25 21:36:48.980: [smf] INFO: [Added] Number of SMF-UEs is now 1 (../src/smf/context.c:1019) 759 | 03/25 21:36:48.980: [smf] INFO: [Added] Number of SMF-Sessions is now 1 (../src/smf/context.c:3090) 760 | 03/25 21:36:48.984: [sbi] WARNING: [UDM] (NRF-discover) NF has already been added [41918884-eaa4-41ee-ac2d-15ec8e524490:1] (../lib/sbi/nnrf-handler.c:1162) 761 | 03/25 21:36:48.984: [sbi] WARNING: NF EndPoint(addr) updated [127.0.0.12:80] (../lib/sbi/context.c:2210) 762 | 03/25 21:36:48.985: [sbi] WARNING: NF EndPoint(addr) updated [127.0.0.12:7777] (../lib/sbi/context.c:1946) 763 | 03/25 21:36:48.985: [sbi] WARNING: NF EndPoint(addr) updated [127.0.0.12:7777] (../lib/sbi/context.c:1946) 764 | 03/25 21:36:48.986: [sbi] WARNING: NF EndPoint(addr) updated [127.0.0.12:7777] (../lib/sbi/context.c:1946) 765 | 03/25 21:36:48.986: [sbi] INFO: [UDM] (NF-discover) NF Profile updated [41918884-eaa4-41ee-ac2d-15ec8e524490:1] (../lib/sbi/nnrf-handler.c:1200) 766 | 03/25 21:36:48.992: [sbi] INFO: [UDM] (SCP-discover) NF registered [41918884-eaa4-41ee-ac2d-15ec8e524490:1] (../lib/sbi/path.c:211) 767 | 03/25 21:36:48.996: [sbi] WARNING: [PCF] (NRF-discover) NF has already been added [419a69cc-eaa4-41ee-8a01-d10531f1e6cd:1] (../lib/sbi/nnrf-handler.c:1162) 768 | 03/25 21:36:48.997: [sbi] WARNING: NF EndPoint(addr) updated [127.0.0.13:80] (../lib/sbi/context.c:2210) 769 | 03/25 21:36:48.998: [sbi] WARNING: NF EndPoint(addr) updated [127.0.0.13:7777] (../lib/sbi/context.c:1946) 770 | 03/25 21:36:48.998: [sbi] WARNING: NF EndPoint(addr) updated [127.0.0.13:7777] (../lib/sbi/context.c:1946) 771 | 03/25 21:36:48.998: [sbi] WARNING: NF EndPoint(addr) updated [127.0.0.13:7777] (../lib/sbi/context.c:1946) 772 | 03/25 21:36:48.999: [sbi] INFO: [PCF] (NF-discover) NF Profile updated [419a69cc-eaa4-41ee-8a01-d10531f1e6cd:1] (../lib/sbi/nnrf-handler.c:1200) 773 | 03/25 21:36:49.007: [sbi] WARNING: [UDR] (NRF-discover) NF has already been added [4199dfa2-eaa4-41ee-92fa-a9d99a609a0f:1] (../lib/sbi/nnrf-handler.c:1162) 774 | 03/25 21:36:49.008: [sbi] WARNING: NF EndPoint(addr) updated [127.0.0.20:80] (../lib/sbi/context.c:2210) 775 | 03/25 21:36:49.008: [sbi] WARNING: NF EndPoint(addr) updated [127.0.0.20:7777] (../lib/sbi/context.c:1946) 776 | 03/25 21:36:49.008: [sbi] INFO: [UDR] (NF-discover) NF Profile updated [4199dfa2-eaa4-41ee-92fa-a9d99a609a0f:1] (../lib/sbi/nnrf-handler.c:1200) 777 | 03/25 21:36:49.012: [sbi] WARNING: [UDR] (SCP-discover) NF has already been added [4199dfa2-eaa4-41ee-92fa-a9d99a609a0f:2] (../lib/sbi/path.c:216) 778 | 03/25 21:36:49.014: [sbi] WARNING: [BSF] (NRF-discover) NF has already been added [4190b508-eaa4-41ee-84c2-851c47f6e952:1] (../lib/sbi/nnrf-handler.c:1162) 779 | 03/25 21:36:49.015: [sbi] WARNING: NF EndPoint(addr) updated [127.0.0.15:80] (../lib/sbi/context.c:2210) 780 | 03/25 21:36:49.015: [sbi] WARNING: NF EndPoint(addr) updated [127.0.0.15:7777] (../lib/sbi/context.c:1946) 781 | 03/25 21:36:49.016: [sbi] INFO: [BSF] (NF-discover) NF Profile updated [4190b508-eaa4-41ee-84c2-851c47f6e952:1] (../lib/sbi/nnrf-handler.c:1200) 782 | 03/25 21:36:49.019: [sbi] INFO: [BSF] (SCP-discover) NF registered [4190b508-eaa4-41ee-84c2-851c47f6e952:1] (../lib/sbi/path.c:211) 783 | 03/25 21:36:49.022: [sbi] INFO: [PCF] (SCP-discover) NF registered [419a69cc-eaa4-41ee-8a01-d10531f1e6cd:1] (../lib/sbi/path.c:211) 784 | 03/25 21:36:49.023: [smf] INFO: UE SUPI[imsi-001010000000000] DNN[internet] IPv4[10.45.0.2] IPv6[] (../src/smf/npcf-handler.c:542) 785 | 03/25 21:36:49.025: [gtp] INFO: gtp_connect() [192.168.0.114]:2152 (../lib/gtp/path.c:60) 786 | 03/25 21:36:49.035: [sbi] WARNING: [UDM] (NRF-discover) NF has already been added [41918884-eaa4-41ee-ac2d-15ec8e524490:1] (../lib/sbi/nnrf-handler.c:1162) 787 | 03/25 21:36:49.036: [sbi] WARNING: NF EndPoint(addr) updated [127.0.0.12:80] (../lib/sbi/context.c:2210) 788 | 03/25 21:36:49.036: [sbi] WARNING: NF EndPoint(addr) updated [127.0.0.12:7777] (../lib/sbi/context.c:1946) 789 | 03/25 21:36:49.037: [sbi] WARNING: NF EndPoint(addr) updated [127.0.0.12:7777] (../lib/sbi/context.c:1946) 790 | 03/25 21:36:49.037: [sbi] WARNING: NF EndPoint(addr) updated [127.0.0.12:7777] (../lib/sbi/context.c:1946) 791 | 03/25 21:36:49.037: [sbi] INFO: [UDM] (NF-discover) NF Profile updated [41918884-eaa4-41ee-ac2d-15ec8e524490:1] (../lib/sbi/nnrf-handler.c:1200) 792 | 03/25 21:36:49.041: [sbi] WARNING: [UDM] (SCP-discover) NF has already been added [41918884-eaa4-41ee-ac2d-15ec8e524490:2] (../lib/sbi/path.c:216) 793 | 03/25 21:36:49.042: [amf] INFO: [imsi-001010000000000:1:11][0:0:NULL] /nsmf-pdusession/v1/sm-contexts/{smContextRef}/modify (../src/amf/nsmf-handler.c:867) 794 | ``` 795 | The Open5GS U-Plane1 log when executed is as follows. 796 | ``` 797 | 03/25 21:36:48.947: [upf] INFO: [Added] Number of UPF-Sessions is now 1 (../src/upf/context.c:208) 798 | 03/25 21:36:48.947: [gtp] INFO: gtp_connect() [192.168.0.112]:2152 (../lib/gtp/path.c:60) 799 | 03/25 21:36:48.947: [upf] INFO: UE F-SEID[UP:0x84f CP:0x8eb] APN[internet] PDN-Type[1] IPv4[10.45.0.2] IPv6[] (../src/upf/context.c:485) 800 | 03/25 21:36:48.947: [upf] INFO: UE F-SEID[UP:0x84f CP:0x8eb] APN[internet] PDN-Type[1] IPv4[10.45.0.2] IPv6[] (../src/upf/context.c:485) 801 | 03/25 21:36:48.956: [gtp] INFO: gtp_connect() [192.168.0.131]:2152 (../lib/gtp/path.c:60) 802 | ``` 803 | The TUNnel interface `uesimtun0` is created as follows. 804 | ``` 805 | # ip addr show 806 | ... 807 | 9: uesimtun0: mtu 1400 qdisc fq_codel state UNKNOWN group default qlen 500 808 | link/none 809 | inet 10.45.0.2/32 scope global uesimtun0 810 | valid_lft forever preferred_lft forever 811 | inet6 fe80::2dff:f15d:c28f:b51c/64 scope link stable-privacy 812 | valid_lft forever preferred_lft forever 813 | ... 814 | ``` 815 | 816 | 817 | 818 | #### Ping google.com going through DN=10.45.0.0/16 on U-Plane1 819 | 820 | Confirm by using `tcpdump` that the packet goes through `if=ogstun` on U-Plane1. 821 | ``` 822 | # ping google.com -I uesimtun0 -n 823 | PING google.com (142.250.198.14) from 10.45.0.2 uesimtun0: 56(84) bytes of data. 824 | 64 bytes from 142.250.198.14: icmp_seq=1 ttl=61 time=31.9 ms 825 | 64 bytes from 142.250.198.14: icmp_seq=2 ttl=61 time=16.5 ms 826 | 64 bytes from 142.250.198.14: icmp_seq=3 ttl=61 time=21.3 ms 827 | ``` 828 | The `tcpdump` log on U-Plane1 is as follows. 829 | ``` 830 | 21:38:35.545703 IP 10.45.0.2 > 142.250.198.14: ICMP echo request, id 6, seq 1, length 64 831 | 21:38:35.574278 IP 142.250.198.14 > 10.45.0.2: ICMP echo reply, id 6, seq 1, length 64 832 | 21:38:36.545310 IP 10.45.0.2 > 142.250.198.14: ICMP echo request, id 6, seq 2, length 64 833 | 21:38:36.561089 IP 142.250.198.14 > 10.45.0.2: ICMP echo reply, id 6, seq 2, length 64 834 | 21:38:37.547232 IP 10.45.0.2 > 142.250.198.14: ICMP echo request, id 6, seq 3, length 64 835 | 21:38:37.566185 IP 142.250.198.14 > 10.45.0.2: ICMP echo reply, id 6, seq 3, length 64 836 | ``` 837 | **Note. Make sure the packet does not go through U-Plane2.** 838 | 839 | 840 | 841 | ### Run UERANSIM (UE[SST:1, SD:0x000002]) 842 | 843 | Then the UE disconnects from gNodeB and connects to gNodeB using the configuration file for SST:1 and SD:0x000002. 844 | Confirm that the packet goes through the DN of U-Plane2 based on SST:1 and SD:0x000002. 845 | 846 | 847 | 848 | #### UE connects to U-Plane2 based on SST:1 and SD:0x000002 849 | 850 | ``` 851 | # ./nr-ue -c ../config/open5gs-ue-sd2.yaml 852 | UERANSIM v3.2.6 853 | [2024-03-25 21:39:49.839] [nas] [info] UE switches to state [MM-DEREGISTERED/PLMN-SEARCH] 854 | [2024-03-25 21:39:49.841] [rrc] [debug] New signal detected for cell[1], total [1] cells in coverage 855 | [2024-03-25 21:39:52.024] [nas] [info] Selected plmn[001/01] 856 | [2024-03-25 21:39:52.024] [rrc] [info] Selected cell plmn[001/01] tac[1] category[SUITABLE] 857 | [2024-03-25 21:39:52.025] [nas] [info] UE switches to state [MM-DEREGISTERED/PS] 858 | [2024-03-25 21:39:52.026] [nas] [info] UE switches to state [MM-DEREGISTERED/NORMAL-SERVICE] 859 | [2024-03-25 21:39:52.026] [nas] [debug] Initial registration required due to [MM-DEREG-NORMAL-SERVICE] 860 | [2024-03-25 21:39:52.029] [nas] [debug] UAC access attempt is allowed for identity[0], category[MO_sig] 861 | [2024-03-25 21:39:52.030] [nas] [debug] Sending Initial Registration 862 | [2024-03-25 21:39:52.031] [rrc] [debug] Sending RRC Setup Request 863 | [2024-03-25 21:39:52.031] [nas] [info] UE switches to state [MM-REGISTER-INITIATED] 864 | [2024-03-25 21:39:52.033] [rrc] [info] RRC connection established 865 | [2024-03-25 21:39:52.033] [rrc] [info] UE switches to state [RRC-CONNECTED] 866 | [2024-03-25 21:39:52.034] [nas] [info] UE switches to state [CM-CONNECTED] 867 | [2024-03-25 21:39:52.073] [nas] [debug] Authentication Request received 868 | [2024-03-25 21:39:52.074] [nas] [debug] Received SQN [0000000001A1] 869 | [2024-03-25 21:39:52.075] [nas] [debug] SQN-MS [000000000000] 870 | [2024-03-25 21:39:52.090] [nas] [debug] Security Mode Command received 871 | [2024-03-25 21:39:52.091] [nas] [debug] Selected integrity[2] ciphering[0] 872 | [2024-03-25 21:39:52.125] [nas] [debug] Registration accept received 873 | [2024-03-25 21:39:52.126] [nas] [info] UE switches to state [MM-REGISTERED/NORMAL-SERVICE] 874 | [2024-03-25 21:39:52.126] [nas] [debug] Sending Registration Complete 875 | [2024-03-25 21:39:52.127] [nas] [info] Initial Registration is successful 876 | [2024-03-25 21:39:52.127] [nas] [debug] Sending PDU Session Establishment Request 877 | [2024-03-25 21:39:52.128] [nas] [debug] UAC access attempt is allowed for identity[0], category[MO_sig] 878 | [2024-03-25 21:39:52.331] [nas] [debug] Configuration Update Command received 879 | [2024-03-25 21:39:52.367] [nas] [debug] PDU Session Establishment Accept received 880 | [2024-03-25 21:39:52.372] [nas] [info] PDU Session establishment is successful PSI[1] 881 | [2024-03-25 21:39:52.394] [app] [info] Connection setup for PDU session[1] is successful, TUN interface[uesimtun0, 10.46.0.2] is up. 882 | ``` 883 | The Open5GS C-Plane log when executed is as follows. 884 | ``` 885 | 03/25 21:39:52.025: [amf] INFO: InitialUEMessage (../src/amf/ngap-handler.c:401) 886 | 03/25 21:39:52.025: [amf] INFO: [Added] Number of gNB-UEs is now 2 (../src/amf/context.c:2656) 887 | 03/25 21:39:52.025: [amf] INFO: RAN_UE_NGAP_ID[2] AMF_UE_NGAP_ID[2] TAC[1] CellID[0x10] (../src/amf/ngap-handler.c:562) 888 | 03/25 21:39:52.025: [amf] INFO: [suci-0-001-01-0000-0-0-0000000000] known UE by SUCI (../src/amf/context.c:1838) 889 | 03/25 21:39:52.025: [amf] WARNING: [suci-0-001-01-0000-0-0-0000000000] Holding NG Context (../src/amf/amf-sm.c:965) 890 | 03/25 21:39:52.025: [amf] WARNING: [suci-0-001-01-0000-0-0-0000000000] RAN_UE_NGAP_ID[1] AMF_UE_NGAP_ID[1] (../src/amf/amf-sm.c:965) 891 | 03/25 21:39:52.025: [gmm] INFO: Registration request (../src/amf/gmm-sm.c:1224) 892 | 03/25 21:39:52.025: [gmm] INFO: [suci-0-001-01-0000-0-0-0000000000] SUCI (../src/amf/gmm-handler.c:172) 893 | 03/25 21:39:52.045: [smf] INFO: Removed Session: UE IMSI:[imsi-001010000000000] DNN:[internet:1] IPv4:[10.45.0.2] IPv6:[] (../src/smf/context.c:1677) 894 | 03/25 21:39:52.045: [smf] INFO: [Removed] Number of SMF-Sessions is now 0 (../src/smf/context.c:3098) 895 | 03/25 21:39:52.046: [smf] INFO: [Removed] Number of SMF-UEs is now 0 (../src/smf/context.c:1080) 896 | 03/25 21:39:52.048: [amf] INFO: [imsi-001010000000000:1] Release SM context [204] (../src/amf/amf-sm.c:505) 897 | 03/25 21:39:52.048: [amf] INFO: [imsi-001010000000000:1] Release SM Context [state:31] (../src/amf/nsmf-handler.c:1082) 898 | 03/25 21:39:52.049: [amf] INFO: [Removed] Number of AMF-Sessions is now 0 (../src/amf/context.c:2684) 899 | 03/25 21:39:52.083: [gmm] WARNING: [suci-0-001-01-0000-0-0-0000000000] Clear NG Context (../src/amf/gmm-sm.c:2002) 900 | 03/25 21:39:52.084: [gmm] WARNING: [suci-0-001-01-0000-0-0-0000000000] RAN_UE_NGAP_ID[1] AMF_UE_NGAP_ID[1] (../src/amf/gmm-sm.c:2002) 901 | 03/25 21:39:52.087: [amf] INFO: UE Context Release [Action:1] (../src/amf/ngap-handler.c:1696) 902 | 03/25 21:39:52.087: [amf] INFO: RAN_UE_NGAP_ID[1] AMF_UE_NGAP_ID[1] (../src/amf/ngap-handler.c:1697) 903 | 03/25 21:39:52.088: [amf] INFO: [Removed] Number of gNB-UEs is now 1 (../src/amf/context.c:2663) 904 | 03/25 21:39:52.108: [pcf] WARNING: NF EndPoint(addr) updated [127.0.0.5:7777] (../src/pcf/npcf-handler.c:113) 905 | 03/25 21:39:52.317: [gmm] INFO: [imsi-001010000000000] Registration complete (../src/amf/gmm-sm.c:2321) 906 | 03/25 21:39:52.318: [amf] INFO: [imsi-001010000000000] Configuration update command (../src/amf/nas-path.c:591) 907 | 03/25 21:39:52.318: [gmm] INFO: UTC [2024-03-25T12:39:52] Timezone[0]/DST[0] (../src/amf/gmm-build.c:558) 908 | 03/25 21:39:52.319: [gmm] INFO: LOCAL [2024-03-25T21:39:52] Timezone[32400]/DST[0] (../src/amf/gmm-build.c:563) 909 | 03/25 21:39:52.320: [amf] INFO: [Added] Number of AMF-Sessions is now 1 (../src/amf/context.c:2677) 910 | 03/25 21:39:52.321: [gmm] INFO: UE SUPI[imsi-001010000000000] DNN[internet] S_NSSAI[SST:1 SD:0x2] smContextRef [NULL] (../src/amf/gmm-handler.c:1285) 911 | 03/25 21:39:52.322: [gmm] INFO: SMF Instance [41add958-eaa4-41ee-910e-31d3641cb739] (../src/amf/gmm-handler.c:1324) 912 | 03/25 21:39:52.326: [smf] INFO: [Added] Number of SMF-UEs is now 1 (../src/smf/context.c:1019) 913 | 03/25 21:39:52.327: [smf] INFO: [Added] Number of SMF-Sessions is now 1 (../src/smf/context.c:3090) 914 | 03/25 21:39:52.331: [sbi] WARNING: [UDM] (NRF-discover) NF has already been added [41918884-eaa4-41ee-ac2d-15ec8e524490:1] (../lib/sbi/nnrf-handler.c:1162) 915 | 03/25 21:39:52.332: [sbi] WARNING: NF EndPoint(addr) updated [127.0.0.12:80] (../lib/sbi/context.c:2210) 916 | 03/25 21:39:52.332: [sbi] WARNING: NF EndPoint(addr) updated [127.0.0.12:7777] (../lib/sbi/context.c:1946) 917 | 03/25 21:39:52.333: [sbi] WARNING: NF EndPoint(addr) updated [127.0.0.12:7777] (../lib/sbi/context.c:1946) 918 | 03/25 21:39:52.333: [sbi] WARNING: NF EndPoint(addr) updated [127.0.0.12:7777] (../lib/sbi/context.c:1946) 919 | 03/25 21:39:52.334: [sbi] INFO: [UDM] (NF-discover) NF Profile updated [41918884-eaa4-41ee-ac2d-15ec8e524490:1] (../lib/sbi/nnrf-handler.c:1200) 920 | 03/25 21:39:52.342: [sbi] INFO: [UDM] (SCP-discover) NF registered [41918884-eaa4-41ee-ac2d-15ec8e524490:1] (../lib/sbi/path.c:211) 921 | 03/25 21:39:52.346: [sbi] WARNING: [PCF] (NRF-discover) NF has already been added [419a69cc-eaa4-41ee-8a01-d10531f1e6cd:1] (../lib/sbi/nnrf-handler.c:1162) 922 | 03/25 21:39:52.346: [sbi] WARNING: NF EndPoint(addr) updated [127.0.0.13:80] (../lib/sbi/context.c:2210) 923 | 03/25 21:39:52.346: [sbi] WARNING: NF EndPoint(addr) updated [127.0.0.13:7777] (../lib/sbi/context.c:1946) 924 | 03/25 21:39:52.346: [sbi] WARNING: NF EndPoint(addr) updated [127.0.0.13:7777] (../lib/sbi/context.c:1946) 925 | 03/25 21:39:52.347: [sbi] WARNING: NF EndPoint(addr) updated [127.0.0.13:7777] (../lib/sbi/context.c:1946) 926 | 03/25 21:39:52.347: [sbi] INFO: [PCF] (NF-discover) NF Profile updated [419a69cc-eaa4-41ee-8a01-d10531f1e6cd:1] (../lib/sbi/nnrf-handler.c:1200) 927 | 03/25 21:39:52.348: [sbi] WARNING: [UDR] (NRF-discover) NF has already been added [4199dfa2-eaa4-41ee-92fa-a9d99a609a0f:1] (../lib/sbi/nnrf-handler.c:1162) 928 | 03/25 21:39:52.348: [sbi] WARNING: NF EndPoint(addr) updated [127.0.0.20:80] (../lib/sbi/context.c:2210) 929 | 03/25 21:39:52.349: [sbi] WARNING: NF EndPoint(addr) updated [127.0.0.20:7777] (../lib/sbi/context.c:1946) 930 | 03/25 21:39:52.349: [sbi] INFO: [UDR] (NF-discover) NF Profile updated [4199dfa2-eaa4-41ee-92fa-a9d99a609a0f:1] (../lib/sbi/nnrf-handler.c:1200) 931 | 03/25 21:39:52.350: [sbi] WARNING: [UDR] (SCP-discover) NF has already been added [4199dfa2-eaa4-41ee-92fa-a9d99a609a0f:2] (../lib/sbi/path.c:216) 932 | 03/25 21:39:52.351: [sbi] WARNING: [BSF] (NRF-discover) NF has already been added [4190b508-eaa4-41ee-84c2-851c47f6e952:1] (../lib/sbi/nnrf-handler.c:1162) 933 | 03/25 21:39:52.351: [sbi] WARNING: NF EndPoint(addr) updated [127.0.0.15:80] (../lib/sbi/context.c:2210) 934 | 03/25 21:39:52.351: [sbi] WARNING: NF EndPoint(addr) updated [127.0.0.15:7777] (../lib/sbi/context.c:1946) 935 | 03/25 21:39:52.351: [sbi] INFO: [BSF] (NF-discover) NF Profile updated [4190b508-eaa4-41ee-84c2-851c47f6e952:1] (../lib/sbi/nnrf-handler.c:1200) 936 | 03/25 21:39:52.352: [sbi] WARNING: [BSF] (SCP-discover) NF has already been added [4190b508-eaa4-41ee-84c2-851c47f6e952:1] (../lib/sbi/path.c:216) 937 | 03/25 21:39:52.353: [sbi] INFO: [PCF] (SCP-discover) NF registered [419a69cc-eaa4-41ee-8a01-d10531f1e6cd:1] (../lib/sbi/path.c:211) 938 | 03/25 21:39:52.353: [smf] INFO: UE SUPI[imsi-001010000000000] DNN[internet] IPv4[10.46.0.2] IPv6[] (../src/smf/npcf-handler.c:542) 939 | 03/25 21:39:52.354: [gtp] INFO: gtp_connect() [192.168.0.115]:2152 (../lib/gtp/path.c:60) 940 | 03/25 21:39:52.359: [sbi] WARNING: [UDM] (NRF-discover) NF has already been added [41918884-eaa4-41ee-ac2d-15ec8e524490:1] (../lib/sbi/nnrf-handler.c:1162) 941 | 03/25 21:39:52.359: [sbi] WARNING: NF EndPoint(addr) updated [127.0.0.12:80] (../lib/sbi/context.c:2210) 942 | 03/25 21:39:52.360: [sbi] WARNING: NF EndPoint(addr) updated [127.0.0.12:7777] (../lib/sbi/context.c:1946) 943 | 03/25 21:39:52.360: [sbi] WARNING: NF EndPoint(addr) updated [127.0.0.12:7777] (../lib/sbi/context.c:1946) 944 | 03/25 21:39:52.360: [sbi] WARNING: NF EndPoint(addr) updated [127.0.0.12:7777] (../lib/sbi/context.c:1946) 945 | 03/25 21:39:52.360: [sbi] INFO: [UDM] (NF-discover) NF Profile updated [41918884-eaa4-41ee-ac2d-15ec8e524490:1] (../lib/sbi/nnrf-handler.c:1200) 946 | 03/25 21:39:52.362: [sbi] WARNING: [UDM] (SCP-discover) NF has already been added [41918884-eaa4-41ee-ac2d-15ec8e524490:2] (../lib/sbi/path.c:216) 947 | 03/25 21:39:52.362: [amf] INFO: [imsi-001010000000000:1:11][0:0:NULL] /nsmf-pdusession/v1/sm-contexts/{smContextRef}/modify (../src/amf/nsmf-handler.c:867) 948 | ``` 949 | The Open5GS U-Plane2 log when executed is as follows. 950 | ``` 951 | 03/25 21:39:52.339: [upf] INFO: [Added] Number of UPF-Sessions is now 1 (../src/upf/context.c:208) 952 | 03/25 21:39:52.339: [gtp] INFO: gtp_connect() [192.168.0.113]:2152 (../lib/gtp/path.c:60) 953 | 03/25 21:39:52.339: [upf] INFO: UE F-SEID[UP:0x423 CP:0x2af] APN[internet] PDN-Type[1] IPv4[10.46.0.2] IPv6[] (../src/upf/context.c:485) 954 | 03/25 21:39:52.339: [upf] INFO: UE F-SEID[UP:0x423 CP:0x2af] APN[internet] PDN-Type[1] IPv4[10.46.0.2] IPv6[] (../src/upf/context.c:485) 955 | 03/25 21:39:52.343: [gtp] INFO: gtp_connect() [192.168.0.131]:2152 (../lib/gtp/path.c:60) 956 | ``` 957 | The TUNnel interface `uesimtun0` is created as follows. 958 | ``` 959 | # ip addr show 960 | ... 961 | 10: uesimtun0: mtu 1400 qdisc fq_codel state UNKNOWN group default qlen 500 962 | link/none 963 | inet 10.46.0.2/32 scope global uesimtun0 964 | valid_lft forever preferred_lft forever 965 | inet6 fe80::16be:3525:76dc:4db3/64 scope link stable-privacy 966 | valid_lft forever preferred_lft forever 967 | ... 968 | ``` 969 | 970 | 971 | 972 | #### Ping google.com going through DN=10.46.0.0/16 on U-Plane2 973 | 974 | Confirm by using `tcpdump` that the packet goes through `if=ogstun` on U-Plane2. 975 | ``` 976 | # ping google.com -I uesimtun0 -n 977 | PING google.com (142.250.198.14) from 10.46.0.2 uesimtun0: 56(84) bytes of data. 978 | 64 bytes from 142.250.198.14: icmp_seq=1 ttl=61 time=70.1 ms 979 | 64 bytes from 142.250.198.14: icmp_seq=2 ttl=61 time=38.7 ms 980 | 64 bytes from 142.250.198.14: icmp_seq=3 ttl=61 time=42.2 ms 981 | ``` 982 | The `tcpdump` log on U-Plane2 is as follows. 983 | ``` 984 | 21:42:00.636794 IP 10.46.0.2 > 142.250.198.14: ICMP echo request, id 7, seq 1, length 64 985 | 21:42:00.704277 IP 142.250.198.14 > 10.46.0.2: ICMP echo reply, id 7, seq 1, length 64 986 | 21:42:01.638330 IP 10.46.0.2 > 142.250.198.14: ICMP echo request, id 7, seq 2, length 64 987 | 21:42:01.674356 IP 142.250.198.14 > 10.46.0.2: ICMP echo reply, id 7, seq 2, length 64 988 | 21:42:02.638285 IP 10.46.0.2 > 142.250.198.14: ICMP echo request, id 7, seq 3, length 64 989 | 21:42:02.679587 IP 142.250.198.14 > 10.46.0.2: ICMP echo reply, id 7, seq 3, length 64 990 | ``` 991 | **Note. Make sure the packet does not go through U-Plane1.** 992 | 993 | --- 994 | I was able to confirm the very simple configuration in which one UE connects to the UPF based on S-NSSAI. I would like to thank the excellent developers and all the contributors of Open5GS and UERANSIM. 995 | 996 | 997 | 998 | ## Changelog (summary) 999 | 1000 | - [2024.03.31] [This commit](https://github.com/open5gs/open5gs/commit/e8a3b76af395a9986234b7d339a7a96dc5bb537f) fixed the issue where SMF crashes without `gtpc` section in `smf.yaml`. So deleted the `gtpc` section in `smf.yaml` for 5G use. 1001 | - [2024.03.25] Updated to Open5GS v2.7.0 (2024.03.24). 1002 | - [2023.03.18] Updated to Open5GS v2.6.1 (2023.03.18) and UERANSIM v3.2.6 (2023.03.17). 1003 | - [2023.01.13] Updated to Open5GS v2.5.6. 1004 | - [2022.08.01] Initial release. 1005 | --------------------------------------------------------------------------------