herlesupreeth / docker_open5gs

Docker files to run open5gs + IMS + eNB + gNB + NR-UE in a docker
BSD 2-Clause "Simplified" License
279 stars 156 forks source link

Initial Registration failed [PLMN_NOT_ALLOWED] #295

Open UpadhyeN opened 3 months ago

UpadhyeN commented 3 months ago

Hello, I am deploying standalone 5g network which is running ueransim. I have configured nr-ue.yaml and nr-gnb.yaml and used ./nr-gnb and ./nr-ue to apply that configuration files. There is not issue with gnb but I am facing issue with ue. root@2c971847f054:/UERANSIM/build# ./nr-gnb -c open5gs-gnb.yaml UERANSIM v3.2.6 [2024-03-31 14:56:32.404] [rls-udp] [error] RLS failure [Socket bind failed: Address already in use] [2024-03-31 14:56:32.404] [sctp] [info] Trying to establish SCTP connection... (172.30.0.10:38412) [2024-03-31 14:56:32.404] [gtp] [error] GTP/UDP task could not be created. Socket bind failed: Address already in use [2024-03-31 14:56:32.412] [sctp] [info] SCTP connection established (172.30.0.10:38412) [2024-03-31 14:56:32.412] [sctp] [debug] SCTP association setup ascId[43423] [2024-03-31 14:56:32.412] [ngap] [debug] Sending NG Setup Request [2024-03-31 14:56:32.413] [ngap] [debug] NG Setup Response received [2024-03-31 14:56:32.413] [ngap] [info] NG Setup procedure is successful [2024-03-31 14:59:23.702] [rrc] [debug] UE[1] new signal detected [2024-03-31 14:59:23.703] [rrc] [info] RRC Setup for UE[1] [2024-03-31 14:59:23.704] [ngap] [debug] Initial NAS message received from UE[1] [2024-03-31 14:59:23.709] [ngap] [debug] UE Context Release Command received [2024-03-31 14:59:23.709] [rrc] [info] Releasing RRC connection for UE[1] [2024-03-31 14:59:24.710] [rrc] [debug] UE[2] new signal detected [2024-03-31 14:59:26.313] [rls] [debug] UE[1] signal lost ################################################ root@fb009dd0602a:/UERANSIM/build# ./nr-ue -c open5gs-ue.yml UERANSIM v3.2.6 [2024-03-31 14:59:23.701] [nas] [info] UE switches to state [MM-DEREGISTERED/PLMN-SEARCH] [2024-03-31 14:59:23.702] [rrc] [debug] New signal detected for cell[1], total [1] cells in coverage [2024-03-31 14:59:23.702] [nas] [info] Selected plmn[001/01] [2024-03-31 14:59:23.702] [rrc] [info] Selected cell plmn[001/01] tac[1] category[SUITABLE] [2024-03-31 14:59:23.702] [nas] [info] UE switches to state [MM-DEREGISTERED/PS] [2024-03-31 14:59:23.703] [nas] [info] UE switches to state [MM-DEREGISTERED/NORMAL-SERVICE] [2024-03-31 14:59:23.703] [nas] [debug] Initial registration required due to [MM-DEREG-NORMAL-SERVICE] [2024-03-31 14:59:23.703] [nas] [debug] UAC access attempt is allowed for identity[0], category[MO_sig] [2024-03-31 14:59:23.703] [nas] [debug] Sending Initial Registration [2024-03-31 14:59:23.703] [nas] [info] UE switches to state [MM-REGISTER-INITIATED] [2024-03-31 14:59:23.703] [rrc] [debug] Sending RRC Setup Request [2024-03-31 14:59:23.703] [rrc] [info] RRC connection established [2024-03-31 14:59:23.704] [rrc] [info] UE switches to state [RRC-CONNECTED] [2024-03-31 14:59:23.704] [nas] [info] UE switches to state [CM-CONNECTED] [2024-03-31 14:59:23.709] [rrc] [debug] RRC Release received [2024-03-31 14:59:23.709] [nas] [error] Initial Registration failed [PLMN_NOT_ALLOWED] [2024-03-31 14:59:23.709] [nas] [info] UE switches to state [5U3-ROAMING-NOT-ALLOWED] [2024-03-31 14:59:23.709] [nas] [info] Performing local release of NAS connection [2024-03-31 14:59:23.709] [nas] [info] UE switches to state [MM-DEREGISTERED/PLMN-SEARCH] [2024-03-31 14:59:23.709] [nas] [info] UE switches to state [CM-IDLE] [2024-03-31 14:59:23.709] [rrc] [info] UE switches to state [RRC-IDLE] [2024-03-31 14:59:29.206] [nas] [info] UE switches to state [MM-DEREGISTERED/NO-CELL-AVAILABLE] can someone tell me what is wrong with my configuration? open5gs-ue.txt UERANSIM_working_open5gs-gnb.txt

herlesupreeth commented 3 months ago

I would recommend to do docker compose -f sa-deploy.yaml down and stop all remaining containers and then deploy again. It looks like you are running multiple containers of ueransim gnb

UpadhyeN commented 2 months ago

Hi, I used following commands. docker-compose -f sa-deploy.yaml up -d docker-compose -f nr-gnb.yaml up -d && docker container attach nr_gnb Then added to configuration file to this container and run the ./nr-gnb -c Then launched the ue container using docker-compose -f nr-ue.yaml up -d && docker container attach nr_ue Added the configuration file and and ran the ./nr-ue -c command.

when I checked the docker ps, it is showing me two containers. one for UE and one for GNB. I also tried running the command in single container but getting the same error. I checked the /open5gs/install/etc/open5gs/amf.yml file in amf container. the mcc and mcc are correct. `logger: file: /open5gs/install/var/log/open5gs/amf.log

sbi: server: no_tls: true client: no_tls: true

global: max: ue: 1024

amf: sbi: server:

herlesupreeth commented 2 months ago

You are getting the following log because you are running multiple instances of the same services and ports are not free. So I would advice not to run in detach mode (-d) rather in multiple terminal tab/windows but before that ensure no services are running by bringing down all containers

[2024-03-31 14:56:32.404] [sctp] [info] Trying to establish SCTP connection... (172.30.0.10:38412) [2024-03-31 14:56:32.404] [gtp] [error] GTP/UDP task could not be created. Socket bind failed: Address already in use

UpadhyeN commented 2 months ago

Hi, I did some changes in the sa-deploy.yaml file and rearranged the ports. I think it kind of worked. but I am not sure. root@35420ca063ec:/UERANSIM/build# ./nr-ue -c open5gs-ue.yaml UERANSIM v3.2.6 [2024-04-05 14:25:48.872] [nas] [info] UE switches to state [MM-DEREGISTERED/PLMN-SEARCH] [2024-04-05 14:25:48.872] [rrc] [debug] New signal detected for cell[1], total [1] cells in coverage [2024-04-05 14:25:48.873] [nas] [info] Selected plmn[001/01] [2024-04-05 14:25:48.873] [rrc] [info] Selected cell plmn[001/01] tac[1] category[SUITABLE] [2024-04-05 14:25:48.873] [nas] [info] UE switches to state [MM-DEREGISTERED/PS] [2024-04-05 14:25:48.873] [nas] [info] UE switches to state [MM-DEREGISTERED/NORMAL-SERVICE] [2024-04-05 14:25:48.873] [nas] [debug] Initial registration required due to [MM-DEREG-NORMAL-SERVICE] [2024-04-05 14:25:48.875] [nas] [debug] UAC access attempt is allowed for identity[0], category[MO_sig] [2024-04-05 14:25:48.875] [nas] [debug] Sending Initial Registration [2024-04-05 14:25:48.875] [nas] [info] UE switches to state [MM-REGISTER-INITIATED] [2024-04-05 14:25:48.875] [rrc] [debug] Sending RRC Setup Request [2024-04-05 14:25:48.876] [rrc] [info] RRC connection established [2024-04-05 14:25:48.876] [rrc] [info] UE switches to state [RRC-CONNECTED] [2024-04-05 14:25:48.876] [nas] [info] UE switches to state [CM-CONNECTED] [2024-04-05 14:26:03.887] [nas] [debug] NAS timer[3510] expired [1] [2024-04-05 14:26:03.887] [nas] [info] UE switches to state [MM-DEREGISTERED/PS] [2024-04-05 14:26:03.887] [nas] [info] UE switches to state [5U2-NOT-UPDATED] [2024-04-05 14:26:03.887] [nas] [info] Performing local release of NAS connection [2024-04-05 14:26:03.887] [nas] [info] UE switches to state [MM-DEREGISTERED/ATTEMPTING-REGISTRATION] [2024-04-05 14:26:03.887] [rrc] [info] UE switches to state [RRC-IDLE] [2024-04-05 14:26:03.887] [nas] [info] UE switches to state [CM-IDLE] [2024-04-05 14:26:13.897] [nas] [debug] NAS timer[3511] expired [1] [2024-04-05 14:26:13.897] [nas] [debug] Initial registration required due to [T3511-EXPIRY-IN-ATT-REG] [2024-04-05 14:26:13.897] [nas] [debug] UAC access attempt is allowed for identity[0], category[MO_sig] [2024-04-05 14:26:13.897] [nas] [debug] Sending Initial Registration [2024-04-05 14:26:13.897] [rrc] [debug] Sending RRC Setup Request [2024-04-05 14:26:13.897] [nas] [info] UE switches to state [MM-REGISTER-INITIATED] [2024-04-05 14:26:13.897] [rrc] [info] RRC connection established [2024-04-05 14:26:13.897] [rrc] [info] UE switches to state [RRC-CONNECTED] [2024-04-05 14:26:13.897] [nas] [info] UE switches to state [CM-CONNECTED]

##################### for gnb I am getting following logs. root@0c700b72fcb0:/UERANSIM/build# ./nr-gnb -c open5gs-gnb.yaml UERANSIM v3.2.6 [2024-04-05 14:25:19.204] [rls-udp] [error] RLS failure [Socket bind failed: Address already in use] [2024-04-05 14:25:19.204] [sctp] [info] Trying to establish SCTP connection... (172.30.0.10:38412) [2024-04-05 14:25:19.204] [gtp] [error] GTP/UDP task could not be created. Socket bind failed: Address already in use [2024-04-05 14:25:19.211] [sctp] [info] SCTP connection established (172.30.0.10:38412) [2024-04-05 14:25:19.211] [sctp] [debug] SCTP association setup ascId[54093] [2024-04-05 14:25:19.211] [ngap] [debug] Sending NG Setup Request [2024-04-05 14:25:19.212] [ngap] [debug] NG Setup Response received [2024-04-05 14:25:19.212] [ngap] [info] NG Setup procedure is successful

I think the issue is solved right? https://gitlab.com/devops_aws3/ueransim_nachiket/-/blob/main/documentation/my-sa-deploy.yaml?ref_type=heads this is my sa-deploy.yaml. I just ensured that different container ports are mapped to port 7777.

herlesupreeth commented 2 months ago

Your issue is still the same

https://gitlab.com/devops_aws3/ueransim_nachiket/-/blob/main/documentation/my-sa-deploy.yaml?ref_type=heads

Cant access this file. Unless its absolutely necessary it is not required to modify sa-deploy.yaml other than what is mentioned in README

UpadhyeN commented 2 months ago
version: '3'
services:
  mongo:
    image: mongo:6.0
    container_name: mongo
    command: --bind_ip 0.0.0.0
    env_file:
      - .env
    volumes:
      - mongodbdata:/data/db
      - mongodbdata:/data/configdb
      - /etc/timezone:/etc/timezone:ro
      - /etc/localtime:/etc/localtime:ro
    expose:
      - "27017/udp"
      - "27017/tcp"
    networks:
      default:
        ipv4_address: ${MONGO_IP}
  webui:
    image: docker_open5gs
    container_name: webui
    depends_on:
      - mongo
    env_file:
      - .env
    environment:
      - COMPONENT_NAME=webui
    volumes:
      - ./webui:/mnt/webui
      - /etc/timezone:/etc/timezone:ro
      - /etc/localtime:/etc/localtime:ro
    expose:
      - "9999/tcp"
    ports:
      - "9999:9999/tcp"
    networks:
      default:
        ipv4_address: ${WEBUI_IP}
  nrf:
    image: docker_open5gs
    container_name: nrf
    env_file:
      - .env
    environment:
      - COMPONENT_NAME=nrf-1
    volumes:
      - ./nrf:/mnt/nrf
      - ./log:/open5gs/install/var/log/open5gs
      - /etc/timezone:/etc/timezone:ro
      - /etc/localtime:/etc/localtime:ro
    expose:
      - "7777/tcp"
    ports:
      - "7777:7777/tcp"  # Unique port mapping
    networks:
      default:
        ipv4_address: ${NRF_IP}
  scp:
    image: docker_open5gs
    container_name: scp
    env_file:
      - .env
    environment:
      - COMPONENT_NAME=scp-1
    volumes:
      - ./scp:/mnt/scp
      - ./log:/open5gs/install/var/log/open5gs
      - /etc/timezone:/etc/timezone:ro
      - /etc/localtime:/etc/localtime:ro
    expose:
      - "7777/tcp"
    ports:
      - "7778:7777/tcp"  # Unique port mapping
    networks:
      default:
        ipv4_address: ${SCP_IP}
  ausf:
    image: docker_open5gs
    depends_on:
      - nrf
      - scp
    container_name: ausf
    env_file:
      - .env
    environment:
      - COMPONENT_NAME=ausf-1
    volumes:
      - ./ausf:/mnt/ausf
      - ./log:/open5gs/install/var/log/open5gs
      - /etc/timezone:/etc/timezone:ro
      - /etc/localtime:/etc/localtime:ro
    expose:
      - "7777/tcp"
    ports:
      - "7779:7777/tcp"  # Unique port mapping
    networks:
      default:
        ipv4_address: ${AUSF_IP}
  udr:
    image: docker_open5gs
    depends_on:
      - nrf
      - scp
      - mongo
    container_name: udr
    env_file:
      - .env
    environment:
      - COMPONENT_NAME=udr-1
    volumes:
      - ./udr:/mnt/udr
      - ./log:/open5gs/install/var/log/open5gs
      - /etc/timezone:/etc/timezone:ro
      - /etc/localtime:/etc/localtime:ro
    expose:
      - "7777/tcp"
    ports:
      - "7780:7777/tcp"  # Unique port mapping
    networks:
      default:
        ipv4_address: ${UDR_IP}
  udm:
    image: docker_open5gs
    depends_on:
      - nrf
      - scp
    container_name: udm
    env_file:
      - .env
    environment:
      - COMPONENT_NAME=udm-1
    volumes:
      - ./udm:/mnt/udm
      - ./log:/open5gs/install/var/log/open5gs
      - /etc/timezone:/etc/timezone:ro
      - /etc/localtime:/etc/localtime:ro
    expose:
      - "7777/tcp"
    ports:
      - "7781:7777/tcp"  # Unique port mapping
    networks:
      default:
        ipv4_address: ${UDM_IP}
  smf:
    image: docker_open5gs
    depends_on:
      - nrf
      - scp
      - amf
    container_name: smf
    env_file:
      - .env
    environment:
      - COMPONENT_NAME=smf-1
      - DEPLOY_MODE=5G
    volumes:
      - ./smf:/mnt/smf
      - ./log:/open5gs/install/var/log/open5gs
      - /etc/timezone:/etc/timezone:ro
      - /etc/localtime:/etc/localtime:ro
    expose:
      - "3868/udp"
      - "3868/tcp"
      - "3868/sctp"
      - "5868/udp"
      - "5868/tcp"
      - "5868/sctp"
      - "8805/udp"
      - "2123/udp"
      - "7777/tcp"
      - "9091/tcp"
    networks:
      default:
        ipv4_address: ${SMF_IP}
  upf:
    image: docker_open5gs
    depends_on:
      - nrf
      - scp
      - smf
    container_name: upf
    env_file:
      - .env
    environment:
      - COMPONENT_NAME=upf-1
    volumes:
      - ./upf:/mnt/upf
      - ./log:/open5gs/install/var/log/open5gs
      - /etc/timezone:/etc/timezone:ro
      - /etc/localtime:/etc/localtime:ro
    expose:
      - "2152/udp"
      - "8805/udp"
      - "9091/tcp"
    ports:
      - "2152:2152/udp"  # Unique port mapping
    cap_add:
      - NET_ADMIN
    privileged: true
    sysctls:
      - net.ipv4.ip_forward=1
    networks:
      default:
        ipv4_address: ${UPF_IP}
  amf:
    image: docker_open5gs
    depends_on:
      - nrf
      - scp
      - ausf
      - udm
      - udr
      - pcf
      - bsf
    container_name: amf
    env_file:
      - .env
    environment:
      - COMPONENT_NAME=amf-1
    volumes:
      - ./amf:/mnt/amf
      - ./log:/open5gs/install/var/log/open5gs
      - /etc/timezone:/etc/timezone:ro
      - /etc/localtime:/etc/localtime:ro
    expose:
      - "38412/sctp"
      - "7777/tcp"
      - "9091/tcp"
    networks:
      default:
        ipv4_address: ${AMF_IP}
  pcf:
    image: docker_open5gs
    depends_on:
      - nrf
      - scp
      - mongo
    container_name: pcf
    env_file:
      - .env
    environment:
      - COMPONENT_NAME=pcf-1
    volumes:
      - ./pcf:/mnt/pcf
      - ./log:/open5gs/install/var/log/open5gs
      - /etc/timezone:/etc/timezone:ro
      - /etc/localtime:/etc/localtime:ro
    expose:
      - "7777/tcp"
      - "9091/tcp"
    networks:
      default:
        ipv4_address: ${PCF_IP}
  bsf:
    image: docker_open5gs
    depends_on:
      - nrf
      - scp
      - mongo
    container_name: bsf
    env_file:
      - .env
    environment:
      - COMPONENT_NAME=bsf-1
    volumes:
      - ./bsf:/mnt/bsf
      - ./log:/open5gs/install/var/log/open5gs
      - /etc/timezone:/etc/timezone:ro
      - /etc/localtime:/etc/localtime:ro
    expose:
      - "7777/tcp"
    networks:
      default:
        ipv4_address: ${BSF_IP}
  nssf:
    image: docker_open5gs
    depends_on:
      - nrf
      - scp
      - mongo
    container_name: nssf
    env_file:
      - .env
    environment:
      - COMPONENT_NAME=nssf-1
    volumes:
      - ./nssf:/mnt/nssf
      - ./log:/open5gs/install/var/log/open5gs
      - /etc/timezone:/etc/timezone:ro
      - /etc/localtime:/etc/localtime:ro
    expose:
      - "7777/tcp"
    networks:
      default:
        ipv4_address: ${NSSF_IP}
  metrics:
    build: ./metrics
    image: docker_metrics
    container_name: metrics
    env_file:
      - .env
    volumes:
      - ./metrics:/mnt/metrics
      - /etc/timezone:/etc/timezone:ro
      - /etc/localtime:/etc/localtime:ro
    expose:
      - "9090/tcp"
    ports:
      - "9090:9090/tcp"
    networks:
      default:
        ipv4_address: ${METRICS_IP}
networks:
  default:
    ipam:
      config:
        - subnet: ${TEST_NETWORK}
volumes:
  mongodbdata: {}

This is the file. So in this case I just changed the ports of containers which are exposed to port 7777. I will run a single container in two different terminal and check again.

herlesupreeth commented 2 months ago

May I know why you are publishing the ports and also changing the ports? This is usually not required

UpadhyeN commented 1 month ago

This is one of the suggestion I got from online. Also I have made some changes in the .env file because there were some subnet overlapping. What I should do?

herlesupreeth commented 1 month ago

I would suggest to not to do any chance other than what is mentioned in README.

UpadhyeN commented 1 month ago

Hi, I made some progress. Right now I am getting the authentication error. [2024-05-19 19:46:32.666] [nas] [error] Network failing the authentication check [2024-05-19 19:46:32.666] [nas] [info] Performing local release of NAS connection [2024-05-19 19:46:32.666] [rrc] [info] UE switches to state [RRC-IDLE] [2024-05-19 19:46:32.666] [nas] [info] UE switches to state [CM-IDLE] [2024-05-19 19:46:32.666] [nas] [info] UE switches to state [MM-DEREGISTERED/PS] [2024-05-19 19:46:32.666] [nas] [info] UE switches to state [MM-DEREGISTERED/ATTEMPTING-REGISTRATION]

I have also rebuild each containers, and followed each step without changing anything. I also checked authentication issue I found that I should check the security parameters in UE as well as in AUSF. The value is explicitly mentioned in the UE but not in AUSF. https://github.com/aligungr/UERANSIM/issues/475 This solution suggest that the sim_algo should be milenage. Based on the OP value, Copilot is suggesting that it is indeed using milenage from AUSF side as well. What else I can try?

herlesupreeth commented 1 month ago

If you are getting authentication error I would look at whether you provisioned the Ki, OP/Opc value correctly in open5gs WebUI or not. NOTE: Choose correctly whether you are using OP/OPc in open5gs WebUI as they are two different things