Skip to content

Latest commit

 

History

2 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

srsRAN experiments with SDR

  • Setting up Debian networking for srsRAN depends on which component you're running (srsRAN Project for 5G, or srsRAN 4G)
  • The core networking requirements are similar. Here's a comprehensive guide:

Network Interfaces & Configuration

1. Install Required Packages

sudo apt update
sudo apt install iproute2 net-tools iptables tun-tools bridge-utils

2. TUN/TAP Interface (for EPC/Core)

srsRAN uses a TUN interface (srs_spgw_sgi or ogstun) to route UE traffic:

# Create TUN interface (usually done automatically by srsEPC or Open5GS)
sudo ip tuntap add name srs_spgw_sgi mode tun
sudo ip addr add 45.45.0.1/24 dev srs_spgw_sgi
sudo ip link set srs_spgw_sgi up

3. Enable IP Forwarding

# Temporary
sudo sysctl -w net.ipv4.ip_forward=1

# Permanent — add to /etc/sysctl.conf or /etc/sysctl.d/99-srsran.conf:
net.ipv4.ip_forward = 1
sudo sysctl -p

4. NAT / Masquerading

So UEs can reach the internet through your host:

# Replace eth0 with your actual uplink interface
sudo iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
sudo iptables -A FORWARD -i srs_spgw_sgi -j ACCEPT
sudo iptables -A FORWARD -o srs_spgw_sgi -j ACCEPT

To make iptables rules persist across reboots:

sudo apt install iptables-persistent
sudo netfilter-persistent save

Interface Between Components (S1/E1/F1/N2/N3)

srsRAN 4G (enb + epc on same host)

Communication happens over loopback by default — no special config needed. Just confirm:

# epc.conf
[spgw]
gtpu_bind_addr = 127.0.0.1

# enb.conf
[epc]
mme_addr = 127.0.0.1

srsRAN Project 5G (gNB + Open5GS/free5GC on same or different host)

# gnb.yml — AMF N2 interface
amf:
  addr: 127.0.0.5       # AMF address
  bind_addr: 127.0.0.1  # gNB local address

# N3 (user plane GTP-U)
gtpu:
  bind_addr: 127.0.0.1

If running on separate machines, replace loopback addresses with actual interface IPs and ensure the firewall allows:

  • N2: SCTP port 38412
  • N3: UDP port 2152 (GTP-U)
  • S1-MME: SCTP port 36412
# Open SCTP/UDP ports if using ufw
sudo ufw allow 38412/sctp
sudo ufw allow 2152/udp

Real-Time & Performance Tuning

srsRAN is latency-sensitive — network stack tuning helps:

# Increase socket buffer sizes in /etc/sysctl.d/99-srsran.conf
net.core.rmem_max = 25165824
net.core.wmem_max = 25165824
net.core.rmem_default = 25165824
net.core.wmem_default = 25165824

sudo sysctl -p /etc/sysctl.d/99-srsran.conf

Also disable offloading on your uplink NIC to reduce latency variance:

sudo ethtool -K eth0 gso off gro off tso off

Verifying Connectivity

# Check TUN is up
ip link show srs_spgw_sgi

# Watch GTP-U tunnel traffic
sudo tcpdump -i srs_spgw_sgi

# Verify forwarding rules
sudo iptables -t nat -L -v -n
sudo iptables -L FORWARD -v -n

# Check SCTP support (needed for N2/S1)
modprobe sctp
lsmod | grep sctp

Common Issues

Problem Fix
UE gets IP but no internet Check NAT masquerade rule and IP forwarding
gNB can't reach AMF Check SCTP is loaded (modprobe sctp)
High latency / packet loss Tune socket buffers; disable NIC offloading
TUN device missing Run srsEPC/Open5GS as root or with CAP_NET_ADMIN

About

Experiments setting up mobile networks and associated components

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages