Open5gs: Konfigurasi Awal: Difference between revisions

From OnnoCenterWiki
Jump to navigationJump to search
No edit summary
 
(12 intermediate revisions by the same user not shown)
Line 1: Line 1:
Sumber: https://open5gs.org/open5gs/docs/guide/02-building-open5gs-from-sources/
Sumber: https://open5gs.org/open5gs/docs/guide/02-building-open5gs-from-sources/
==Catatan PLMN==
* Internasional Test Network PLMN 001/01
* Internasional Private Network PLMN 999/99




Line 6: Line 12:
Modifikasi /etc/open5gs/amf.yaml untuk set NGAP IP address, PLMN ID, TAC dan NSSAI.
Modifikasi /etc/open5gs/amf.yaml untuk set NGAP IP address, PLMN ID, TAC dan NSSAI.


  vi /usr/local/src/open5gs/install/etc/open5gs/amf.yaml
  cd /usr/local/src/open5gs/install/etc/open5gs
 
kalau install dari binary cd ke folder
 
cd /etc/open5gs
cp amf.yaml amf.yaml.old
vi amf.yaml


Pastikan
Pastikan


$ diff -u /etc/open5gs/amf.yaml.old /etc/open5gs/amf.yaml
amf:
--- amf.yaml    2020-09-05 20:52:28.652234967 -0400
    sbi:
+++ amf.yaml.new    2020-09-05 20:55:07.453114885 -0400
@@ -293,26 +293,26 @@ amf:
       - addr: 127.0.0.5
       - addr: 127.0.0.5
         port: 7777
         port: 7777
     ngap:
     ngap:
-     - addr: 127.0.0.5
      #     - addr: 127.0.0.5
+      - addr: 10.10.0.5
      - addr: 10.10.0.5
     metrics:
     metrics:
        addr: 127.0.0.5
      - addr: 127.0.0.5
         port: 9090
         port: 9090
     guami:
     guami:
       - plmn_id:
       - plmn_id:
-         mcc: 999
        #         mcc: 999
-         mnc: 70
        #         mnc: 70
+          mcc: 001
          mcc: 001
+          mnc: 01
          mnc: 01
         amf_id:
         amf_id:
           region: 2
           region: 2
Line 33: Line 43:
     tai:
     tai:
       - plmn_id:
       - plmn_id:
-         mcc: 999
        #         mcc: 999
-         mnc: 70
        #         mnc: 70
+          mcc: 001
          mcc: 001
+          mnc: 01
          mnc: 01
         tac: 1
         tac: 1
     plmn_support:
     plmn_support:
       - plmn_id:
       - plmn_id:
-         mcc: 999
        #         mcc: 999
-         mnc: 70
        #         mnc: 70
+          mcc: 001
          mcc: 001
+          mnc: 01
          mnc: 01
         s_nssai:
         s_nssai:
           - sst: 1
           - sst: 1
     security:
     security:
Modify install/etc/open5gs/upf.yaml to set the GTP-U and PFCP IP address.
        integrity_order : [ NIA2, NIA1, NIA0 ]
        ciphering_order : [ NEA0, NEA1, NEA2 ]
    network_name:
        full: Open5GS
    amf_name: open5gs-amf0
 
 
Modify install/etc/open5gs/upf.yaml untuk set GTP-U dan PFCP IP address.
 
cd /usr/local/src/open5gs/install/etc/open5gs
 
kalau install dari binary cd ke folder
 
cd /etc/open5gs
cp upf.yaml upf.yaml.old
vi upf.yaml
 
Pastikan


$ diff -u /etc/open5gs/upf.yaml.old /etc/open5gs/upf.yaml
upf:
--- upf.yaml    2020-09-05 20:52:28.652234967 -0400
+++ upf.yaml.new    2020-09-05 20:52:55.279052142 -0400
@@ -168,7 +168,7 @@ upf:
     pfcp:
     pfcp:
       - addr: 127.0.0.7
       - addr: 127.0.0.7
     gtpu:
     gtpu:
-     - addr: 127.0.0.7
      #     - addr: 127.0.0.7
+      - addr: 10.11.0.7
      - addr: 10.11.0.7
     subnet:
     subnet:
       - addr: 10.45.0.1/16
       - addr: 10.45.0.1/16
       - addr: 2001:db8:cafe::1/48
       - addr: 2001:db8:cafe::1/48
    metrics:
      - addr: 127.0.0.7
        port: 9090
Restart Open5GS,
sudo systemctl restart open5gs-amfd
sudo systemctl restart open5gs-upfd
==4G/ 5G NSA Core==
Modify install/etc/open5gs/mme.yaml untuk set S1AP IP address, PLMN ID, dan TAC.
cd /usr/local/src/open5gs/install/etc/open5gs
kalau install dari binary cd ke folder


cd /etc/open5gs
cp mme.yaml mme.yaml.old
vi mme.yaml


4G EPC
Pastikan
Modify install/etc/open5gs/mme.yaml to set the S1AP IP address, PLMN ID, and TAC.


$ diff -u /etc/open5gs/mme.yaml.old /etc/open5gs/mme.yaml
mme:
--- mme.yaml    2020-09-05 20:52:28.648235143 -0400
    freeDiameter: /etc/freeDiameter/mme.conf
+++ mme.yaml.new    2020-09-05 20:56:05.434484208 -0400
@@ -253,20 +253,20 @@ mme:
     s1ap:
     s1ap:
-     - addr: 127.0.0.2
      #     - addr: 127.0.0.2
+      - addr: 10.10.0.2
      - addr: 10.10.0.2
     gtpc:
     gtpc:
       - addr: 127.0.0.2
       - addr: 127.0.0.2
     metrics:
     metrics:
       addr: 127.0.0.2
       - addr: 127.0.0.2
      port: 9090
        port: 9090
     gummei:
     gummei:
       plmn_id:
       plmn_id:
-       mcc: 999
        #       mcc: 999
-       mnc: 70
        #       mnc: 70
+        mcc: 001
        mcc: 001
+        mnc: 01
        mnc: 01
       mme_gid: 2
       mme_gid: 2
       mme_code: 1
       mme_code: 1
     tai:
     tai:
       plmn_id:
       plmn_id:
-       mcc: 999
        #       mcc: 999
-       mnc: 70
        #       mnc: 70
+        mcc: 001
        mcc: 001
+        mnc: 01
        mnc: 01
       tac: 1
       tac: 1
     security:
     security:
         integrity_order : [ EIA2, EIA1, EIA0 ]
         integrity_order : [ EIA2, EIA1, EIA0 ]
Modify install/etc/open5gs/sgwu.yaml to set the GTP-U IP address.
        ciphering_order : [ EEA0, EEA1, EEA2 ]
    network_name:
        full: Open5GS
 
Modify install/etc/open5gs/sgwu.yaml untuk set GTP-U IP address.
 
cd /usr/local/src/open5gs/install/etc/open5gs
 
kalau install dari binary cd ke folder
 
cd /etc/open5gs
cp sgwu.yaml sgwu.yaml.old
vi sgwu.yaml
 
Pastikan,


$ diff --git a/configs/open5gs/sgwu.yaml.in b/configs/open5gs/sgwu.yaml.in
sgwu:
index 8ccf94378..25b6884a3 100644
--- a/configs/open5gs/sgwu.yaml.in
+++ b/configs/open5gs/sgwu.yaml.in
@@ -100,7 +100,7 @@ sgwu:
     pfcp:
     pfcp:
       - addr: 127.0.0.6
       - addr: 127.0.0.6
     gtpu:
     gtpu:
-     - addr: 127.0.0.6
      #     - addr: 127.0.0.6
+      - addr: 10.11.0.6
      - addr: 10.11.0.6


#
Restart,
# sgwc:
If you modify the config files while Open5GS daemons are running, please restart them


sudo systemctl restart open5gs-mmed
sudo systemctl restart open5gs-sgwud


Jika kita compile open5gs, kemungkinan script untuk systemctl belum ada. Ini akan menimbulkan ERROR.








==Setup TUN device (not persistent)==
Jika dibutuhkan kita dapat menset interface ogstun, tampaknya ini tidak dibutuhkan jika kita menginstall open5gs dari binary.
Untuk membuat TUN device dengan nama interface ogstun, caranya adalah sebagai berikut,
sudo ip tuntap add name ogstun mode tun
sudo ip addr add 10.45.0.1/16 dev ogstun
sudo ip addr add 2001:db8:cafe::1/48 dev ogstun
sudo ip link set ogstun up
Tip: script ini tersedia di $GIT_REPO/misc/netconf.sh yang akan memudahkan kita dapat mengkonfigurasi TUN device: 
sudo ./misc/netconf.sh
==Tambahkan Route Untuk UE ke WAN / Internet==
Agar ada bridge antara PGWU/UPF dan WAN (Internet), kita perlu meng-enable IP forwarding dan NAT rule di IP Tables.
Untuk mengaktifkan forwarding dan NAT rule, ketik,
### Enable IPv4/IPv6 Forwarding
sudo sysctl -w net.ipv4.ip_forward=1
sudo sysctl -w net.ipv6.conf.all.forwarding=1
### Add NAT Rule
sudo iptables -t nat -A POSTROUTING -s 10.45.0.0/16 ! -o ogstun -j MASQUERADE
sudo ip6tables -t nat -A POSTROUTING -s 2001:db8:cafe::/48 ! -o ogstun -j MASQUERADE
Cek menggunakan perintah,
iptables -L -t nat
Hasilnya harusnya NAT beroperasi seperti dibawah ini,
Chain POSTROUTING (policy ACCEPT)
target    prot opt source              destination       
MASQUERADE  all  --  10.45.0.0/16        anywhere
Konfigurasi firewall dengan benar dan pastikan status ufw inactive.
sudo ufw status
Status: active
Jika dibutuhkan, firewall dapat dimatikan menggunakan perintah berikut, dan disable waktu  start up,
sudo ufw disable
Matikan firewall dan disable pada system startup
$ sudo ufw status
Status: inactive
Optional, jika dibutuhkan, kita dapat melakukan konfigurasi berikut,
### Ensure that the packets in the `INPUT` chain to the `ogstun` interface are accepted
$ sudo iptables -I INPUT -i ogstun -j ACCEPT
### Prevent UE's from connecting to the host on which UPF is running
$ sudo iptables -I INPUT -s 10.45.0.0/16 -j DROP
$ sudo ip6tables -I INPUT -s 2001:db8:cafe::/48 -j DROP
### If your core network runs over multiple hosts, you probably want to block
### UE originating traffic from accessing other network functions.
### Replace x.x.x.x/y with the VNFs IP/subnet
$ sudo iptables -I FORWARD -s 10.45.0.0/16 -d x.x.x.x/y -j DROP


==Referensi==
==Referensi==


* https://open5gs.org/open5gs/docs/guide/02-building-open5gs-from-sources/
* https://open5gs.org/open5gs/docs/guide/02-building-open5gs-from-sources/
==Pranala Menarik==
* [[5G]]

Latest revision as of 03:35, 23 July 2023

Sumber: https://open5gs.org/open5gs/docs/guide/02-building-open5gs-from-sources/


Catatan PLMN

  • Internasional Test Network PLMN 001/01
  • Internasional Private Network PLMN 999/99


5G Core

Modifikasi /etc/open5gs/amf.yaml untuk set NGAP IP address, PLMN ID, TAC dan NSSAI.

cd /usr/local/src/open5gs/install/etc/open5gs

kalau install dari binary cd ke folder

cd /etc/open5gs
cp amf.yaml amf.yaml.old
vi amf.yaml

Pastikan

amf:
    sbi:
      - addr: 127.0.0.5
        port: 7777
    ngap:
      #      - addr: 127.0.0.5
      - addr: 10.10.0.5
    metrics:
      - addr: 127.0.0.5
        port: 9090
    guami:
      - plmn_id:
        #          mcc: 999
        #          mnc: 70
          mcc: 001
          mnc: 01
        amf_id:
          region: 2
          set: 1
    tai:
      - plmn_id:
        #          mcc: 999
        #          mnc: 70
          mcc: 001
          mnc: 01
        tac: 1
    plmn_support:
      - plmn_id:
        #          mcc: 999
        #          mnc: 70
          mcc: 001
          mnc: 01
        s_nssai:
          - sst: 1
    security:
        integrity_order : [ NIA2, NIA1, NIA0 ]
        ciphering_order : [ NEA0, NEA1, NEA2 ]
    network_name:
        full: Open5GS
    amf_name: open5gs-amf0


Modify install/etc/open5gs/upf.yaml untuk set GTP-U dan PFCP IP address.

cd /usr/local/src/open5gs/install/etc/open5gs

kalau install dari binary cd ke folder

cd /etc/open5gs
cp upf.yaml upf.yaml.old
vi upf.yaml

Pastikan

upf:
    pfcp:
      - addr: 127.0.0.7
    gtpu:
      #      - addr: 127.0.0.7
      - addr: 10.11.0.7
    subnet:
      - addr: 10.45.0.1/16
      - addr: 2001:db8:cafe::1/48
    metrics:
      - addr: 127.0.0.7
        port: 9090

Restart Open5GS,

sudo systemctl restart open5gs-amfd
sudo systemctl restart open5gs-upfd


4G/ 5G NSA Core

Modify install/etc/open5gs/mme.yaml untuk set S1AP IP address, PLMN ID, dan TAC.

cd /usr/local/src/open5gs/install/etc/open5gs

kalau install dari binary cd ke folder

cd /etc/open5gs
cp mme.yaml mme.yaml.old
vi mme.yaml

Pastikan

mme:
    freeDiameter: /etc/freeDiameter/mme.conf
    s1ap:
      #      - addr: 127.0.0.2
      - addr: 10.10.0.2
    gtpc:
      - addr: 127.0.0.2
    metrics:
      - addr: 127.0.0.2
        port: 9090
    gummei:
      plmn_id:
        #        mcc: 999
        #        mnc: 70
        mcc: 001
        mnc: 01
      mme_gid: 2
      mme_code: 1
    tai:
      plmn_id:
        #        mcc: 999
        #        mnc: 70
        mcc: 001
        mnc: 01
      tac: 1
    security:
        integrity_order : [ EIA2, EIA1, EIA0 ]
        ciphering_order : [ EEA0, EEA1, EEA2 ]
    network_name:
        full: Open5GS

Modify install/etc/open5gs/sgwu.yaml untuk set GTP-U IP address.

cd /usr/local/src/open5gs/install/etc/open5gs

kalau install dari binary cd ke folder

cd /etc/open5gs
cp sgwu.yaml sgwu.yaml.old
vi sgwu.yaml

Pastikan,

sgwu:
    pfcp:
      - addr: 127.0.0.6
    gtpu:
      #      - addr: 127.0.0.6
      - addr: 10.11.0.6

Restart,

sudo systemctl restart open5gs-mmed
sudo systemctl restart open5gs-sgwud

Jika kita compile open5gs, kemungkinan script untuk systemctl belum ada. Ini akan menimbulkan ERROR.




Setup TUN device (not persistent)

Jika dibutuhkan kita dapat menset interface ogstun, tampaknya ini tidak dibutuhkan jika kita menginstall open5gs dari binary.

Untuk membuat TUN device dengan nama interface ogstun, caranya adalah sebagai berikut,

sudo ip tuntap add name ogstun mode tun
sudo ip addr add 10.45.0.1/16 dev ogstun
sudo ip addr add 2001:db8:cafe::1/48 dev ogstun
sudo ip link set ogstun up

Tip: script ini tersedia di $GIT_REPO/misc/netconf.sh yang akan memudahkan kita dapat mengkonfigurasi TUN device:

sudo ./misc/netconf.sh

Tambahkan Route Untuk UE ke WAN / Internet

Agar ada bridge antara PGWU/UPF dan WAN (Internet), kita perlu meng-enable IP forwarding dan NAT rule di IP Tables.

Untuk mengaktifkan forwarding dan NAT rule, ketik,

### Enable IPv4/IPv6 Forwarding
sudo sysctl -w net.ipv4.ip_forward=1
sudo sysctl -w net.ipv6.conf.all.forwarding=1
### Add NAT Rule
sudo iptables -t nat -A POSTROUTING -s 10.45.0.0/16 ! -o ogstun -j MASQUERADE
sudo ip6tables -t nat -A POSTROUTING -s 2001:db8:cafe::/48 ! -o ogstun -j MASQUERADE

Cek menggunakan perintah,

iptables -L -t nat

Hasilnya harusnya NAT beroperasi seperti dibawah ini,

Chain POSTROUTING (policy ACCEPT)
target     prot opt source               destination         
MASQUERADE  all  --  10.45.0.0/16         anywhere 

Konfigurasi firewall dengan benar dan pastikan status ufw inactive.

sudo ufw status
Status: active

Jika dibutuhkan, firewall dapat dimatikan menggunakan perintah berikut, dan disable waktu start up,

sudo ufw disable

Matikan firewall dan disable pada system startup

$ sudo ufw status
Status: inactive


Optional, jika dibutuhkan, kita dapat melakukan konfigurasi berikut,

### Ensure that the packets in the `INPUT` chain to the `ogstun` interface are accepted
$ sudo iptables -I INPUT -i ogstun -j ACCEPT
### Prevent UE's from connecting to the host on which UPF is running
$ sudo iptables -I INPUT -s 10.45.0.0/16 -j DROP 
$ sudo ip6tables -I INPUT -s 2001:db8:cafe::/48 -j DROP
### If your core network runs over multiple hosts, you probably want to block
### UE originating traffic from accessing other network functions.
### Replace x.x.x.x/y with the VNFs IP/subnet
$ sudo iptables -I FORWARD -s 10.45.0.0/16 -d x.x.x.x/y -j DROP

Referensi


Pranala Menarik