Introduction
In the last lesson, you successfully established the S1 link, connecting your srsENB software base station to the Open5GS core network. Your lab now has a functional Radio Access Network (RAN) and Evolved Packet Core (EPC). The base station is broadcasting, waiting for a device to connect.
Today's lesson completes the chain. Our learning outcome is to initiate an attach with the srsUE software client and confirm its successful registration. The srsUE is a software-defined User Equipment—it acts like a smartphone, but running on your computer. This process of connecting to the network for the first time is called the attach procedure.
By the end of this lesson, you will have guided a UE through a successful network registration, confirming its connection from three different perspectives: the UE itself, the core network, and the underlying protocols.
1. Configuring the UE's Identity
Before a UE can join the network, the network must be able to identify and authenticate it. In a real-world scenario, this is handled by the SIM card. In our lab, we use a "virtual SIM" configured within the srsUE software. The credentials of this virtual SIM must perfectly match a subscriber profile in the core network's Home Subscriber Server (HSS), which you created in a previous module.
The configuration for srsUE's virtual SIM is stored in the ue.conf file.
To understand these parameters, let's review the official srsRAN documentation.
srsRAN 4G Documentation - UE Configuration
This section of the srsRAN documentation explains the purpose of the ue.conf file and details the critical USIM parameters needed for authentication. This is the theoretical foundation for what we are about to configure.
Please read the section titled 'Configuration' (Section 10.2.2). Focus on the bullet points describing the virtual USIM parameters: IMSI, K, and OP or OPc. Note the explanation that these must match the parameters in the EPC's HSS.
As the documentation states, the three key parameters are:
- IMSI (International Mobile Subscriber Identity): The unique ID for the subscriber.
- K: The secret key shared between the SIM and the HSS.
- OPc (Operator Code): A value derived from the K and a network-wide secret (OP), used in the authentication algorithm.
These are the exact same values you entered into the Open5GS web interface when you created your test subscriber.

Now, let's look at a practical example of how these values are set in the ue.conf file.
Open5GS & srsRAN - UE Configuration Example
This sample configuration guide provides a clear 'diff' format showing the changes needed in a default ue.conf file. It's a practical template for setting up your own configuration.
Find the subsection titled 'Changes in configuration files of UE' and examine the changes for ue.conf. Pay attention to how the imsi, k, and opc values are set. Also, note the device_name = zmq and device_args, which configure the UE to use the virtual radio interface to communicate with your srsENB.
Before proceeding, take a moment to verify that your ue.conf file contains the correct IMSI, K, and OPc for the subscriber you provisioned in Open5GS. A mismatch here is the most common reason for an attach failure.
2. Launching the srsUE Client
With the configuration verified, you are ready to start the UE. You will run the srsue executable from its build directory, providing your configuration file as an argument.
Since srsUE needs to create a virtual network interface (a tun device) upon successful connection, it requires root privileges.
In a new terminal, navigate to the srsue build directory and execute the following command:
# Navigate to the srsue build directory
cd /path/to/srsRAN_4G/build/srsue
# Launch the srsUE client with your configuration file
sudo ./srsue ue.conf
The UE will now start, initialize its virtual radio, and begin scanning for a cell to connect to—your srsENB.
3. Confirming Successful Registration
A successful attach involves a complex sequence of messages between the UE, eNB, and MME. We can confirm success by observing the logs from each component.
Viewpoint 1: The UE's Perspective
The most immediate feedback comes from the srsue terminal itself. If the attach is successful, the log output will show a clear progression.
This guide contains a perfect example of the log output from a successful srsUE attach. Use this as a reference to interpret the output in your own terminal.
Scroll to the section 'Run srsRAN 4G ZMQ UE'. Examine the log output closely. Look for these key lines: Found Cell, RRC Connected, and finally, Network attach successful. IP: 10.45.0.2.
Seeing the "Network attach successful" message and an assigned IP address is your primary confirmation that the procedure worked from the UE's point of view.
Viewpoint 2: The Core Network's Perspective
Next, let's verify that the MME in your Open5GS core network has processed the registration. You can do this by tailing the MME log file in another terminal.
sudo journalctl -u open5gs-mmed -f
# Or if logging to file:
# sudo tail -f /var/log/open5gs/mme.log
The following video demonstrates launching the UE and then checking the MME logs for the corresponding activity.
This video provides a practical demonstration of the entire process, showing the UE being launched and then cross-referencing with the MME logs to confirm the attach procedure from the core network's side.
Watch the segment from 11:43 to 13:30. The presenter runs the UE, and then switches to the MME log screen. Notice the log entries for 'Attach request' and 'Attach complete'. This is the MME confirming it has successfully registered the UE.
The MME log provides the authoritative record that the core network has accepted the UE.
Viewpoint 3: The Protocol Perspective (Wireshark)
Given your background with Wireshark, you can appreciate that this registration process isn't magic; it's a standardized protocol exchange. The main protocols involved are:
- RRC (Radio Resource Control): Manages the radio link between the UE and eNB.
- S1AP (S1 Application Protocol): Manages the link between the eNB and MME.
- NAS (Non-Access Stratum): Carries messages directly between the UE and MME, handling session management and mobility. The
Attach Requestis a NAS message.
The same video provides an excellent walkthrough of a Wireshark capture showing these messages in action.
This part of the video is tailored for your skillset. It dissects a packet capture of the attach procedure, showing the exact S1AP and NAS messages that orchestrate the connection.
Watch from 18:00 to 20:30. The presenter filters for S1AP traffic in Wireshark and walks through the key messages of the attach flow: Initial UE Message (carrying the NAS Attach Request) Downlink NAS Transport (carrying the Authentication Request) Uplink NAS Transport (carrying the Authentication Response) Security Mode Command/Complete Initial Context Setup Request (carrying the NAS Attach Accept) Relating these packets to the process will solidify your understanding of how the network operates at a protocol level.
What if It Fails?
If the srsue log does not show "Network attach successful", the most likely culprit is a configuration mismatch.
- Check Credentials: The srsRAN documentation correctly points out that misconfigured network credentials are a primary cause of failure. Meticulously re-verify that the
imsi,k, andopcinue.confare identical to what is in your Open5GS subscriber database. - Check Connectivity: Ensure your
srsenbis still running and connected to the MME. Check the logs for all three components for any error messages.
Conclusion
Excellent work! You have successfully configured and launched the srsUE client, and it has registered with your private 4G network. You now have a complete, end-to-end mobile network running in your lab, from the core to the edge device.
Key Takeaways:
- The
srsUErelies on theue.conffile for its virtual SIM card credentials (IMSI, K, OPc). - A successful attach requires a perfect match between the UE's credentials and the subscriber profile in the HSS (Open5GS).
- Verification is a multi-step process: you must confirm success in the
srsuelogs, see the "Attach complete" message in the MME logs, and (optionally) observe the NAS/S1AP message flow in a packet capture. - A successful attach results in the UE being assigned an IP address by the core network.
Preview of the Next Lesson:
The UE is attached and has an IP address, but this doesn't guarantee it can send and receive data. In the next lesson, we will verify the UE has established a data bearer and can pass IP traffic through the test network. This will be the final step in confirming your lab is fully operational and ready for security experiments.