Back to Lab

5G Core Lab - 50 Step Command Guide

Complete step-by-step commands to operate the Open5GS + UERANSIM lab environment

Lab Server Details

Server IP:Provided in your lab access email
SSH User:Provided in your lab access email
Web UI:Check your lab access email for credentials
PLMN:MCC: 999, MNC: 70
Test IMSI:999700000000001

Quick Navigation

Section 1: Server Access & Initial Check (Steps 1-5)

1
Connect to Lab Server via SSH
Open terminal and connect to the 5G Core lab server
ssh username@your-server-ip
2
Check Server Information
Verify server hostname and OS version
hostname && cat /etc/os-release | head -3
Expected Output:
srv1098713 PRETTY_NAME="Ubuntu 24.04.1 LTS" NAME="Ubuntu" VERSION_ID="24.04"
3
Check System Resources
Verify available memory and CPU
free -h && nproc
4
Check Network Interfaces
View all network interfaces including ogstun
ip addr show | grep -E "^[0-9]+:|inet " | head -20
5
Check MongoDB Status
MongoDB stores subscriber data - ensure it's running
systemctl status mongod | head -5
Expected Output:
● mongod.service - MongoDB Database Server Loaded: loaded Active: active (running)

Section 2: Open5GS Service Management (Steps 6-15)

6
Check All Open5GS Services
View status of all 5G Core network functions
systemctl list-units --type=service | grep open5gs
Expected Output (All should be "running"):
open5gs-amfd.service loaded active running Open5GS AMF Daemon open5gs-ausfd.service loaded active running Open5GS AUSF Daemon open5gs-bsfd.service loaded active running Open5GS BSF Daemon open5gs-nrfd.service loaded active running Open5GS NRF Daemon open5gs-nssfd.service loaded active running Open5GS NSSF Daemon open5gs-pcfd.service loaded active running Open5GS PCF Daemon open5gs-scpd.service loaded active running Open5GS SCP Daemon open5gs-smfd.service loaded active running Open5GS SMF Daemon open5gs-udmd.service loaded active running Open5GS UDM Daemon open5gs-udrd.service loaded active running Open5GS UDR Daemon open5gs-upfd.service loaded active running Open5GS UPF Daemon
7
Check AMF Status (Access & Mobility)
AMF handles UE registration and mobility
systemctl status open5gs-amfd --no-pager | head -10
8
Check SMF Status (Session Management)
SMF manages PDU sessions
systemctl status open5gs-smfd --no-pager | head -10
9
Check UPF Status (User Plane)
UPF handles actual data traffic
systemctl status open5gs-upfd --no-pager | head -10
10
Check NRF Status (Network Repository)
NRF provides service discovery for all NFs
systemctl status open5gs-nrfd --no-pager | head -10
11
View AMF Configuration
Check PLMN and network settings in AMF
grep -A5 'plmn_id' /etc/open5gs/amf.yaml | head -10
Expected Output:
- plmn_id: mcc: 999 mnc: 70
12
View UPF Configuration
Check UE subnet pool configuration
grep -A3 'subnet' /etc/open5gs/upf.yaml
Expected Output:
session: - subnet: 10.45.0.0/16 gateway: 10.45.0.1
13
Restart All Open5GS Services
Use this if you need to restart the core network
systemctl restart open5gs-* && sleep 3 && systemctl status open5gs-amfd --no-pager | head -5
14
Check ogstun Interface (UPF Data Interface)
This interface handles UE data traffic
ip addr show ogstun
Expected Output:
ogstun: <POINTOPOINT,MULTICAST,NOARP,UP,LOWER_UP> inet 10.45.0.1/16 scope global ogstun
15
Check Web UI Status
Web UI for subscriber management
systemctl status open5gs-webui --no-pager | head -5
Web UI Access: http://your-server-ip:9999
Username: (provided in your access email)
Password: (provided in your access email)

Section 3: Start gNB & UE (Steps 16-25)

16
Check Network Namespace
UE runs in isolated network namespace for proper routing
ip netns list
Expected Output:
ueransim
17
Check Namespace Network Connectivity
Verify namespace can reach the internet
ip netns exec ueransim ping -c 2 8.8.8.8
18
View gNB Configuration
Check gNB settings (PLMN, AMF address)
cat /opt/UERANSIM/config/ns-gnb.yaml
Expected Output:
mcc: '999' mnc: '70' nci: '0x000000010' tac: 1 linkIp: 192.168.100.1 ngapIp: 127.0.0.1 gtpIp: 127.0.0.1 amfConfigs: - address: 127.0.0.5 port: 38412
19
View UE Configuration
Check UE settings (IMSI, keys, APN)
cat /opt/UERANSIM/config/ns-ue.yaml | head -20
Expected Output:
supi: 'imsi-999700000000001' mcc: '999' mnc: '70' key: '465B5CE8B199B49FAA5F0A2EE238A6BC' op: 'E8ED289DEBA952E4283B54E88E6183CA' opType: 'OPC' gnbSearchList: - 192.168.100.1
20
Stop Any Running UERANSIM Processes
Clean up before starting fresh
pkill -9 nr-gnb 2>/dev/null; pkill -9 nr-ue 2>/dev/null; echo "Cleaned up"
21
Start gNB (5G Base Station)
Start gNB and connect to AMF
nr-gnb -c /opt/UERANSIM/config/ns-gnb.yaml > /tmp/gnb.log 2>&1 &
22
Verify gNB Connection
Check gNB connected to AMF successfully
sleep 3 && cat /tmp/gnb.log
Expected Output (Success):
UERANSIM v3.2.7 [sctp] [info] Trying to establish SCTP connection... (127.0.0.5:38412) [sctp] [info] SCTP connection established (127.0.0.5:38412) [ngap] [info] NG Setup procedure is successful
23
Start UE (User Equipment) in Namespace
Start UE inside network namespace
ip netns exec ueransim nr-ue -c /opt/UERANSIM/config/ns-ue.yaml > /tmp/ue.log 2>&1 &
24
Verify UE Registration
Check UE registered and PDU session established
sleep 5 && cat /tmp/ue.log
Expected Output (Success):
UERANSIM v3.2.7 [nas] [info] Selected plmn[999/70] [rrc] [info] RRC connection established [nas] [info] UE switches to state [MM-REGISTERED/NORMAL-SERVICE] [nas] [info] Initial Registration is successful [nas] [info] PDU Session establishment is successful PSI[1] [app] [info] Connection setup for PDU session[1] is successful, TUN interface[uesimtun0, 10.45.0.3] is up.
25
Check UE Status via CLI
Use nr-cli to check UE registration state
nr-cli imsi-999700000000001 -e status
Expected Output:
cm-state: CM-CONNECTED rm-state: RM-REGISTERED mm-state: MM-REGISTERED/NORMAL-SERVICE 5u-state: 5U1-UPDATED selected-plmn: 999/70

Section 4: Test Connectivity via 5G (Steps 26-35)

26
Check UE IP Address
View the IP address assigned to UE via 5G
ip netns exec ueransim ip addr show uesimtun0
Expected Output:
uesimtun0: <POINTOPOINT,UP,LOWER_UP> mtu 1400 inet 10.45.0.3/16 scope global uesimtun0
27
Check UE Routing Table
Verify default route via 5G tunnel
ip netns exec ueransim ip route show
Expected Output:
default dev uesimtun0 scope link 10.45.0.0/16 dev uesimtun0 proto kernel scope link src 10.45.0.3
28
Ping Test via 5G - Google DNS
Test ICMP connectivity through 5G network
ip netns exec ueransim ping -c 4 8.8.8.8
Expected Output:
PING 8.8.8.8 (8.8.8.8) 56(84) bytes of data. 64 bytes from 8.8.8.8: icmp_seq=1 ttl=117 time=5.23 ms 64 bytes from 8.8.8.8: icmp_seq=2 ttl=117 time=4.15 ms --- 8.8.8.8 ping statistics --- 4 packets transmitted, 4 received, 0% packet loss
29
Ping Test via 5G - Cloudflare DNS
Test connectivity to another DNS server
ip netns exec ueransim ping -c 4 1.1.1.1
30
DNS Resolution Test via 5G
Test DNS lookup through 5G network
ip netns exec ueransim nslookup google.com 8.8.8.8
Expected Output:
Server: 8.8.8.8 Address: 8.8.8.8#53 Non-authoritative answer: Name: google.com Address: 142.250.x.x
31
DNS Resolution - Your Domain
Test DNS lookup for cafetele.com
ip netns exec ueransim nslookup cafetele.com 8.8.8.8
32
TCP Connection Test via 5G
Test TCP connectivity to Google HTTPS
ip netns exec ueransim nc -zv 8.8.8.8 443 -w 5
Expected Output:
Connection to 8.8.8.8 443 port [tcp/https] succeeded!
33
HTTP Request via 5G
Test HTTP connectivity through 5G
ip netns exec ueransim curl -s -o /dev/null -w "%{http_code}" --connect-timeout 10 http://www.google.com
Expected Output:
200 or 301
34
Raw HTTP Request via 5G
Make raw HTTP request using netcat
ip netns exec ueransim bash -c 'echo -e "GET / HTTP/1.0\r\nHost: example.com\r\n\r\n" | nc -w 5 93.184.215.14 80 | head -10'
Expected Output:
HTTP/1.0 200 OK Content-Type: text/html; charset=UTF-8 ...
35
Check PDU Session Details
View active PDU sessions on UE
nr-cli imsi-999700000000001 -e ps-list
Expected Output:
PDU Session-1: state: PS-ACTIVE type: IPv4 apn: internet ip: 10.45.0.3

Section 5: View Logs (Steps 36-42)

36
View AMF Logs (UE Registration)
See UE registration, authentication events
journalctl -u open5gs-amfd -n 30 --no-pager
37
View AMF Logs in Real-time
Follow AMF logs live (Ctrl+C to stop)
journalctl -u open5gs-amfd -f
38
View SMF Logs (Session Management)
See PDU session creation events
journalctl -u open5gs-smfd -n 30 --no-pager
39
View UPF Logs (User Plane)
See data plane events
journalctl -u open5gs-upfd -n 30 --no-pager
40
View gNB Log
Check gNB connection and status
cat /tmp/gnb.log
41
View UE Log
Check UE registration and session status
cat /tmp/ue.log
42
View All Open5GS Logs
Check all NF log files
ls -la /var/log/open5gs/

Section 6: Traffic Capture & Debug (Steps 43-50)

43
Capture SCTP Traffic (N2 Control Plane)
Capture AMF-gNB signaling (Ctrl+C to stop)
tcpdump -i any sctp -c 20 -n
44
Capture GTP-U Traffic (User Plane)
Capture GTP tunneled traffic
tcpdump -i any port 2152 -c 20 -n
45
Capture Traffic on ogstun
See decapsulated UE traffic
tcpdump -i ogstun -c 20 -n
46
Save Capture to PCAP File
Save traffic for Wireshark analysis
tcpdump -i any sctp -c 50 -w /tmp/5g-capture.pcap && echo "Saved to /tmp/5g-capture.pcap"
47
View Subscriber in MongoDB
Check subscriber data in database
mongosh --quiet --eval 'db = db.getSiblingDB("open5gs"); db.subscribers.find({imsi:"999700000000001"}).pretty()' | head -30
48
Check NAT Rules
Verify NAT is configured for UE traffic
iptables -t nat -L POSTROUTING -v -n | grep 10.45
Expected Output:
MASQUERADE all -- * eth0 10.45.0.0/16 0.0.0.0/0
49
Deregister UE
Gracefully disconnect UE from network
nr-cli imsi-999700000000001 -e deregister normal
50
Stop All UERANSIM Processes
Clean shutdown of gNB and UE
pkill -9 nr-gnb; pkill -9 nr-ue; echo "UERANSIM stopped"

Quick Reference Card

Action Command
SSH to server ssh username@your-server-ip
Check all services systemctl status open5gs-*
Start gNB nr-gnb -c /opt/UERANSIM/config/ns-gnb.yaml &
Start UE ip netns exec ueransim nr-ue -c /opt/UERANSIM/config/ns-ue.yaml &
Check UE status nr-cli imsi-999700000000001 -e status
Ping via 5G ip netns exec ueransim ping 8.8.8.8
View AMF logs journalctl -u open5gs-amfd -f
Capture traffic tcpdump -i any sctp -n
Stop UERANSIM pkill nr-gnb; pkill nr-ue
Restart core systemctl restart open5gs-*
Learning Resources

Open5GS Documentation
UERANSIM Wiki
3GPP Specifications

© 2026 CafeTele - 5G Core Network Lab
All commands tested and verified on Ubuntu 24.04 with Open5GS + UERANSIM