Skip to content

AdityaKoranga/Open5GS-Dep-UEransim

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 

Repository files navigation

Open5GS-Deployment

  1. Github Repository
  2. Reference1
  3. Reference2

  • Create 2 VMs for Open5gs and UERANSIM like this.

  • Check the IP of each VM and note it down.

    ## to check the IP of a system
    ip a

  • Open the local terminal and connect each VM to the different terminals.

## connect to the VM
ssh <VM_login_name>@<VM_ip>

  • Make the IP address of each VM, static, to make it easier for customers to find you via DNS.
## to change ip
cd /etc/netplan/
ls
sudo vim 00-installer-config.yaml

Vim keys to use:
Press 'd' button to delete text.
Press ‘i’ button for insertion.
Press ‘ESC’ button to exit insertion.
Press ‘:x’ to save and exit.

  • A vim editor will open. Remove all context and paste the below context there. Then save and exit.
## change ip address of 'addresses field' as preferred by you
network:
 ethernets:
  enp1s0:
    addresses:
     - 192.168.122.245/24
    gateway4: 192.168.122.1
    nameservers:
      addresses:
      - 8.8.8.8
      - 8.8.4.4
      search: []
 version: 2

sudo netplan apply
  • The command is running in this terminal. So, open another terminal and login same VM again. And close the running terminal.

  • Do similar with the other VM.

  • First we deploy Open5gs then UERANSIM because we need Open5gs configuration in UERANSIM.

  • Run the following commands in a single terminal, logged in to a VM for Open5gs deployment.

Install Open5GS

sudo apt update
sudo apt install software-properties-common
sudo add-apt-repository ppa:open5gs/latest
sudo apt update
sudo apt install open5gs
  • Update the amf config
## to edit amf config 
sudo vim /etc/open5gs/amf.yaml 
  • Change the ngap address with your Open5gs IP and then save and exit.

sudo systemctl restart open5gs-amfd
  • Update the upf config
## to edit upf config 
sudo vim /etc/open5gs/upf.yaml 
  • Change the gtpu address with your Open5gs IP address and save it.

sudo systemctl restart open5gs-upfd

NAT(Network Address Translation) Port Forwarding

  • To create a connection between 5G Core and Internet, we need to enable IP forwarding and add a NAT rule to the IP Tables.
## change eth0 with your ethernet interface
## In my case it is enp1s0,

## en   --> ethernet 
## p1   --> bus number (1) 
## s0   --> slot number (0)

sudo sysctl -w net.ipv4.ip_forward=1
sudo iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
sudo systemctl stop ufw
sudo iptables -I FORWARD 1 -j ACCEPT
## to get your ethernet interface
ip a

Access Open5gs Dashboard

sudo apt update
sudo apt install curl
curl -fsSL https://deb.nodesource.com/setup_14.x | sudo -E bash -
sudo apt install nodejs
git clone https://github.com/open5gs/open5gs.git
cd open5gs/webui/
npm ci --no-optional && npm run build
npm run dev --host 0.0.0.0
  • Open a new terminal and run this command.
# run this command if you are on remote server and want to access dashboard locally
ssh -L localhost:3000:localhost:3000 open5gs_VMlogin_name@ip
  • Open any browser and search for this website: http://localhost:3000

  • Login credentials :
    username - admin
    password - 1423

  • Add new subscriber from dashboard :
    IMSI: 901700000000001,
    Subscriber Key: 465B5CE8B199B49FAA5F0A2EE238A6BC,
    USIM Type: OPc,
    Operator Key: E8ED289DEBA952E4283B54E88E6183CA

  • Or only type IMSI Number, rest will filled automatically.

  • On a new terminal, logged in to another VM for UERANSIM deployment.

Install UERANSIM

sudo apt update
sudo apt upgrade -y
sudo apt install iproute2
sudo snap install cmake --classic
sudo apt install gcc
sudo apt install g++
sudo apt install libsctp-dev
## clone ueransim
git clone https://github.com/aligungr/UERANSIM
cd UERANSIM
sudo apt install make
make

Setup gNB

  • Update the "linkIp", "ngapIp", "gtpIp" field with UERANSIM IP and change the amfConfigs address field with Open5gs IP and save it.
sudo vim config/open5gs-gnb.yaml 

cd UERANSIM/
sudo ./build/nr-gnb -c config/open5gs-gnb.yaml

Setup UE

  • Open a new terminal, logged in to same VM as used in gNB setup.

  • Update the "gnbSearchList" with the IP address of the UERANSIM.

sudo vim UERANSIM/config/open5gs-ue.yaml

cd UERANSIM/
sudo ./build/nr-ue -c config/open5gs-ue.yaml

Wireshark

  • Keep the last 2 terminals running gNB and UE setup opened.

  • Open another terminal and login to UERANSIM VM and run these commands to store the data packets.

## change ip field with your UERANSIM IP.
## file.pcap is the name of the file, you want to store packets. You can change the name of the file.
sudo tcpdump host <ip> -i any -w file.pcap
  • Open a new local terminal and run this command:
scp <UERANSIM-VMlogin-name>@<ip>:<location_of_the_file> <location_to_store_the_packets_in_the_local_device>
  • For example, in my case, it is:
scp s2@192.168.5.182:/home/UERANSIM/file.pcap /home/shubham/file.pcap
  • After sometime, stop the terminal running “sudo tcpdump host 192.168.122.11 -i any -w gNB1.pcap” command by pressing “shift+c” button.

  • The packets are stored in the pcap file.

  • Open the file in wireshark.

  • You can see the flow of data packets and protocols used.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published