### Start UERANSIM gNB Source: https://github.com/aligungr/ueransim/wiki/Usage Run the gNB using a configuration file. Ensure configurations and setups are completed beforehand. ```bash nr-gnb -c myconfig.yaml ``` -------------------------------- ### Starting and Managing UERANSIM Source: https://context7.com/aligungr/ueransim/llms.txt Instructions on how to start UERANSIM instances for both single and multiple UE scenarios, including command-line overrides and options. ```APIDOC ## Starting UERANSIM ### Start a single UE ```bash ./nr-ue -c ../config/free5gc-ue.yaml ``` ### Start 10 UEs (IMSI auto-incremented) ```bash ./nr-ue -c ../config/free5gc-ue.yaml -n 10 ``` ### Override IMSI from command line ```bash ./nr-ue -c ../config/free5gc-ue.yaml -i imsi-208930000000099 ``` ### Start 5 UEs starting from a specific IMSI ```bash ./nr-ue -c ../config/free5gc-ue.yaml -n 5 -i imsi-208930000000050 ``` ### Start UE without automatic routing configuration ```bash ./nr-ue -c ../config/free5gc-ue.yaml --no-route-config ``` ### Expected output (successful registration and PDU session): ``` [2024-01-01 12:00:00.100] [nas] [info] UE switches to state [MM-REGISTERED/NORMAL-SERVICE] [2024-01-01 12:00:00.150] [nas] [info] PDU Session establishment is successful PSI[1] [2024-01-01 12:00:00.160] [app] [info] Connection setup for PDU session[1] is successful, TUN interface[uesimtun0, 10.60.0.1] is up. ``` ``` -------------------------------- ### Start UERANSIM UE Source: https://github.com/aligungr/ueransim/wiki/Usage Run a UE using a configuration file. This command starts a single UE instance. ```bash nr-ue -c myconfig.yaml ``` -------------------------------- ### Install UERANSIM Dependencies Source: https://github.com/aligungr/ueransim/wiki/Installation Install the necessary development and runtime dependencies for UERANSIM using apt and snap. Ensure you use 'snap install cmake --classic' to get a recent version. ```bash sudo apt install make sudo apt install gcc sudo apt install g++ sudo apt install libsctp-dev lksctp-tools sudo apt install iproute2 sudo snap install cmake --classic ``` -------------------------------- ### Start and Manage UEs with nr-ue Source: https://context7.com/aligungr/ueransim/llms.txt Use the `nr-ue` command to start User Equipment instances. You can specify the number of UEs, override the IMSI, and control routing configuration. ```bash # Start a single UE ./nr-ue -c ../config/free5gc-ue.yaml ``` ```bash # Start 10 UEs (IMSI auto-incremented: ...001, ...002, ..., ...010) ./nr-ue -c ../config/free5gc-ue.yaml -n 10 ``` ```bash # Override IMSI from command line (ignores supi in config) ./nr-ue -c ../config/free5gc-ue.yaml -i imsi-208930000000099 ``` ```bash # Start 5 UEs starting from a specific IMSI ./nr-ue -c ../config/free5gc-ue.yaml -n 5 -i imsi-208930000000050 ``` ```bash # Start UE without automatic routing configuration (TUN still created) ./nr-ue -c ../config/free5gc-ue.yaml --no-route-config ``` -------------------------------- ### Install Dependencies and Build UERANSIM Source: https://context7.com/aligungr/ueransim/llms.txt Installs necessary dependencies on Ubuntu and builds UERANSIM from source. Ensure GCC 9+ and CMake 3.17+ are available. The build process outputs binaries in the `build/` directory. ```bash # Install dependencies sudo apt update && sudo apt upgrade sudo apt install make gcc g++ libsctp-dev lksctp-tools iproute2 sudo snap install cmake --classic # Clone and build git clone https://github.com/aligungr/UERANSIM cd ~/UERANSIM make # or: make -j (parallel, faster) # Output binaries in ~/UERANSIM/build/ # nr-gnb - gNodeB executable # nr-ue - UE executable # nr-cli - CLI management tool # nr-binder - TUN interface binder utility # libdevbnd.so - Dynamic library for nr-binder ``` -------------------------------- ### Start UE with Specific IMSI Source: https://github.com/aligungr/ueransim/wiki/Usage Override the IMSI parameter from the configuration file by providing it on the command line. ```bash nr-ue -c myconfig.yaml -i imsi-286010000000001 ``` -------------------------------- ### Launch `nr-gnb` with Configuration Source: https://context7.com/aligungr/ueransim/llms.txt Launches the `nr-gnb` executable with a specified configuration file. The example shows launching with free5GC and Open5GS configurations, and provides expected output upon successful AMF connection. ```bash # Launch gNB with free5GC config ./nr-gnb -c ../config/free5gc-gnb.yaml # Launch gNB with Open5GS config ./nr-gnb -c ../config/open5gs-gnb.yaml # Expected output (successful AMF connection): # [2024-01-01 12:00:00.000] [ngap] [info] NGAP layer started # [2024-01-01 12:00:00.050] [ngap] [info] NG Setup procedure is successful ``` -------------------------------- ### Start Multiple UERANSIM UEs Source: https://github.com/aligungr/ueransim/wiki/Usage Start multiple UE instances by specifying the count with the -n flag. IMSI numbers are incremented by default. ```bash nr-ue -c myconfig.yaml -n 10 ``` -------------------------------- ### Build UERANSIM Project Source: https://github.com/aligungr/ueransim/wiki/Installation Compile the UERANSIM project after all dependencies are installed. The output binaries will be located in the ~/UERANSIM/build folder. ```bash cd ~/UERANSIM make ``` -------------------------------- ### Start Multiple UEs with Specific IMSI Source: https://github.com/aligungr/ueransim/wiki/Usage Combine the count flag (-n) with the IMSI override flag (-i) to start multiple UEs with a specified starting IMSI. ```bash nr-ue -c myconfig.yaml -n 10 -i imsi-286010000000001 ``` -------------------------------- ### UERANSIM CLI Interactive Shell Commands Source: https://github.com/aligungr/ueransim/wiki/Usage Example of available commands within the interactive CLI shell after connecting to a node. Use 'commands' to list them. ```bash $ commands amf-info | Show some status information about the given AMF amf-list | List all AMFs associated with the gNB info | Show some information about the gNB status | Show some status information about the gNB ue-count | Print the total number of UEs connected the this gNB ue-list | List all UEs associated with the gNB ``` -------------------------------- ### Update and Upgrade System Packages Source: https://github.com/aligungr/ueransim/wiki/Installation Update your system's package repositories and upgrade existing packages before installing new dependencies. ```bash sudo apt update sudo apt upgrade ``` -------------------------------- ### Install Wireshark RLS Dissector Source: https://context7.com/aligungr/ueransim/llms.txt Install the UERANSIM RLS Wireshark dissector by copying the Lua script to the Wireshark plugins directory. This enables Wireshark to parse RLS protocol traffic. ```bash mkdir -p ~/.config/wireshark/plugins cp ~/UERANSIM/tools/rls-wireshark-dissector.lua ~/.config/wireshark/plugins/ ``` -------------------------------- ### Start Satellite gNB Source: https://context7.com/aligungr/ueransim/llms.txt Launch the gNB with a satellite configuration file. The gNB will then include NR-NTN TAI Information in its NGAP location messages. ```bash ./nr-gnb -c ../config/satellite-gnb.yaml ``` -------------------------------- ### Run gNB and UE with Open5GS Configuration Source: https://github.com/aligungr/ueransim/wiki/Configuration Execute the gNB and UE with specific configuration files from the config directory. Navigate to the build directory first. ```bash cd ~/UERANSIM/build ./nr-gnb -c ../config/open5gs-gnb.yaml ./nr-ue -c ../config/open5gs-ue.yaml ``` -------------------------------- ### Run gNB and UE with Free5GC Configuration Source: https://github.com/aligungr/ueransim/wiki/Configuration Execute the gNB and UE with specific configuration files from the config directory. Navigate to the build directory first. ```bash ./nr-gnb -c ../config/free5gc-gnb.yaml ./nr-ue -c ../config/free5gc-ue.yaml ``` -------------------------------- ### Run nr-ue with Configuration Source: https://github.com/aligungr/ueransim/wiki/Configuration Specify a UE configuration file using the -c flag. Ensure the configuration file path is correct. ```bash nr-ue -c myconfig1.yaml ``` -------------------------------- ### Run nr-gnb with Configuration Source: https://github.com/aligungr/ueransim/wiki/Configuration Specify a gNB configuration file using the -c flag. Ensure the configuration file path is correct. ```bash nr-gnb -c myconfig2.yaml ``` -------------------------------- ### Bind Web Browser to UE's Internet Connection Source: https://github.com/aligungr/ueransim/wiki/Usage Launch a web browser, such as Firefox, using `./nr-binder` to route all its network traffic through the UE's internet connectivity. Ensure all existing browser processes are killed beforehand. ```bash ./nr-binder 10.45.0.2 firefox ``` -------------------------------- ### Dump All UERANSIM Nodes Source: https://github.com/aligungr/ueransim/wiki/Usage Query and list all currently running UE and gNB instances in the environment. ```bash $ nr-cli --dump ``` -------------------------------- ### Add App Library Source: https://github.com/aligungr/ueransim/blob/master/src/lib/app/CMakeLists.txt Adds the 'app' library using the discovered header and source files. ```cmake add_library(app ${HDR_FILES} ${SRC_FILES}) ``` -------------------------------- ### Build UERANSIM Project with Parallel Jobs Source: https://github.com/aligungr/ueransim/wiki/Installation If the compilation process takes too long, use the '-j' flag with make to enable parallel compilation and speed up the build process. ```bash make -j ``` -------------------------------- ### Bind Application to UE's Internet Connection Source: https://github.com/aligungr/ueransim/wiki/Usage Use the `./nr-binder` tool to route an application's traffic through a specific UE's PDU session IP address. Automatic routing configurations must be enabled. ```bash ./nr-binder 10.45.0.2 curl google.com ``` -------------------------------- ### Set Compile Options Source: https://github.com/aligungr/ueransim/blob/master/src/lib/app/CMakeLists.txt Applies common compile-time warnings and options to the 'app' library. ```cmake target_compile_options(app PRIVATE -Wall -Wextra -pedantic -Wno-unused-parameter) ``` -------------------------------- ### `nr-cli` — Command Line Interface Source: https://context7.com/aligungr/ueransim/llms.txt Using the `nr-cli` tool for managing and interacting with running gNB and UE nodes, including interactive shell and one-shot command execution. ```APIDOC ## `nr-cli` — Command Line Interface for gNB and UE `nr-cli` is a management tool for running nodes. It supports both interactive shell mode and one-shot command execution (`--exec`). gNB and UE expose different command sets. Use `--dump` to list all running nodes. ### List all currently running UE and gNB nodes ```bash ./nr-cli --dump # Output: # UERANSIM-gnb-208-93-1 # imsi-208930000000001 # imsi-208930000000002 ``` ### Interactive shell for a gNB node ```bash ./nr-cli UERANSIM-gnb-208-93-1 # --- # $ commands # amf-info | Show some status information about the given AMF # amf-list | List all AMFs associated with the gNB # info | Show some information about the gNB # status | Show some status information about the gNB # ue-count | Print the total number of UEs connected to this gNB # ue-list | List all UEs associated with the gNB ``` ### Non-interactive gNB commands ```bash ./nr-cli UERANSIM-gnb-208-93-1 --exec "amf-info" ./nr-cli UERANSIM-gnb-208-93-1 --exec "ue-count" ``` ### Interactive shell for a UE node ```bash ./nr-cli imsi-208930000000001 # --- # $ commands # coverage | Show cell coverage information # deregister | Perform a de-registration by the UE # dump-keys | Dump current NAS/RRC security keys # info | Show some information about the UE # log-level | Print/change the logging level # pc5-status | Show ProSe PC5 status information # ps-establish | Trigger a PDU session establishment procedure # ps-list | List all PDU sessions # ps-release | Trigger a PDU session release procedure # ps-release-all| Trigger PDU session release for all sessions # rls-state | Show the radio link states # status | Show registration and connectivity status # timers | Print the NAS timers ``` ### Non-interactive UE commands ```bash ./nr-cli imsi-208930000000001 --exec "status" ./nr-cli imsi-208930000000001 --exec "ps-list" ./nr-cli imsi-208930000000001 --exec "ps-establish --help" # Trigger PDU session release from CLI ./nr-cli imsi-208930000000001 --exec "ps-release 1" # Trigger de-registration ./nr-cli imsi-208930000000001 --exec "deregister switch-off" ``` ``` -------------------------------- ### nr-cli: List Running Nodes Source: https://context7.com/aligungr/ueransim/llms.txt Use the `--dump` option with `nr-cli` to list all currently running UE and gNB nodes managed by UERANSIM. ```bash # List all currently running UE and gNB nodes ./nr-cli --dump ``` -------------------------------- ### Access UERANSIM CLI Source: https://github.com/aligungr/ueransim/wiki/Usage Interact with a running gNB or UE using its name. Replace `` with the specific identifier. ```bash nr-cli imsi-001010000000001 ``` -------------------------------- ### UE Configuration for free5GC Source: https://context7.com/aligungr/ueransim/llms.txt YAML configuration for the `nr-ue` binary to simulate a User Equipment connecting to a free5GC network. It includes subscriber identifiers (SUPI/IMSI) and network codes. ```yaml # config/free5gc-ue.yaml — complete UE configuration for free5GC supi: 'imsi-208930000000001' # SUPI (IMSI format, 15 digits: MCC+MNC+MSISDN) mcc: '208' mnc: '93' ``` -------------------------------- ### Link Libraries Source: https://github.com/aligungr/ueransim/blob/master/src/lib/app/CMakeLists.txt Links the 'app' library with 'utils' and 'udp' libraries. ```cmake target_link_libraries(app utils) target_link_libraries(app udp) ``` -------------------------------- ### Define Library Sources Source: https://github.com/aligungr/ueransim/blob/master/src/lib/app/CMakeLists.txt Globally finds all header (.hpp) and source (.cpp) files for the library. ```cmake file(GLOB HDR_FILES *.hpp) file(GLOB SRC_FILES *.cpp) ``` -------------------------------- ### Clone UERANSIM Repository Source: https://github.com/aligungr/ueransim/wiki/Installation Clone the UERANSIM source code from GitHub to your local machine. ```bash cd ~ git clone https://github.com/aligungr/UERANSIM ``` -------------------------------- ### Show gNB and UE Status with nr-cli Source: https://context7.com/aligungr/ueransim/llms.txt Display general information, status, and counts of connected UEs using `nr-cli`. These commands help in understanding the gNB's operational state. ```bash ./nr-cli UERANSIM-gnb-208-93-1 --exec "info" ``` ```bash ./nr-cli UERANSIM-gnb-208-93-1 --exec "status" ``` ```bash ./nr-cli UERANSIM-gnb-208-93-1 --exec "ue-count" ``` ```bash ./nr-cli UERANSIM-gnb-208-93-1 --exec "ue-list" ``` -------------------------------- ### Discover ASN.1 C Source and Header Files Source: https://github.com/aligungr/ueransim/blob/master/src/asn/asn1c/CMakeLists.txt Uses CMake's GLOB command to find all .h and .c files in the current directory for the ASN.1 C library. ```cmake file(GLOB HDR_FILES *.h) file(GLOB SRC_FILES *.c) ``` -------------------------------- ### Ping via TUN Interface Source: https://github.com/aligungr/ueransim/wiki/Usage Manually utilize the UE's internet connectivity by binding a TCP/IP socket to the `uesimtunX` interface. ```bash ping -I uesimtun0 google.com ``` -------------------------------- ### Set Include Directories for ASN.1 C Library Source: https://github.com/aligungr/ueransim/blob/master/src/asn/asn1c/CMakeLists.txt Configures the public include directories for the 'asn-asn1c' target, making its headers accessible. ```cmake target_include_directories(asn-asn1c PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}) ``` -------------------------------- ### TUN Interface Usage Source: https://context7.com/aligungr/ueransim/llms.txt Information on how applications can utilize the UE's 5G connectivity through the automatically created TUN interface after a successful PDU session establishment. ```APIDOC ## TUN Interface — Using UE Internet Connectivity After a successful PDU session establishment, UERANSIM automatically creates a TUN interface (`uesimtunX`) and configures routing. Applications can use UE's 5G connectivity by binding to this interface directly or via `nr-binder`. ```bash # Example usage (conceptual, specific commands depend on application) # Applications can bind to the TUN interface or use nr-binder ``` ``` -------------------------------- ### Verify TUN Interface and Send ICMP Ping Source: https://context7.com/aligungr/ueransim/llms.txt Verify the TUN interface is up and send an ICMP ping through the UE's PDU session. Ensure the TUN interface is correctly configured and active. ```bash ip addr show uesimtun0 ``` ```bash ping -I uesimtun0 8.8.8.8 ``` -------------------------------- ### Bind Application to UE Connectivity with nr-binder Source: https://context7.com/aligungr/ueransim/llms.txt Use `nr-binder` to force an application to use a specific UE's TUN interface for its network traffic. Ensure automatic routing is enabled. ```bash ./nr-binder {PDU-SESSION-IP-ADDRESS} {COMMAND} [ARGS...] ``` ```bash ./nr-binder 10.60.0.1 curl https://httpbin.org/ip ``` ```bash ./nr-binder 10.60.0.1 wget -O - https://httpbin.org/ip ``` ```bash killall firefox 2>/dev/null ./nr-binder 10.60.0.1 firefox ``` ```bash ./nr-binder 10.60.0.1 python3 my_network_script.py ``` -------------------------------- ### Add ASN.1 C Library Target Source: https://github.com/aligungr/ueransim/blob/master/src/asn/asn1c/CMakeLists.txt Creates a CMake library target named 'asn-asn1c' using the discovered header and source files. ```cmake add_library(asn-asn1c ${HDR_FILES} ${SRC_FILES}) ``` -------------------------------- ### nr-cli: Interactive Shell for UE Source: https://context7.com/aligungr/ueransim/llms.txt Access an interactive shell for a specific UE node using its IMSI. This provides access to commands for managing PDU sessions, status, and security. ```bash # Open interactive shell for a UE node ./nr-cli imsi-208930000000001 ``` -------------------------------- ### gNodeB Configuration for free5GC Source: https://context7.com/aligungr/ueransim/llms.txt YAML configuration for the `nr-gnb` binary to connect to a free5GC network. Specifies network identifiers, IP addresses for interfaces, and AMF connection details. The `ignoreStreamIds` option is recommended for some core network implementations. ```yaml # config/free5gc-gnb.yaml — complete gNB configuration for free5GC mcc: '208' # Mobile Country Code mnc: '93' # Mobile Network Code (2 or 3 digits) nci: '0x000000010' # NR Cell Identity (36-bit) idLength: 32 # gNB ID bit length [22..32] tac: 1 # Tracking Area Code linkIp: 127.0.0.1 # Local IP for Radio Link Simulation (RLS, port 4997) ngapIp: 127.0.0.1 # Local IP for N2 interface toward AMF (SCTP) gtpIp: 127.0.0.1 # Local IP for N3 interface toward UPF (GTP-U) # gtpAdvertiseIp: 10.0.0.1 # Optional: override advertised DL GTP IP (useful behind NAT) amfConfigs: - address: 127.0.0.1 # AMF IP address port: 38412 # AMF SCTP port slices: - sst: 0x1 # Slice/Service Type sd: 0x010203 # Slice Differentiator (optional) ignoreStreamIds: true # Ignore SCTP stream number errors (recommended for some cores) cellAccessType: nr # Cell type: nr | nr-leo | nr-meo | nr-geo | nr-othersat ``` -------------------------------- ### Verify Network Protocol Ports Source: https://context7.com/aligungr/ueransim/llms.txt Check if the necessary network ports for UERANSIM interfaces (N2, N3, RLS) are open and accessible between nodes. Use `ss` for server-side checks and `nc` for client-side reachability. ```bash ss -lnp | grep -E '38412|2152|4997' ``` ```bash nc -u -z 4997 && echo "RLS port reachable" ``` -------------------------------- ### HTTP Request via UE PDU Session Source: https://context7.com/aligungr/ueransim/llms.txt Make an HTTP request through the UE's PDU session to verify external IP visibility. This command uses curl and requires sudo privileges. ```bash sudo curl --interface uesimtun0 https://httpbin.org/ip ``` -------------------------------- ### Inspect AMF Connections with nr-cli Source: https://context7.com/aligungr/ueransim/llms.txt Use `nr-cli` to view AMF connection status and detailed information. These commands are useful for monitoring the network infrastructure. ```bash ./nr-cli UERANSIM-gnb-208-93-1 --exec "amf-list" ``` ```bash ./nr-cli UERANSIM-gnb-208-93-1 --exec "amf-info 1" ``` -------------------------------- ### Curl via TUN Interface Source: https://github.com/aligungr/ueransim/wiki/Usage Use `curl` with the `--interface` option to direct traffic through the specified `uesimtunX` interface. ```bash sudo curl --interface uesimtun0 google.com ``` -------------------------------- ### Execute UERANSIM CLI Command Directly Source: https://github.com/aligungr/ueransim/wiki/Usage Use the -e or --exec option to run a specific CLI command without entering the interactive shell. ```bash nr-cli imsi-001010000000001 --exec "status" ``` -------------------------------- ### nr-cli: Interactive Shell for gNB Source: https://context7.com/aligungr/ueransim/llms.txt Access an interactive shell for a specific gNB node using its identifier. Available commands include `amf-info`, `info`, `status`, and `ue-count`. ```bash # Open interactive shell for a gNB node ./nr-cli UERANSIM-gnb-208-93-1 ``` -------------------------------- ### nr-cli: Execute UE Commands Non-interactively Source: https://context7.com/aligungr/ueransim/llms.txt Execute single commands on a UE node non-interactively using the `--exec` option. Useful for scripting and automation. ```bash # Non-interactive UE commands ./nr-cli imsi-208930000000001 --exec "status" ``` ```bash ./nr-cli imsi-208930000000001 --exec "ps-list" ``` ```bash ./nr-cli imsi-208930000000001 --exec "ps-establish --help" ``` ```bash # Trigger PDU session release from CLI ./nr-cli imsi-208930000000001 --exec "ps-release 1" ``` ```bash # Trigger de-registration ./nr-cli imsi-208930000000001 --exec "deregister switch-off" ``` -------------------------------- ### Set Compile Options for ASN.1 C Library Source: https://github.com/aligungr/ueransim/blob/master/src/asn/asn1c/CMakeLists.txt Applies a public compile-time option to disable OER support for the 'asn-asn1c' library. ```cmake target_compile_options(asn-asn1c PUBLIC -DASN_DISABLE_OER_SUPPORT) ``` -------------------------------- ### nr-cli: Execute gNB Commands Non-interactively Source: https://context7.com/aligungr/ueransim/llms.txt Execute single commands on a gNB node without entering the interactive shell using the `--exec` option. ```bash # Non-interactive: execute a single command directly ./nr-cli UERANSIM-gnb-208-93-1 --exec "amf-info" ``` ```bash ./nr-cli UERANSIM-gnb-208-93-1 --exec "ue-count" ``` -------------------------------- ### Find PDU Session IP Address Source: https://context7.com/aligungr/ueransim/llms.txt Retrieve the IP address of a PDU session using the `nr-cli` tool. This is often a prerequisite for using `nr-binder`. ```bash ./nr-cli imsi-208930000000001 --exec "ps-list" ``` -------------------------------- ### Capture RLS Traffic with Wireshark Source: https://context7.com/aligungr/ueransim/llms.txt Capture and analyze Radio Link Simulation (RLS) traffic between the UE and gNB using Wireshark. Filter traffic specifically for UDP port 4997. ```bash sudo wireshark -i lo -f "udp port 4997" ``` ```bash sudo wireshark -i eth0 -f "udp port 4997" ``` -------------------------------- ### Configure Satellite gNB Access Type Source: https://context7.com/aligungr/ueransim/llms.txt Configure the gNB to support Non-Terrestrial Networks (NTN) by setting the `cellAccessType` in the YAML configuration. This adds NR-NTN TAI Information to NGAP messages. ```yaml mcc: '208' mnc: '93' nci: '0x000000010' idLength: 32 tac: 1 linkIp: 127.0.0.1 ngapIp: 127.0.0.1 gtpIp: 127.0.0.1 amfConfigs: - address: 127.0.0.1 port: 38412 slices: - sst: 0x1 ignoreStreamIds: true cellAccessType: nr-leo ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.