5.Open5GS‐srsRAN‐ZMQ‐MultiHost - mhradhika/5GTrial GitHub Wiki
Open5GS Core with srsRAN ZMQ Multi-Host Setup
This guide implements a 5G Standalone (SA) deployment using Open5GS core with an RF-simulated setup using srsRAN over ZMQ across two hosts with specific IP addresses.
Overview
- Host 1 (10.2.22.137): Runs the Open5GS 5G Core Network
- Host 2 (10.2.22.93): Runs both the srsRAN gNB and UE
Prerequisites
For both hosts:
- Ubuntu 20.04 or 22.04
- Docker-ce (Version 22.0.5 or above)
- Docker compose (Version 2.14 or above)
Host 1 (10.2.22.137): 5G Core Network Setup
Step 1: Prepare the Environment
sudo ufw disable
sudo sysctl -w net.ipv4.ip_forward=1
sudo cpupower frequency-set -g performance
Step 2: Get Docker Images
# Base images
docker pull ghcr.io/herlesupreeth/docker_open5gs:master
docker tag ghcr.io/herlesupreeth/docker_open5gs:master docker_open5gs
docker pull ghcr.io/herlesupreeth/docker_grafana:master
docker tag ghcr.io/herlesupreeth/docker_grafana:master docker_grafana
docker pull ghcr.io/herlesupreeth/docker_metrics:master
docker tag ghcr.io/herlesupreeth/docker_metrics:master docker_metrics
Step 3: Configure Network Parameters
- Clone the repository:
git clone https://github.com/herlesupreeth/docker_open5gs
cd docker_open5gs
- Create/edit the
.env
file with the following parameters:
MCC=001 # Mobile Country Code
MNC=01 # Mobile Network Code
DOCKER_HOST_IP=10.2.22.137 # IP address of Host 1 (5GC)
UPF_ADVERTISE_IP=10.2.22.137 # Same as DOCKER_HOST_IP
UE_IPV4_INTERNET=10.45.0.0/16 # UE network range for internet APN
UE_IPV4_IMS=10.46.0.0/16 # UE network range for IMS APN
Step 4: Modify the Docker Compose File
Edit the sa-deploy.yaml
file to expose necessary ports:
Under the amf
section, uncomment:
ports:
- "38412:38412/sctp"
Under the upf
section, uncomment:
ports:
- "2152:2152/udp"
Step 5: Deploy 5G Core Network
docker compose -f sa-deploy.yaml up
This will start all the necessary 5G core components using Open5GS.
Host 2 (10.2.22.93): srsRAN gNB and UE Setup
Step 6: Prepare the Environment
sudo ufw disable
sudo sysctl -w net.ipv4.ip_forward=1
sudo cpupower frequency-set -g performance
Step 7: Get Docker Images
# srsRAN components
docker pull ghcr.io/herlesupreeth/docker_srsran:master
docker tag ghcr.io/herlesupreeth/docker_srsran:master docker_srsran
Step 8: Configure Network Parameters
- Clone the repository:
git clone https://github.com/herlesupreeth/docker_open5gs
cd docker_open5gs
- Create/edit the
.env
file with the following parameters:
MCC=001 # Mobile Country Code (same as Host 1)
MNC=01 # Mobile Network Code (same as Host 1)
DOCKER_HOST_IP=10.2.22.93 # IP address of Host 2
AMF_IP=10.2.22.137 # IP address of Host 1 (5GC)
SRS_GNB_IP=10.2.22.93 # IP address of Host 2
Step 9: Set Up the gNB
- Modify the
srsgnb_zmq.yaml
file to use host networking:
Replace:
networks:
default:
ipv4_address: ${SRS_GNB_IP}
networks:
default:
external:
name: docker_open5gs_default
with:
network_mode: host
- Deploy srsRAN ZMQ gNB:
docker compose -f srsgnb_zmq.yaml up -d && docker container attach srsgnb_zmq
Step 10: Set Up the UE
- Modify the
srsue_5g_zmq.yaml
file to use host networking(indent :
Replace:
networks:
default:
ipv4_address: ${SRS_UE_IP}
networks:
default:
external:
name: docker_open5gs_default
with:
network_mode: host
- Deploy srsRAN ZMQ UE (in a new terminal on Host 2):
docker compose -f srsue_5g_zmq.yaml up -d && docker container attach srsue_5g_zmq
Step 11: Verification
On Host 1 (5G Core - 10.2.22.137)
- Check if the AMF is receiving connections:
docker logs amf
- Check if the UPF is processing traffic:
docker logs upf
On Host 2 (gNB and UE - 10.2.22.93)
- Verify the gNB is connected to the AMF:
docker logs srsgnb_zmq
Look for messages indicating successful connection to the AMF.
- Verify the UE has registered with the network:
docker logs srsue_5g_zmq
- Check if the UE has received an IP address:
docker exec -it srsue_5g_zmq ip addr
- Test connectivity:
docker exec -it srsue_5g_zmq ping 8.8.8.8
Step 12: Troubleshooting
Network Connectivity
Verify both hosts can reach each other using ping:
# On Host 1
ping 10.2.22.93
# On Host 2
ping 10.2.22.137
Port Accessibility
Ensure the required ports are accessible between hosts:
# On Host 2, test AMF port access
nc -zv 10.2.22.137 38412
# On Host 2, test UPF port access
nc -zv 10.2.22.137 2152
Check Container Logs
# On Host 1
docker logs amf
docker logs upf
docker logs smf
# On Host 2
docker logs srsgnb_zmq
docker logs srsue_5g_zmq
Common Issues
- If the gNB cannot connect to AMF, check if SCTP protocol is supported on both hosts
- If the UE cannot connect to gNB, verify they're using compatible ZMQ parameters
- If the UE connects but has no internet, check the UPF configuration and routing
Firewall Check
Even though you disabled UFW, check if any other firewall is active:
sudo iptables -L
Summary
This two-host setup allows you to distribute the load between machines while still maintaining the full simulation environment. The 5G core components run on Host 1 (10.2.22.137), while both the gNB and UE simulation run on Host 2 (10.2.22.93). This configuration provides a scalable approach to 5G SA testing with RF simulation over ZMQ.
Success Indicators:
- "NG Setup Procedure Successful" message from gNB
- "TUN interface is up" message from UE
- Successful ping to external addresses (e.g., 8.8.8.8) from UE
- No packet loss in connectivity tests
gNB Connection Issues
If you're having trouble connecting to your gNB device, please use these reference configuration files and adjust the IP addresses according to your network setup:
Reference Configuration Files:
- gnb_and_ue_env.txt - Use this for gNB and UE environment
- coreenv.txt - Use this for core network environment
Rename the files to .env in both hosts before using them
Instructions:
- Download the appropriate reference file based on your setup
- Compare it with your current configuration
- Update the IP addresses to match your network topology
- Pay special attention to
DOCKER_HOST_IP
,AMF_IP
, andUPF_ADVERTISE_IP
settings
Key differences between the files:
- Different
DOCKER_HOST_IP
values (10.2.22.93 vs 10.2.22.137) - Different UE IP subnet ranges for internet and IMS APNs
- Different AMF IP configurations
Make sure all IP addresses are reachable and don't conflict with your existing network configuration.