Free5GC: Install: Difference between revisions

From OnnoCenterWiki
Jump to navigationJump to search
Line 74: Line 74:
Ikuti instruksi dari Part A ~ Part C.
Ikuti instruksi dari Part A ~ Part C.


Part A. Compile Source Code
===Part A. Compile Source Code===
Prerequisites
 
Menyiapkan aplikasi pendukung.
 
Install MongoDB 3.6.3, Golang 1.11.4.
Install MongoDB 3.6.3, Golang 1.11.4.


Line 82: Line 84:
  sudo systemctl start mongodb (if '/usr/bin/mongod' is not running)
  sudo systemctl start mongodb (if '/usr/bin/mongod' is not running)


# Check if golang is installed
Check apakah golang sudah di instalasi


  go version
  go version


# If not, run commands below
Jika belum, jalankan perintah di bawah ini,


  wget -q https://storage.googleapis.com/golang/getgo/installer_linux
  wget -q https://storage.googleapis.com/golang/getgo/installer_linux
Line 98: Line 100:
  go get -u -v "golang.org/x/sys/unix"
  go get -u -v "golang.org/x/sys/unix"


To run free5GC with least privilege, TUN device permission should be a crw-rw-rw-(666).
Untuk menjalankan free5GC dengan least privilege, TUN device permission harus crw-rw-rw-(666).


  ls -al /dev/net/tun
  ls -al /dev/net/tun
  crw-rw-rw- 1 root root 10, 200 Jan 14 13:09 /dev/net/tun
  crw-rw-rw- 1 root root 10, 200 Jan 14 13:09 /dev/net/tun


Write the configuration file for the TUN device.
Tulis file konfigurasi untuk TUN device.


  sudo sh -c "cat << EOF > /etc/systemd/network/99-free5gc.netdev
  sudo sh -c "cat << EOF > /etc/systemd/network/99-free5gc.netdev
Line 114: Line 117:
  sudo systemctl restart systemd-networkd
  sudo systemctl restart systemd-networkd


Check IPv6 Kernel Configuration. Although you can skip this step, we suggest that you set this up to support IPv6-enabled UE.
Cek konfigurasi IPv6 Kernel. Meskipun kita dapat melewati langkah ini, sangat di sarankan untuk set untuk mendukung IPv6-enabled UE.


  sysctl -n net.ipv6.conf.uptun.disable_ipv6
  sysctl -n net.ipv6.conf.uptun.disable_ipv6


(if the output is 0 and IPv6 is enabled, skip the followings)
(jika menghasilkan 0 maka IPv6 enable, kita bisa meloncati langkah berikut)


  sudo sh -c "echo 'net.ipv6.conf.uptun.disable_ipv6=0' > /etc/sysctl.d/30-free5gc.conf"
  sudo sh -c "echo 'net.ipv6.conf.uptun.disable_ipv6=0' > /etc/sysctl.d/30-free5gc.conf"
  sudo sysctl -p /etc/sysctl.d/30-free5gc.conf
  sudo sysctl -p /etc/sysctl.d/30-free5gc.conf


You are now ready to set the IP address on TUN device. If IPv6 is disabled for TUN device, please remove Address=cafe::1/64 from below.
Saat ini kita siap untuk menset IP address pada TUN device. Jika IPv6 di disabled untuk TUN device, maka kita perlu menghilangkan address=cafe::1/64 from konfigurasi di bawah.


  sudo sh -c "cat << EOF > /etc/systemd/network/99-free5gc.network
  sudo sh -c "cat << EOF > /etc/systemd/network/99-free5gc.network
Line 136: Line 139:
  sudo systemctl restart systemd-networkd
  sudo systemctl restart systemd-networkd


Add the following lines into /etc/network/interfaces for network-manager service
Tambahkan kalimat-kalimat berikut ke /etc/network/interfaces untuk network-manager service


  auto uptun
  auto uptun
Line 147: Line 150:
  address cafe::1
  address cafe::1
  netmask 64
  netmask 64
Restart uptun interface
Restart uptun interface


Line 152: Line 156:
  sudo systemctl restart networking
  sudo systemctl restart networking


# Check if uptun is up
Check apakah uptun sudah up


  sudo apt-get -y install net-tools
  sudo apt-get -y install net-tools
  ifconfig uptun
  ifconfig uptun


AMF, SMF, UPF, HSS, and PCRF
====AMF, SMF, UPF, HSS, dan PCRF====
Install the depedencies for building the source
 
Instal depedency untuk membuat dari source


  sudo apt-get -y install autoconf libtool gcc pkg-config git flex bison libsctp-dev libgnutls28-dev libgcrypt-dev libssl-dev  
  sudo apt-get -y install autoconf libtool gcc pkg-config git flex bison libsctp-dev libgnutls28-dev libgcrypt-dev libssl-dev  
  libidn11-dev libmongoc-dev libbson-dev libyaml-dev
  libidn11-dev libmongoc-dev libbson-dev libyaml-dev


Git clone and compile
Git clone dan compile


  git clone https://bitbucket.org/nctu_5g/free5gc-stage-1.git
  git clone https://bitbucket.org/nctu_5g/free5gc-stage-1.git
Line 172: Line 177:
  make install
  make install


Part B. VM Internal Network Environment Setting
===Part B. VM Internal Network Environment Setting===
[Option 1] Need to run on every boot
 
[Option 1] perlu menjalankan secara manual setiap kali boot,


  sudo ifconfig ens4 192.188.2.2
  sudo ifconfig ens4 192.188.2.2
Line 180: Line 186:
  sudo iptables -I INPUT -i uptun -j ACCEPT
  sudo iptables -I INPUT -i uptun -j ACCEPT


[Option 2] or configure as auto run on boot
[Option 2] di konfigurasi untuk auto run saat boot


  sudo sh -c "cat << EOF > /etc/init.d/ngc-network-setup
  sudo sh -c "cat << EOF > /etc/init.d/ngc-network-setup
Line 208: Line 214:
  sudo ln -s /etc/init.d/ngc-network-setup /etc/rc5.d/S99ngc-network-setup
  sudo ln -s /etc/init.d/ngc-network-setup /etc/rc5.d/S99ngc-network-setup


Part C. Run
===Part C. Run===
Run in all-in-one mode
 
====Run in all-in-one mode====
 
The daemon free5gc-ngcd includes AMF, SMF, UPF, HSS, and PCRF. Thus, instead of running all 5 daemons, you can just run free5gc-ngcd in your development environment.
The daemon free5gc-ngcd includes AMF, SMF, UPF, HSS, and PCRF. Thus, instead of running all 5 daemons, you can just run free5gc-ngcd in your development environment.


Line 219: Line 227:
You can find the log/conf path at the beginning of the running screen.
You can find the log/conf path at the beginning of the running screen.
You can user -f argument to specify config file to be used.
You can user -f argument to specify config file to be used.
Run functions separately
 
====Run functions separately====
 
We also provide 5GC functions running separately.
We also provide 5GC functions running separately.


Line 235: Line 245:
  ./test/testngc -f install/etc/free5gc/test/free5gc.testngc.conf
  ./test/testngc -f install/etc/free5gc/test/free5gc.testngc.conf


Part D. Web User Interface
===Part D. Web User Interface===
 
Install Node.js and NPM
Install Node.js and NPM


Line 254: Line 265:
Now the web server is running on http://localhost:3000. The default username and password are “admin” and “1423”.
Now the web server is running on http://localhost:3000. The default username and password are “admin” and “1423”.


Core Network Configuration
==Core Network Configuration==
 
free5GC configuration file
free5GC configuration file
Modify ./install/etc/free5gc/free5gc.conf
Modify ./install/etc/free5gc/free5gc.conf
Line 289: Line 301:
         tac: <eNB TAC: 1>
         tac: <eNB TAC: 1>


Add subscriber (UE)
==Add subscriber (UE)==
 
Add a subscriber by the Web UI
Add a subscriber by the Web UI
Run the web server:
Run the web server:
Line 306: Line 319:
This addition will take effect immediately on free5GC without restaring any daemon.
This addition will take effect immediately on free5GC without restaring any daemon.


Rebuild Project
==Rebuild Project==
 
To completely rebuild the project after modifying source code
To completely rebuild the project after modifying source code


Line 319: Line 333:
  ./free5gc-ngcd
  ./free5gc-ngcd


Troubleshooting
==Troubleshooting==
 
Note for modifying configuration file
Note for modifying configuration file
Use space for indent. DO NOT use tab.
Use space for indent. DO NOT use tab.

Revision as of 06:07, 14 December 2022

Sumber: https://www.free5gc.org/installations/stage-1-all-in-one/


Kebutuhan Minimal

Software

  • OS: Ubuntu 18.04
  • Linux kernel: 4.15.0-43-generic
  • gcc 7.3.0
  • Go 1.11.4
  • QEMU emulator 2.11.1

Hardware

  • CPU: Intel i5 processor
  • RAM: 4GB
  • Hard drive: 160G
  • NIC card: 1Gbps ethernet card

Hardware recommended

  • CPU: Intel i7 processor
  • RAM: 8GB
  • Hard drive: 160G
  • NIC card: 10Gbps ethernet card

Hardware Tested

eNB

  • WNC OSQ4G-01E2, 3GPP Rel-13 compliance (4G LTE Small Cell)
  • D-Link DWR-1012, 3GPP Rel-12 compliance (4G LTE Small Cell)
  • GemTek WLTGFC-101, 3GPP Rel-9 compliance (4G LTE Small Cell)

UE

  • LG C90 cellular phone
  • D-Link DWR-932C dongle via USB cable

Persiapan

Setup KVM Environment

  • VM NIC Cards
    • NIC for connecting to the Internet
      • Network source: Virtual network - NAT
      • Interface name in VM: ens3 (in this example)
    • NIC for connecting to eNB:
      • Network source: Host device <Host Interface Name>
      • Interface name in VM: ens4 (in this example)

Kumpulan Informasi konfigurasi eNodeB dan USIM

Informasi eNodeB (dalam contoh ini)

IP Address: 192.188.2.1
Gateway:    192.188.2.2 (IP NIC yang tersambung ke eNB)
PLMN:
  MCC: 208
  MNC: 93
MME GID:  1
MME Code: 1
TAC: 1

Informasi USIM (dalam contoh ini)

IMSI 208930000000003
K    8baf473f2f8fd09487cccbd7097c6862
OPc  8e27b6af0e692e750f32667a3b14605d

Instalasi

Ikuti instruksi dari Part A ~ Part C.

Part A. Compile Source Code

Menyiapkan aplikasi pendukung.

Install MongoDB 3.6.3, Golang 1.11.4.

sudo apt-get update
sudo apt-get -y install mongodb wget git
sudo systemctl start mongodb (if '/usr/bin/mongod' is not running)

Check apakah golang sudah di instalasi

go version

Jika belum, jalankan perintah di bawah ini,

wget -q https://storage.googleapis.com/golang/getgo/installer_linux
chmod +x installer_linux
./installer_linux
source ~/.bash_profile
rm -f installer_linux
go get -u -v "github.com/gorilla/mux"
go get -u -v "golang.org/x/net/http2"
go get -u -v "golang.org/x/sys/unix"

Untuk menjalankan free5GC dengan least privilege, TUN device permission harus crw-rw-rw-(666).

ls -al /dev/net/tun
crw-rw-rw- 1 root root 10, 200 Jan 14 13:09 /dev/net/tun

Tulis file konfigurasi untuk TUN device.

sudo sh -c "cat << EOF > /etc/systemd/network/99-free5gc.netdev
[NetDev]
Name=uptun
Kind=tun
EOF"
sudo systemctl enable systemd-networkd
sudo systemctl restart systemd-networkd

Cek konfigurasi IPv6 Kernel. Meskipun kita dapat melewati langkah ini, sangat di sarankan untuk set untuk mendukung IPv6-enabled UE.

sysctl -n net.ipv6.conf.uptun.disable_ipv6

(jika menghasilkan 0 maka IPv6 enable, kita bisa meloncati langkah berikut)

sudo sh -c "echo 'net.ipv6.conf.uptun.disable_ipv6=0' > /etc/sysctl.d/30-free5gc.conf"
sudo sysctl -p /etc/sysctl.d/30-free5gc.conf

Saat ini kita siap untuk menset IP address pada TUN device. Jika IPv6 di disabled untuk TUN device, maka kita perlu menghilangkan address=cafe::1/64 from konfigurasi di bawah.

sudo sh -c "cat << EOF > /etc/systemd/network/99-free5gc.network
[Match]
Name=uptun
[Network]
Address=45.45.0.1/16
Address=cafe::1/64
EOF"
sudo systemctl enable systemd-networkd
sudo systemctl restart systemd-networkd

Tambahkan kalimat-kalimat berikut ke /etc/network/interfaces untuk network-manager service

auto uptun
iface uptun inet static  
	address 45.45.0.1 
	netmask 255.255.0.0

iface uptun inet6 static
	pre-up modprobe ipv6 
	address cafe::1
	netmask 64

Restart uptun interface

sudo ip a flush uptun
sudo systemctl restart networking

Check apakah uptun sudah up

sudo apt-get -y install net-tools
ifconfig uptun

AMF, SMF, UPF, HSS, dan PCRF

Instal depedency untuk membuat dari source

sudo apt-get -y install autoconf libtool gcc pkg-config git flex bison libsctp-dev libgnutls28-dev libgcrypt-dev libssl-dev 
libidn11-dev libmongoc-dev libbson-dev libyaml-dev

Git clone dan compile

git clone https://bitbucket.org/nctu_5g/free5gc-stage-1.git
cd free5gc-stage-1
autoreconf -iv
./configure --prefix=`pwd`/install
make -j `nproc`
make install

Part B. VM Internal Network Environment Setting

[Option 1] perlu menjalankan secara manual setiap kali boot,

sudo ifconfig ens4 192.188.2.2
sudo sh -c 'echo 1 > /proc/sys/net/ipv4/ip_forward'
sudo iptables -t nat -A POSTROUTING -o ens3 -j MASQUERADE
sudo iptables -I INPUT -i uptun -j ACCEPT

[Option 2] di konfigurasi untuk auto run saat boot

sudo sh -c "cat << EOF > /etc/init.d/ngc-network-setup
#!/bin/sh
### BEGIN INIT INFO
# Provides:          ngc-network-setup
# Required-Start:    networkd
# Required-Stop:     networkd
# Default-Start:     networkd
# Default-Stop:      networkd
# Short-Description:
# Description:
#
### END INIT INFO

ifconfig ens4 192.188.2.2
sh -c 'echo 1 > /proc/sys/net/ipv4/ip_forward'
iptables -t nat -A POSTROUTING -o ens3 -j MASQUERADE
iptables -I INPUT -i uptun -j ACCEPT
EOF"

sudo chmod 755 /etc/init.d/ngc-network-setup
sudo /etc/init.d/ngc-network-setup

sudo ln -s /etc/init.d/ngc-network-setup /etc/rc3.d/S99ngc-network-setup
sudo ln -s /etc/init.d/ngc-network-setup /etc/rc4.d/S99ngc-network-setup
sudo ln -s /etc/init.d/ngc-network-setup /etc/rc5.d/S99ngc-network-setup

Part C. Run

Run in all-in-one mode

The daemon free5gc-ngcd includes AMF, SMF, UPF, HSS, and PCRF. Thus, instead of running all 5 daemons, you can just run free5gc-ngcd in your development environment.

./free5gc-ngcd

While running free5gc-ngcd All logs for AMF, SMF, UPF, HSS, and PCRF are written to ./install/var/log/free5gc/free5gc.log. All settings are managed in one place for ./install/etc/free5gc/free5gc.conf. You can find the log/conf path at the beginning of the running screen. You can user -f argument to specify config file to be used.

Run functions separately

We also provide 5GC functions running separately.

./free5gc-upfd
./free5gc-amfd
./free5gc-smfd
./nextepc-hssd
./nextepc-pcrfd

Note: We also provide a reference for 5GC functions running in separate machines.

[Optional] Self-test We provide a program that checks whether the installation is correct. After running the wireshark, select loopback interface, and then filter s1ap || diameter || gtpv2 || gtp and run ./test/testngc. You can see the packets virtually created.

./test/testngc -f install/etc/free5gc/test/free5gc.testngc.conf

Part D. Web User Interface

Install Node.js and NPM

sudo apt-get -y install curl
curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash -
sudo apt-get -y install nodejs

Install the dependencies to run WebUI (first time)

cd webui
npm install

Run WebUI

cd webui
npm run dev

Now the web server is running on http://localhost:3000. The default username and password are “admin” and “1423”.

Core Network Configuration

free5GC configuration file Modify ./install/etc/free5gc/free5gc.conf

amf-slap address (line 67)

amf:
  s1ap:
    addr: <IP of GW NIC to eNB: 192.188.2.2>

upf-gtpu address (line 162)

smf:
  upf:
    addr: <IP of GW NIC to eNB: 192.188.2.2>

AMF GUMMEI (line 91)

amf:
  gummei:
    plmn_id:
      mcc: <eNB MCC: 208>
            mnc: <eNB MNC: 93>
    mme_gid: <eNB MME GID: 1>
    mme_code: <eNB MME Code: 1>    

AMF TAI (line 130)

amf:
  tai:
    plmn_id:
      mcc: <eNB MCC: 208>
            mnc: <eNB MNC: 93>
        tac: <eNB TAC: 1>

Add subscriber (UE)

Add a subscriber by the Web UI Run the web server:

cd ./webui && npm run dev

Visit http://localhost:3000

 - Username : admin
 - Password : 1423

Add a subscriber with IMSI, K, OPc

 - Go to Subscriber Menu.
 - Click `+` Button to add a new subscriber.
 - Fill the IMSI, security context(K, OPc, AMF), and APN of the subscriber.
 - Click `SAVE` Button

This addition will take effect immediately on free5GC without restaring any daemon.

Rebuild Project

To completely rebuild the project after modifying source code

(Control-C kill free5gc-ngcd)
make maintainer-clean
rm -rf ./install
git pull
autoreconf -iv
./configure --prefix=`pwd`/install
make -j `nproc`
make install
./free5gc-ngcd

Troubleshooting

Note for modifying configuration file Use space for indent. DO NOT use tab. A white space must be added between the colon and value after the item name, e.g. addr: 192.188.2.2

./test/testngc test failure

Make sure all configuration files and environment settings are correct.

Kill testngc process which didn’t finish correctly

killall -9 testngc

Remove test subscriber left by previous failed test (NextEPC issue #57)

$ mongo
> use free5gc
> db.subscribers.find()  ### (Check the test subscriber)
> db.subscribers.drop()  ### Remove all subscriber
> db.subscribers.find()  ### (Check that all subscribers are empty)
./free5gc-ngcd errors

ERRR: - The certificate is expired (NextEPC issue #94)

cd support/freeDiameter
./make_certs.sh .
cd ../..
make install

Address already in use

$ killall -9 testngc

or

$ killall -9 free5gc-ngcd

Rebuild failure

config.status: error: cannot find input file: `Makefile.in' (NextEPC issue #68)
autoheader \
    && aclocal \
    && libtoolize --ltdl --copy --force \
    && automake --add-missing --copy \
    && autoconf \
    && ./configure

Appendix A: Program the SIM Card

Install packages:

sudo apt-get install pcscd pcsc-tools libccid python-dev swig python-setuptools python-pip libpcsclite-dev
sudo pip install pycrypto

Download PySIM

git clone git://git.osmocom.org/pysim.git

Change to pyscard folder and install

cd <pyscard-path>
sudo /usr/bin/python setup.py build_ext install

Verify your reader is ready

sudo pcsc_scan

Check whether your reader can read the SIM card

cd <pysim-path>
./pySim-read.py –p 0

Program your SIM card information

./pySim-prog.py -p 0 -x 208 -y 93 -t sysmoUSIM-SJS1 -i 208930000000003 --op=8e27b6af0e692e750f32667a3b14605d -k 8baf473f2f8fd09487cccbd7097c6862 -s 8988211000000088313 -a 23605945

You can get your SIM card from sysmocom. You also need a card reader to write your SIM card. You can get a card reader from here or equivalent device will do.

Referensi

Pranala Menarik