---
# System prepended metadata

title: srsRAN

---

# srsRAN setup
## srsRAN installation
#### Install libraries
```bash!
sudo apt install -y libzmq3-dev libczmq-dev libmbedtls-dev libpcsclite-dev libbladerf-dev soapysdr-module-all soapysdr-tools libconfig++-dev lksctp-tools libsctp-dev
```

#### Compile srsRAN 4G
```bash!
git clone https://github.com/srsRAN/srsRAN_4G.git && cd srsRAN_4G && mkdir build && cd build && cmake ../ && make -j$(nproc)
```

#### Network namespace creation
```bash!
sudo ip netns add ue1 && sudo ip netns list
```

#### Copy configuration files
```bash!
mkdir ~/.config/srsran && find ~/srsRAN_4G -type f -name "*.conf.example" -exec sh -c 'cp "$1" ~/.config/srsran/$(basename "$1" .example)' _ {} \; && cp ~/srsRAN_4G/srsepc/user_db.csv.example ~/.config/srsran/user_db.csv
```

## Run srsRAN
#### EPC
```bash=
cd srsRAN_4G/build
sudo ./srsepc/src/srsepc
```
![{B4949A43-6C11-459C-9114-03BA899EC871}](https://hackmd.io/_uploads/B1Nj0N6xyx.png)

#### eNB
```bash=
sudo ./srsenb/src/srsenb --rf.device_name=zmq --rf.device_args="fail_on_disconnect=true,tx_port=tcp://*:2000,rx_port=tcp://localhost:2001,id=enb,base_srate=23.04e6"
```
![{E5D0A2F0-F219-43C7-BF0C-90A069596F9C}](https://hackmd.io/_uploads/BkyhkBTxkx.png)
> EPC
![{60F446C2-7140-48B7-863A-C816C0889068}](https://hackmd.io/_uploads/BJc1lHplJg.png)

#### UE
```bash=
sudo ./srsue/src/srsue --rf.device_name=zmq --rf.device_args="tx_port=tcp://*:2001,rx_port=tcp://localhost:2000,id=ue,base_srate=23.04e6" --gw.netns=ue1
```
![{33D335AA-9F2A-4072-BD7B-EDB62C4DD77A}](https://hackmd.io/_uploads/rJowlrpgye.png)
> EPC
> ![{112A073D-FA1B-4042-B156-19D4C68E8DF6}](https://hackmd.io/_uploads/HkGngraxyg.png)

> eNB
> ![{6CC72139-69BD-4FD1-A17F-28A70512701D}](https://hackmd.io/_uploads/HyAfbragke.png)

# Lab
## Test traffic
#### Downlink
```bash=
ping 172.16.0.2
```
![{7F6FA272-359D-48DC-9290-17D34206DC4F}](https://hackmd.io/_uploads/B1DiWrTeJg.png)
> EPC
![{6661D61B-A171-4D70-95F5-2CB7DAF8B30A}](https://hackmd.io/_uploads/SyyrMH6ekg.png)

> eNB
![{3355D5F3-8FC6-43A2-96AF-4882E8F674D6}](https://hackmd.io/_uploads/SkhYMS6xyx.png)

> UE
![{69E9BE25-B715-4FC6-9B0F-77ACF7A4CF39}](https://hackmd.io/_uploads/HJolMrTgkx.png)

#### Uplink
```bash=
sudo ip netns exec ue1 ping 172.16.0.1
```
![{2184722B-4637-4A92-8F48-BD4482A93079}](https://hackmd.io/_uploads/rJcFBraekx.png)
> eNB
![{46976E86-32A5-4800-AAA8-C68808005602}](https://hackmd.io/_uploads/H1PRHSpgye.png)

## Test USRP
#### USRP setup
> [same process](https://hackmd.io/@intJoon/rkmtmeae1l#Device-setup) as OAI network.

#### Phone telecom configuration
> epc.conf -> mcc mnc
```bash=
sudo vim .config/srsran/epc.conf 
```
```bash=31
mcc = 466
mnc = 92
```
> enb.conf -> mcc mnc earfcn
```bash=
sudo vim .config/srsran/enb.conf 
```
```bash=23
mcc = 466
mnc = 92
```
> note that '#' removed
```bash=66
dl_earfcn = 1400
```

#### Restart srsRAN & Toggle airplane mode on your phone
> note that only EPC and eNB is needed
> -> your phone is UE for this lab

> EPC
> ![image](https://hackmd.io/_uploads/rkyFM2xM1e.jpg)
> ![image](https://hackmd.io/_uploads/Skul7f6xyg.png)
> No Service

#
> [name=Joon]
> 
> experiment environment: 
> > software:
> Ubuntu 18.04.6 LTS (amd64)
> VMware Workstation 17 Player (Non-commercial)
> Windows 11
> 
> > hardware:
> > > srsRAN setup:
> intel CPU
> NVIDIA GPU
> >
> > > Lab:
> intel NUC
> USRP
> iPhone 11 Pro
> 
> reference:
> [chatGPT](https://chatgpt.com/)
>
> based on:
> [srsRAN 4G with ZMQ Virtual Radios](https://docs.srsran.com/projects/4g/en/next/app_notes/source/zeromq/source/index.html)