Difference between revisions of "Free5GC: Install"

From OnnoWiki
Jump to navigation Jump to search
 
(17 intermediate revisions by 2 users not shown)
Line 1: Line 1:
A. Prerequisites
+
Sumber: https://www.free5gc.org/installations/stage-1-all-in-one/
Linux Kernel Version
 
  
In order to use the UPF element, you must use the 5.0.0-23-generic or 5.4.x version of the Linux kernel. free5gc uses the gtp5g kernel module, which has been tested and compiled against that kernel versions only. If you installed
 
Ubuntu 20.04, the version looks like 5.4.x. To determine the version of the Linux kernel you are using:
 
    $ uname -r
 
    5.4.0-65-generic
 
You will not be able to run most of the tests in Test section unless you deploy a UPF.
 
  
Golang Version
+
==Kebutuhan Minimal==
  
As noted above, free5gc is built and tested with Go 1.14.4
+
'''Software'''
To check the version of Go on your system, from a command prompt:
 
    go version
 
If another version of Go is installed, remove the existing version and install Go 1.14.4:
 
    # this assumes your current version of Go is in the default location
 
    sudo rm -rf /usr/local/go
 
    wget https://dl.google.com/go/go1.14.4.linux-amd64.tar.gz
 
    sudo tar -C /usr/local -zxvf go1.14.4.linux-amd64.tar.gz
 
If Go is not installed on your system:
 
    wget https://dl.google.com/go/go1.14.4.linux-amd64.tar.gz
 
    sudo tar -C /usr/local -zxvf go1.14.4.linux-amd64.tar.gz
 
    mkdir -p ~/go/{bin,pkg,src}
 
    # The following assume that your shell is bash
 
    echo 'export GOPATH=$HOME/go' >> ~/.bashrc
 
    echo 'export GOROOT=/usr/local/go' >> ~/.bashrc
 
    echo 'export PATH=$PATH:$GOPATH/bin:$GOROOT/bin' >> ~/.bashrc
 
    echo 'export GO111MODULE=auto' >> ~/.bashrc
 
    source ~/.bashrc
 
Further information and installation instructions for golang are available at the official golang site.
 
Control-plane Supporting Packages
 
  
sudo apt -y update
+
* OS: Ubuntu 18.04
sudo apt -y install mongodb wget git
+
* Linux kernel: 4.15.0-43-generic
sudo systemctl start mongodb
+
* gcc 7.3.0
WARNING: MongoDB 5.0+ requires a CPU with AVX support. Or downgrade your MongoDB to 4.4
+
* Go 1.11.4
 +
* QEMU emulator 2.11.1
  
see https://www.mongodb.com/community/forums/t/mongodb-5-0-cpu-intel-g4650-compatibility/116610/2
+
'''Hardware'''
  
see also docker-library/mongo#485 (comment)
+
* CPU: Intel i5 processor
 +
* RAM: 4GB
 +
* Hard drive: 160G
 +
* NIC card: 1Gbps ethernet card
  
User-plane Supporting Packages
+
'''Hardware recommended'''
sudo apt -y update
 
sudo apt -y install git gcc g++ cmake autoconf libtool pkg-config libmnl-dev libyaml-dev
 
Linux Host Network Settings
 
sudo sysctl -w net.ipv4.ip_forward=1
 
sudo iptables -t nat -A POSTROUTING -o <dn_interface> -j MASQUERADE
 
sudo iptables -A FORWARD -p tcp -m tcp --tcp-flags SYN,RST SYN -j TCPMSS --set-mss 1400
 
sudo systemctl stop ufw
 
  
B. Install Control Plane Elements
+
* CPU: Intel i7 processor
Clone the free5GC repository
+
* RAM: 8GB
 +
* Hard drive: 160G
 +
* NIC card: 10Gbps ethernet card
  
To install the latest stable build (v3.2.1):
+
==Hardware Tested==
    cd ~
 
    git clone --recursive -b v3.2.1 -j `nproc` https://github.com/free5gc/free5gc.git
 
    cd free5gc
 
(Alternatively) to install the latest nightly build:
 
    cd ~/free5gc
 
    git checkout main
 
    git submodule sync
 
    git submodule update --init --jobs `nproc`
 
    git submodule foreach git checkout main
 
    git submodule foreach git pull --jobs `nproc`
 
Compile network function services in free5gc
 
  
  To do so individually (e.g., AMF only):
+
'''eNB'''
    cd ~/free5gc
+
 
    make amf
+
* WNC OSQ4G-01E2, 3GPP Rel-13 compliance (4G LTE Small Cell)
  To build all network functions:
+
* D-Link DWR-1012, 3GPP Rel-12 compliance (4G LTE Small Cell)
     cd ~/free5gc
+
* GemTek WLTGFC-101, 3GPP Rel-9 compliance (4G LTE Small Cell)
    make
+
 
 +
'''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====
 +
 
 +
Aplikasi (daemon) free5gc-ngcd termasuk di dalamnya AMF, SMF, UPF, HSS, dan PCRF. Jadi, daripada menjalankan semua 5 daemon, kita bisa menjalankan free5gc-ngcd di development environment kita.
 +
 
 +
 
 +
./free5gc-ngcd
 +
 
 +
Saat running free5gc-ngcd
 +
* Semua log dari AMF, SMF, UPF, HSS, dan PCRF akan di tulis ke ./install/var/log/free5gc/free5gc.log.
 +
* Semua setting akan di managed dari satu file ./install/etc/free5gc/free5gc.conf.
 +
* Kita akan melihat path log/conf di awal screen saat running.
 +
* Kita dapat menggunakan argumen -f untuk menentukan config file yang akan digunakan.
 +
 
 +
====Fungsi 5GC di jalankan terpisah====
 +
 
 +
Sebetulnya fungsi 5GC dapat dijalankan secara terpisah.
 +
 
 +
./free5gc-upfd
 +
./free5gc-amfd
 +
./free5gc-smfd
 +
./nextepc-hssd
 +
./nextepc-pcrfd
 +
 
 +
Catatan: kita juga dapat menjalankan fungsi 5GC yang di mesin terpisah.
 +
 
 +
'''[Optional] Self-test'''
 +
 
 +
Pengembang 5GC juga menyediakan program yang memeriksa apakah penginstalan sudah benar. Setelah menjalankan wireshark, pilih interface loopback, lalu filter s1ap || diameter || gtpv2 || gtp dan jalankan,
 +
 
 +
./test/testngc
 +
 
 +
atau
 +
 
 +
./test/testngc -f install/etc/free5gc/test/free5gc.testngc.conf
 +
 
 +
Kita dapat melihat paket-paket dibuat secara virtual.
 +
 
 +
===Part D. Web User Interface===
 +
 
 +
Install Node.js dan 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 dependency untuk run WebUI (pertama kali)
 +
 
 +
cd webui
 +
npm install
 +
 
 +
Run WebUI
 +
 
 +
cd webui
 +
npm run dev
 +
 
 +
Sekarang server web berjalan di http://localhost:3000. username dan password default adalah "admin" dan "1423".
 +
 
 +
==Konfigurasi Core Network==
 +
 
 +
file konfigurasi free5GC
 +
Ubah ./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)
 
   
 
   
C. Install User Plane Function (UPF)
+
  smf:
As noted above, the GTP kernel module used by the UPF requires that you use Linux kernel version 5.0.0-23-generic or 5.4.x. To verify your version:
+
    upf:
  uname -r
+
      addr: <IP of GW NIC to eNB: 192.188.2.2>
  Retrieve the 5G GTP-U kernel module using git and build it
+
   
git clone https://github.com/free5gc/gtp5g.git
+
AMF GUMMEI (line 91)
cd gtp5g
+
   
make
+
  amf:
sudo make install
+
    gummei:
Build the UPF (you may skip this step if you built all network functions above):
+
      plmn_id:
 +
        mcc: <eNB MCC: 208>
 +
              mnc: <eNB MNC: 93>
 +
      mme_gid: <eNB MME GID: 1>
 +
      mme_code: <eNB MME Code: 1>   
  
to build using make:
+
AMF TAI (line 130)
cd ~/free5gc
 
make upf
 
Customize the UPF as desired. The UPF configuration file in run.sh is free5gc/config/upfcfg.yaml.
 
  
D. Install WebConsole
+
  amf:
  Before building WebConsole, install nodejs and yarn packages first:
+
    tai:
  sudo apt remove cmdtest
+
      plmn_id:
  sudo apt remove yarn
+
        mcc: <eNB MCC: 208>
  curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
+
              mnc: <eNB MNC: 93>
  echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
+
          tac: <eNB TAC: 1>
  curl -sL https://deb.nodesource.com/setup_12.x | sudo -E bash -
+
 
sudo apt-get update
+
==Tambahkan subscriber (UE)==
sudo apt-get install -y nodejs yarn
+
 
Build WebConsole
+
Tambahkan subscriber melalui Web UI
 +
Run web server:
 +
 
 +
cd ./webui && npm run dev
 +
 
 +
Masuk ke http://localhost:3000
 +
* Username : admin
 +
* Password : 1423
 +
 
 +
Tambahkan subscriber dengan IMSI, K, OPc
 +
* Masuk ke menu Subscriber.
 +
* Click Tombol `+` untuk menambahkan subscriber baru.
 +
* Isi IMSI, security context(K, OPc, AMF), dan APN dari subscriber.
 +
* Click Tombol `SAVE`
 +
 
 +
Penambahan ini akan langsung berlaku di free5GC tanpa perlu me-restart daemon apa pun.
 +
 
 +
==Rebuild Project==
 +
 
 +
Untuk sepenuhnya membangun kembali proyek setelah memodifikasi 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==
 +
 
 +
Catatan untuk memodifikasi file konfigurasi
 +
* Gunakan spasi untuk indent. JANGAN gunakan tab.
 +
* Spasi harus ditambahkan di antara titik dua dan nilai setelah nama item, mis. addr: 192.188.2.2
 +
 
 +
Jalankan,
 +
 
 +
 
 +
  ./test/testngc test failure
 +
 
 +
Pastikan semua file konfigurasi dan pengaturan lingkungan sudah benar.
 +
 
 +
Kill semua proses testngc yang tidak selesai dengan benar
 +
 
 +
 
 +
killall -9 testngc
 +
 
 +
 
 +
Hapus test subscriber yang ditinggalkan oleh pengujian gagal sebelumnya (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: - certificate expire (NextEPC issue #94)
 +
 
 +
cd support/freeDiameter
 +
./make_certs.sh .
 +
cd ../..
 +
make install
 +
 
 +
Address telah digunakan
 +
 
 +
$ killall -9 testngc
 +
 
 +
atau
 +
 
 +
$ killall -9 free5gc-ngcd
 +
 
 +
Kegagalan Rebuild
 +
 
 +
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 package:
 +
 
 +
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
 +
 
 +
CD ke folder pyscard dan install
 +
 
 +
cd <pyscard-path>
 +
sudo /usr/bin/python setup.py build_ext install
 +
 
 +
Verify bahwa reader kita sudah siap
 +
 
 +
sudo pcsc_scan
 +
 
 +
Cek apakah reader kita dapat membaca SIM card
 +
 
 +
cd <pysim-path>
 +
./pySim-read.py –p 0
 +
 
 +
Program / isi SIM card dengan information
 +
 
 +
  ./pySim-prog.py -p 0 -x 208 -y 93 -t sysmoUSIM-SJS1 -i 208930000000003 --op=8e27b6af0e692e750f32667a3b14605d -k 8baf473f2f8fd09487cccbd7097c6862 -s 8988211000000088313 -a 23605945
 +
 
 +
Anda bisa mendapatkan kartu SIM Anda dari sysmocom. Anda juga memerlukan pembaca kartu untuk menulis kartu SIM Anda. Anda bisa mendapatkan pembaca kartu dari sini atau perangkat yang setara akan melakukannya.
 +
 
 +
==Referensi==
 +
 
 +
* https://www.free5gc.org/installations/stage-1-all-in-one/
  
to build using make:
+
==Pranala Menarik==
cd ~/free5gc
 
make webconsole
 
(Alternatively) to build manually:
 
cd ~/free5gc/webconsole/frontend
 
yarn install
 
yarn build
 
rm -rf ../public
 
cp -R build ../public
 
cd ..
 
go build -o bin/webconsole server.go
 
  
Note: 2GB or more of OS memory is recommended. WebConsole may be failed to build if memory is less then 1GB.
+
* [[5G]]

Latest revision as of 09:14, 21 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

Aplikasi (daemon) free5gc-ngcd termasuk di dalamnya AMF, SMF, UPF, HSS, dan PCRF. Jadi, daripada menjalankan semua 5 daemon, kita bisa menjalankan free5gc-ngcd di development environment kita.


./free5gc-ngcd

Saat running free5gc-ngcd

  • Semua log dari AMF, SMF, UPF, HSS, dan PCRF akan di tulis ke ./install/var/log/free5gc/free5gc.log.
  • Semua setting akan di managed dari satu file ./install/etc/free5gc/free5gc.conf.
  • Kita akan melihat path log/conf di awal screen saat running.
  • Kita dapat menggunakan argumen -f untuk menentukan config file yang akan digunakan.

Fungsi 5GC di jalankan terpisah

Sebetulnya fungsi 5GC dapat dijalankan secara terpisah.

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

Catatan: kita juga dapat menjalankan fungsi 5GC yang di mesin terpisah.

[Optional] Self-test

Pengembang 5GC juga menyediakan program yang memeriksa apakah penginstalan sudah benar. Setelah menjalankan wireshark, pilih interface loopback, lalu filter s1ap || diameter || gtpv2 || gtp dan jalankan,

./test/testngc

atau

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

Kita dapat melihat paket-paket dibuat secara virtual.

Part D. Web User Interface

Install Node.js dan 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 dependency untuk run WebUI (pertama kali)

cd webui
npm install

Run WebUI

cd webui
npm run dev

Sekarang server web berjalan di http://localhost:3000. username dan password default adalah "admin" dan "1423".

Konfigurasi Core Network

file konfigurasi free5GC Ubah ./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>

Tambahkan subscriber (UE)

Tambahkan subscriber melalui Web UI Run web server:

cd ./webui && npm run dev

Masuk ke http://localhost:3000

  • Username : admin
  • Password : 1423

Tambahkan subscriber dengan IMSI, K, OPc

  • Masuk ke menu Subscriber.
  • Click Tombol `+` untuk menambahkan subscriber baru.
  • Isi IMSI, security context(K, OPc, AMF), dan APN dari subscriber.
  • Click Tombol `SAVE`

Penambahan ini akan langsung berlaku di free5GC tanpa perlu me-restart daemon apa pun.

Rebuild Project

Untuk sepenuhnya membangun kembali proyek setelah memodifikasi 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

Catatan untuk memodifikasi file konfigurasi

  • Gunakan spasi untuk indent. JANGAN gunakan tab.
  • Spasi harus ditambahkan di antara titik dua dan nilai setelah nama item, mis. addr: 192.188.2.2

Jalankan,


./test/testngc test failure

Pastikan semua file konfigurasi dan pengaturan lingkungan sudah benar.

Kill semua proses testngc yang tidak selesai dengan benar


killall -9 testngc


Hapus test subscriber yang ditinggalkan oleh pengujian gagal sebelumnya (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: - certificate expire (NextEPC issue #94)

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

Address telah digunakan

$ killall -9 testngc

atau

$ killall -9 free5gc-ngcd

Kegagalan Rebuild

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 package:

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

CD ke folder pyscard dan install

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

Verify bahwa reader kita sudah siap

sudo pcsc_scan

Cek apakah reader kita dapat membaca SIM card

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

Program / isi SIM card dengan information

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

Anda bisa mendapatkan kartu SIM Anda dari sysmocom. Anda juga memerlukan pembaca kartu untuk menulis kartu SIM Anda. Anda bisa mendapatkan pembaca kartu dari sini atau perangkat yang setara akan melakukannya.

Referensi

Pranala Menarik