陳禹同
    • Create new note
    • Create a note from template
      • Sharing URL Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Customize slides
      • Note Permission
      • Read
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Write
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Engagement control Commenting, Suggest edit, Emoji Reply
    • Invite by email
      Invitee

      This note has no invitees

    • Publish Note

      Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

      Your note will be visible on your profile and discoverable by anyone.
      Your note is now live.
      This note is visible on your profile and discoverable online.
      Everyone on the web can find and read all notes of this public team.
      See published notes
      Unpublish note
      Please check the box to agree to the Community Guidelines.
      View profile
    • Commenting
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
      • Everyone
    • Suggest edit
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
    • Emoji Reply
    • Enable
    • Versions and GitHub Sync
    • Note settings
    • Note Insights New
    • Engagement control
    • Make a copy
    • Transfer ownership
    • Delete this note
    • Save as template
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Note Insights Versions and GitHub Sync Sharing URL Create Help
Create Create new note Create a note from template
Menu
Options
Engagement control Make a copy Transfer ownership Delete this note
Import from
Dropbox Google Drive Gist Clipboard
Export to
Dropbox Google Drive Gist
Download
Markdown HTML Raw HTML
Back
Sharing URL Link copied
/edit
View mode
  • Edit mode
  • View mode
  • Book mode
  • Slide mode
Edit mode View mode Book mode Slide mode
Customize slides
Note Permission
Read
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Write
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Engagement control Commenting, Suggest edit, Emoji Reply
  • Invite by email
    Invitee

    This note has no invitees

  • Publish Note

    Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

    Your note will be visible on your profile and discoverable by anyone.
    Your note is now live.
    This note is visible on your profile and discoverable online.
    Everyone on the web can find and read all notes of this public team.
    See published notes
    Unpublish note
    Please check the box to agree to the Community Guidelines.
    View profile
    Engagement control
    Commenting
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    • Everyone
    Suggest edit
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    Emoji Reply
    Enable
    Import from Dropbox Google Drive Gist Clipboard
       Owned this note    Owned this note      
    Published Linked with GitHub
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    ![](https://i.imgur.com/JORnn3y.png =150x)@NTUST, Taiwan Email: crg@gapps.ntust.edu.tw # Build Mosaic5G(M5G) OAI-CN V1 ###### tags: `Testing` [TOC] ## Architecture ![](https://i.imgur.com/ehfuxdO.png) ## Preface This is tutorial about how to install/setup OAI-CN and what we face during building. Below are reference sources what we followed. ::: spoiler EURECOM GitLab [OAI-CN v1](https://gitlab.eurecom.fr/mosaic5g/mosaic5g/-/wikis/tutorials/oai-cn) [How to connect OAI eNB (USRP B210) with COTS UE ](https://gitlab.eurecom.fr/oai/openairinterface5g/-/wikis/HowToConnectCOTSUEwithOAIeNBNew) [Kernel Requirements for Core Network](https://gitlab.eurecom.fr/oai/openairinterface5g/-/wikis/OpenAirKernelMainSetup#kernel-requirements-for-core-network-use-ubuntu-1604-for-a-first-time-user) ::: ## Requirements OS: Ubuntu 16.04/18.04 CPU: core-i7 RAM: 8GB ram at minimum SIM card info: ``` PLMN: MCC = 208, MNC = 93 TAC = 1(Primary TAC) 2 3 APN = oai.ipv4 IMSI = 208930000000002 LTE-KEY = 8BAF473F2F8FD09487CCCBD7097C6862 OP = 11111111111111111111111111111111 ``` ## Prepare Update the software database first if you use new OS. ``` shell= $ sudo apt-get update && sudo apt install git vim gitk -y ``` Make sure you have the Ubuntu 16.04/18.04 OS, otherwise, there will be shortage of related kits. Example kernel for OAI-CN needs to be 4.7.x(or above). You will need GTP kernel module from Osmocom which is loaded as module inside this kernel. ``` shell= $ dpkg --get-selections | grep linux-image ``` You can type following to install 4.7.x kernel from pre-compiled debian package ==if you don't have correct kernel(kernel lower than 4.7.x)==. ``` shell= $ git clone https://gitlab.eurecom.fr/oai/linux-4.7.x.git $ cd linux-4.7.x $ sudo dpkg -i linux-headers-4.7.7-oaiepc_4.7.7-oaiepc-10.00.Custom_amd64.deb linux-image-4.7.7-oaiepc_4.7.7-oaiepc-10.00.Custom_amd64.deb ## reboot machine to choose kernel $ sudo reboot ``` Change/check the FQDN in `/etc/hosts` as follows for later configuration: ```clike= $ sudo vim /etc/hosts 127.0.0.1 oai.openair4G.eur oai ## added for HSS if you don't install OAI-CN by snap 127.0.0.1 oai.openair4G.eur oai ## added for MME if you don't install OAI-CN by snap 127.0.0.1 localhost 127.0.1.1 oai ``` Reboot the machine if you modify `/etc/hosts` and then you can check them by follows: ```shell= $ sudo reboot $ hostname oai $ hostname -f oai.openair4G.eur ``` Also check your IP info for later configuration. ```shell= $ ifconfig ## example like following enp4s0 Link encap:Ethernet HWaddr d0:17:c2:cb:84:c1 inet addr:140.118.123.98 Bcast:140.118.123.255 Mask:255.255.255.0 inet6 addr: fe80::bb99:2dd9:9b8:e6e7/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:589630 errors:0 dropped:0 overruns:0 frame:0 TX packets:99911 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:355398185 (355.3 MB) TX bytes:7289510 (7.2 MB) Memory:f7000000-f701ffff ... ``` ## Installation from source ### Clone the repository ==Make sure you already have access to the EURECOM’s gitlab,== then you can clone M5G’s repository and install it from source. Otherwise, pass this steps and install M5G OAI-CN from snap directly. ``` shell= $ git clone https://gitlab.eurecom.fr/mosaic5g/mosaic5g.git ## ignore this command if you have complete OAI-CN building $ cd ~/mosaic5g $ ./build_m5g -c ``` ### Build up CN Build up each node step by step. ```shell= $ cd ~/mosaic5g/oai-cn $ git checkout develop ## it is up to you, default branch is openair-cn-llmec $ source oaienv ``` Install required package for OAI-CN by shell script in `~/mosaic5g/oai-cn/scripts`. ```shell= $ cd ~/mosaic5g/oai-cn/scripts ``` For HSS. ```shell= $ ./build_hss -i #(Need to run only once to install missing packages) ``` Choose `apache2`: ![](https://i.imgur.com/B3ffiHe.png) Choose `Yes`: ![](https://i.imgur.com/XVT3Ucu.png) Set password as `linux`. ![](https://i.imgur.com/zKWNx4a.png) Then we complete installing required package for HSS, we will do compiling HSS later. ![](https://i.imgur.com/tiACEtQ.png) For MME. ```shell= $ ./build_mme -i #(Need to run only once to install missing packages) ``` Then we complete installing required package for MME, we will do compiling MME later. ![](https://i.imgur.com/BgAVQ4Y.png) For SPGW. ```shell= $ ./build_spgw -i #(Need to run only once to install missing packages) ``` Then we complete installing required package for SPGW, we will do compiling SPGW later. ![](https://i.imgur.com/zeDsn7K.png) Also copy the conf files to `/usr/local/etc/oai/freeDiameter` and `/usr/local/etc/oai` for configuration. ```shell= $ sudo mkdir -p /usr/local/etc/oai/freeDiameter ## create freeDiameter folder if it doesn't exist $ sudo cp ~/mosaic5g/oai-cn/etc/acl.conf /usr/local/etc/oai/freeDiameter $ sudo cp ~/mosaic5g/oai-cn/etc/hss.conf /usr/local/etc/oai $ sudo cp ~/mosaic5g/oai-cn/etc/hss_fd.conf /usr/local/etc/oai/freeDiameter $ sudo cp ~/mosaic5g/oai-cn/etc/mme.conf /usr/local/etc/oai $ sudo cp ~/mosaic5g/oai-cn/etc/mme_fd.conf /usr/local/etc/oai/freeDiameter $ sudo cp ~/mosaic5g/oai-cn/etc/spgw.conf /usr/local/etc/oai ``` ### Configure HSS Now, after we already install OAI-CN, first we need to configure HSS. First we edit the `hss_fd.conf`. ```shell= $ sudo vim /usr/local/etc/oai/freeDiameter/hss_fd.conf ``` In `hss_fd.conf`, change/check the `Identity` to match `"<HOSTNAME>.openair4G.eur"` (replace `oai` with your hostname if necessary). ```shell= ... Identity = "oai.openair4G.eur" ... ``` You can type `hostname` to find your hostname. In `hss.conf`, adjust the `MYSQL_user` and `MYSQL_pass` under HSS section if you have different settings. Also, comment the first `OPERATOR_key` and uncomment the second line if you want to program your SIM cards as they have already been pre-configured in the HSS. ```shell= $ sudo vim /usr/local/etc/oai/hss.conf ``` Configuration like following: ```shell= ... HSS : { ## MySQL mandatory options MYSQL_server = "127.0.0.1"; # HSS S6a bind address MYSQL_user = "root"; # Database server login MYSQL_pass = "linux"; # Database server password MYSQL_db = "oai_db"; # Your database name ## HSS options #OPERATOR_key = "1006020f0a478bf6b699f15c062e42b3"; # OP key matching your database OPERATOR_key = "11111111111111111111111111111111"; # OP key matching your database RANDOM = "true"; # True random or only pseudo random (for subscriber vector generation) ## Freediameter options FD_conf = "/var/snap/oai-cn/current/hss_fd.conf"; }; ``` Create certificates for MME authentication(`./check_hss_s6a_certificate /usr/local/etc/oai/freeDiameter/ <HOSTNAME>.openair4G.eur`). ``` shell= $ cd ~/mosaic5g/oai-cn/scripts $ ./check_hss_s6a_certificate /usr/local/etc/oai/freeDiameter/ oai.openair4G.eur ## assume hostname is oai ``` ![](https://i.imgur.com/vXbslR2.png) Then, compile HSS by follows. ```shell= $ ./build_hss -c ``` ![](https://i.imgur.com/eyTHnQp.png) Finally, we can run HSS by following. ```shell= $ cd ~/mosaic5g/oai-cn/scripts $ ./run_hss -i ~/openair-cn/SRC/OAI_HSS/db/oai_db.sql ## run only once(first time) to install database $ ./run_hss ## run this for all subsequent runs ``` ![](https://i.imgur.com/TWf12yo.png) ### Configure MME After we have configured HSS, next is to configure the MME We modify `mme_fd.conf` file: ```shell= $ sudo vim /usr/local/etc/oai/freeDiameter/mme_fd.conf ``` We change/check: - `Identity` to match your hostname (as done before for the `hss_fd.conf` file). - The same in the `ConnectPeer` setting. Example like following: ```shell= ... Identity = "oai.openair4G.eur" ... ConnectPeer= "oai.openair4G.eur" { ConnectTo = "127.0.0.1"; No_SCTP ; No_IPv6; Prefer_TCP; No_TLS; port = 3868; realm = "openair4G.eur";}; ``` Then modify `mme.conf`: ```shell= $ sudo vim /usr/local/etc/oai/mme.conf ``` In the MME section, we change/check: - Change `HSS_HOSTNAME` to match your HSS's hostname. - Change `GUMMEI_LIST` and `TAI_LIST` to match your desired PLMN configuration. Assume PLMN is 20893 (MCC = 208; MNC = 93). Also, in the `NETWORK_INTERFACES` section, change/check: - `MME_INTERFACE_NAME_FOR_S1_MME` to `lo:1` or `"YOUR IP INTERFACE"`. - `MME_IPV4_ADDRESS_FOR_S1_MME` to `127.0.1.10/24` or `"YOUR IP ADDRESS/24"`. You can type `ifconfig` to check your IP info. - `MME_INTERFACE_NAME_FOR_S11_MME` to `lo`. - `MME_IPV4_ADDRESS_FOR_S11_MME` to `127.0.11.1/8`. In `S-GW` section: - `SGW_IPV4_ADDRESS_FOR_S11` to `127.0.11.2/8`. Example like following: ```shell= ... S6A : { S6A_CONF = "/var/snap/oai-cn/current/mme_fd.conf"; # YOUR MME freeDiameter config file path HSS_HOSTNAME = "oai"; # THE HSS HOSTNAME }; ... # ------- MME served GUMMEIs # MME code DEFAULT size = 8 bits # MME GROUP ID size = 16 bits GUMMEI_LIST = ( {MCC="208" ; MNC="93"; MME_GID="4" ; MME_CODE="1"; } # YOUR GUMMEI CONFIG HERE ); # ------- MME served TAIs # TA (mcc.mnc:tracking area code) DEFAULT = 208.34:1 # max values = 999.999:65535 # maximum of 16 TAIs, comma separated # !!! Actually use only one PLMN TAI_LIST = ( {MCC="208" ; MNC="93"; TAC = "1"; } # YOUR TAI CONFIG HERE ); NETWORK_INTERFACES : { # MME binded interface for S1-C or S1-MME communication (S1AP), can be ethernet interface, virtual ethernet interface, we don't advise wireless interfaces MME_INTERFACE_NAME_FOR_S1_MME = "lo:1"; # YOUR NETWORK CONFIG HERE MME_IPV4_ADDRESS_FOR_S1_MME = "127.0.1.10/24"; # YOUR NETWORK CONFIG HERE # MME binded interface for S11 communication (GTPV2-C) MME_INTERFACE_NAME_FOR_S11_MME = "lo"; # YOUR NETWORK CONFIG HERE MME_IPV4_ADDRESS_FOR_S11_MME = "127.0.11.1/8"; # YOUR NETWORK CONFIG HERE MME_PORT_FOR_S11_MME = 2123; # YOUR NETWORK CONFIG HERE }; ... S-GW : { # S-GW binded interface for S11 communication (GTPV2-C), if none selected the ITTI message interface is used SGW_IPV4_ADDRESS_FOR_S11 = "127.0.11.2/8"; # YOUR NETWORK CONFIG HERE }; ... ``` Create certificates for MME authentication(`./check_mme_s6a_certificate /usr/local/etc/oai/freeDiameter/ <HOSTNAME>.openair4G.eur`). ``` shell= $ cd ~/mosaic5g/oai-cn/scripts $ ./check_mme_s6a_certificate /usr/local/etc/oai/freeDiameter/ oai.openair4G.eur ## assume hostname is oai ``` ![](https://i.imgur.com/EGuSbI8.png) Then, compile MME by follows. ```shell= $ ./build_mme -c ``` ![](https://i.imgur.com/ZKvIqGP.png) You can now run the HSS and MME with the following command. ``` shell= $ cd ~/mosaic5g/oai-cn/scripts $ ./run_hss $ ./run_mme ``` In the HSS window, there should be output related to the connecting MME. The last line there should be: ```shell= 'STATE_CLOSED' -> 'STATE_OPEN' '<HOSTNAME>.openair4G.eur' ``` ![](https://i.imgur.com/rXa9wIv.png) ### Configure SPGW Finally, we configure SPGW. Create the configuration files: ``` shell= $ sudo oai-cn.spgw-init ``` To show the actual folder, run follows: ```shell= $ sudo oai-cn.spgw-conf-get ``` Modify `spgw.conf` manually. ```shell= $ sudo vim /usr/local/etc/oai/spgw.conf ``` In the `spgw.conf` file, section `S-GW->NETWORK_INTERFACES`, change/check: - `SGW_INTERFACE_NAME_FOR_S11` to `lo`. - `SGW_IPV4_ADDRESS_FOR_S11` to `127.0.11.2/8`. - `SGW_INTERFACE_NAME_FOR_S1U_S12_S4_UP` to `lo:1` or `"YOUR IP INTERFACE"`. - `SGW_IPV4_ADDRESS_FOR_S1U_S12_S4_UP` to `127.0.1.10/24` or `"YOUR IP ADDRESS/24"`. You can type `ifconfig` to check your IP info. As mentioned previously, S5 does not exist so it does not need configuration. The remote controller sections will be important for LL-MEC later. In the `P-GW->NETWORK_INTERFACES` section, change/check: - `PGW_INTERFACE_NAME_FOR_SGI` to the interface through which you are connected to the internet, `enp4s0` for example. - `DEFAULT_DNS_IPV4_ADDRESS` to have the DNS server of your network. Example like following: ```shell= ... S-GW : { NETWORK_INTERFACES : { # S-GW binded interface for S11 communication (GTPV2-C), if none selected the ITTI message interface is used SGW_INTERFACE_NAME_FOR_S11 = "lo"; # STRING, interface name, YOUR NETWORK CONFIG HERE SGW_IPV4_ADDRESS_FOR_S11 = "127.0.11.2/8"; # STRING, CIDR, YOUR NETWORK CONFIG HERE # S-GW binded interface for S1-U communication (GTPV1-U) can be ethernet interface, virtual ethernet interface, we don't advise wireless interfaces SGW_INTERFACE_NAME_FOR_S1U_S12_S4_UP = "lo:1"; # STRING, interface name, YOUR NETWORK CONFIG HERE, USE "lo" if S-GW run on eNB host SGW_IPV4_ADDRESS_FOR_S1U_S12_S4_UP = "127.0.1.10/24"; SGW_IPV4_PORT_FOR_S1U_S12_S4_UP = 2152; # INTEGER, port number, PREFER NOT CHANGE UNLESS YOU KNOW WHAT YOU ARE DOING # S-GW binded interface for S5 or S8 communication, not implemented, so leave it to none SGW_INTERFACE_NAME_FOR_S5_S8_UP = "none"; # STRING, interface name, DO NOT CHANGE (NOT IMPLEMENTED YET) SGW_IPV4_ADDRESS_FOR_S5_S8_UP = "0.0.0.0/24"; # STRING, CIDR, DO NOT CHANGE (NOT IMPLEMENTED YET) # external controller for managing context of UE and its user plane SGW_REMOTE_CONTROLLER_ENABLED = "no"; SGW_REMOTE_CONTROLLER_IPV4_ADDRESS = "192.168.0.105"; SGW_REMOTE_CONTROLLER_PORT = 9999; }; ... P-GW = { NETWORK_INTERFACES : { # P-GW binded interface for S5 or S8 communication, not implemented, so leave it to none PGW_INTERFACE_NAME_FOR_S5_S8 = "none"; # STRING, interface name, DO NOT CHANGE (NOT IMPLEMENTED YET) # P-GW binded interface for SGI (egress/ingress internet traffic) PGW_INTERFACE_NAME_FOR_SGI = "enp4s0"; # STRING, YOUR NETWORK CONFIG HERE PGW_MASQUERADE_SGI = "yes"; # STRING, {"yes", "no"}. YOUR NETWORK CONFIG HERE, will do NAT for you if you put "yes". UE_TCP_MSS_CLAMPING = "no"; # STRING, {"yes", "no"}. }; ... # DNS address communicated to UEs DEFAULT_DNS_IPV4_ADDRESS = "8.8.8.8"; # YOUR NETWORK CONFIG HERE DEFAULT_DNS_SEC_IPV4_ADDRESS = "8.8.4.4"; # YOUR NETWORK CONFIG HERE }; ``` If it is needed to modify `DEFAULT_DNS_IPV4_ADDRESS` and `DEFAULT_DNS_SEC_IPV4_ADDRESS` according to your DNS server IPs, type following command to find network interface card, or you can ignore this step. ```shell= $ nmcli connection ``` ![](https://i.imgur.com/JtDZDSc.png) Then type following command to check the information about this card. ```shell= nmcli connection show <NAME> ``` We type `nmcli connection show Wired\ connection\ 1` for example: ![](https://i.imgur.com/QInJN5r.png) `ipv4.dns` is a DNS server IP, you might see two IP. Modify the DNS server IP in `spgw.conf`as following: ```shell= ... # DNS address communicated to UEs DEFAULT_DNS_IPV4_ADDRESS = "192.168.106.10"; # YOUR NETWORK CONFIG HERE DEFAULT_DNS_SEC_IPV4_ADDRESS = "192.168.106.12"; # YOUR NETWORK CONFIG HERE ... ``` Compile SPGW by following commands ``` shell= $ cd ~/mosaic5g/oai-cn/scripts $ ./build_spgw -c ``` ![](https://i.imgur.com/IcLrjZW.png) After complete build up OAI-CN, we can run HSS、MME and SPGW on different terminals by order. ``` shell= $ ./run_hss $ ./run_mme $ ./run_spgw ``` HSS will show 'STATE_CLOSED' -> 'STATE_OPEN'. MME will show info about connected eNB and UE. SPGW will show SPGW-APP task interface: DONE. ![](https://i.imgur.com/Q0hbdnY.png) ## Installation from snap ### Preliminaries Make sure that snap is installed. ```shell= $ sudo snap version snap 2.47.1 snapd 2.47.1 series 16 ubuntu 16.04 kernel 4.15.0-120-generic ``` If you get message `sudo: snap: command not found`, it means snap doesn't be installed. Enter the following instructions to install it for M5G. ```shell= $ sudo apt-get install snapd -y ``` Install mysql to be database. ```shell= $ sudo apt install mysql-server mysql-client -y ``` Set password as `linux`. ![](https://i.imgur.com/IBbv7Za.png) Make sure that MySQL is installed and try to login. ```shell= $ sudo mysql_secure_installation ## after new installation $ mysql -u root -p $ exit ## exit MySQL ``` ### Clone the repository and install CN **option1:** If you already have access to the EURECOM’s gitlab, you can clone M5G’s repository from source. ``` shell= $ git clone https://gitlab.eurecom.fr/mosaic5g/mosaic5g.git $ cd ~/mosaic5g $ ./build_m5g -C v1 ``` **option2:** ```shell= ## choose one $ sudo snap install oai-cn --candidate ## version 1.0 $ sudo snap install oai-cn --beta ## version 1.4 $ sudo snap install oai-cn --edge ## version 1.4 ``` Check if it has been installed with the command as follows: ``` shell= $ sudo oai-cn.help ``` ### Configure HSS Now, after we already install OAI-CN, first we need to configure HSS. First, create new configuration files for the HSS: ```shell= $ sudo oai-cn.hss-init ``` This will create `hss_fd.conf`, `hss.conf`, and `acl.conf` configuration files, by default in `/var/snap/oai-cn/current/` which is a symlink to the latest version of the OAI-CN snap you have installed. To show the actual folder, run follows: ```shell= $ sudo oai-cn.hss-conf-get ``` Configuration for older versions is maintained in the respective folders under `/var/snap/oai-cn/`. Now, we need to modify parameters in `hss_fd.conf` and `hss.conf`. First we edit the `hss_fd.conf`. ```shell= $ sudo vim /var/snap/oai-cn/current/hss_fd.conf ``` In `hss_fd.conf`, change/check the `Identity` to match `"<HOSTNAME>.openair4G.eur"` (replace `oai` with your hostname if necessary). ```shell= ... Identity = "oai.openair4G.eur" ... ``` You can type `hostname` to find your hostname. In `hss.conf`, adjust the `MYSQL_user` and `MYSQL_pass` under HSS section if you have different settings. Also, comment the first `OPERATOR_key` and uncomment the second line if you want to program your SIM cards as they have already been pre-configured in the HSS. ```shell= $ sudo vim /var/snap/oai-cn/current/hss.conf ``` Configuration like following: ```shell= ... HSS : { ## MySQL mandatory options MYSQL_server = "127.0.0.1"; # HSS S6a bind address MYSQL_user = "root"; # Database server login MYSQL_pass = "linux"; # Database server password MYSQL_db = "oai_db"; # Your database name ## HSS options #OPERATOR_key = "1006020f0a478bf6b699f15c062e42b3"; # OP key matching your database OPERATOR_key = "11111111111111111111111111111111"; # OP key matching your database RANDOM = "true"; # True random or only pseudo random (for subscriber vector generation) ## Freediameter options FD_conf = "/var/snap/oai-cn/current/hss_fd.conf"; }; ``` Then, create certificates for MME authentication using again the init command (which will not override your configuration). ``` shell= $ sudo oai-cn.hss-init ``` The HSS can be run as a systemd service: **option1:** ```shell= $ sudo oai-cn.hss-start # run the HSS as a service $ sudo oai-cn.hss-status # verify the service's status $ sudo oai-cn.hss-journal # see the service's journal $ sudo oai-cn.hss-stop # stop the service ``` **option2:** ``` shell= $ sudo oai-cn.hss ## ctrl + C to stop HSS ``` ![](https://i.imgur.com/rGJ8VjC.png) p.s. Each OAI-CN node has two options to be run, we take option2 to be example. ### Configure MME After we have configured HSS, next is to configure the MME Also create the configuration files first: ``` shell= $ sudo oai-cn.mme-init ``` The files to be edited are `mme.conf` and `mme_fd.conf`, then we could modify them for configuartion. To show the actual folder, run follows: ```shell= $ sudo oai-cn.mme-conf-get ``` First we modify `mme_fd.conf` file: ```shell= $ sudo vim /var/snap/oai-cn/current/mme_fd.conf ``` We change/check: - `Identity` to match your hostname (as done before for the `hss_fd.conf` file). - The same in the `ConnectPeer` setting. Example like following: ```shell= ... Identity = "oai.openair4G.eur" ... ConnectPeer= "oai.openair4G.eur" { ConnectTo = "127.0.0.1"; No_SCTP ; No_IPv6; Prefer_TCP; No_TLS; port = 3868; realm = "openair4G.eur";}; ``` Then modify `mme.conf`: ```shell= $ sudo vim /var/snap/oai-cn/current/mme.conf ``` In the MME section, we change/check: - Change `HSS_HOSTNAME` to match your HSS's hostname. - Change `GUMMEI_LIST` and `TAI_LIST` to match your desired PLMN configuration. Assume PLMN is 20893 (MCC = 208; MNC = 93). Also, in the `NETWORK_INTERFACES` section, change/check: - `MME_INTERFACE_NAME_FOR_S1_MME` to `lo:1` or `"YOUR IP INTERFACE"`. - `MME_IPV4_ADDRESS_FOR_S1_MME` to `127.0.1.10/24` or `"YOUR IP ADDRESS/24"`. You can type `ifconfig` to check your IP info. - `MME_INTERFACE_NAME_FOR_S11_MME` to `lo`. - `MME_IPV4_ADDRESS_FOR_S11_MME` to `127.0.11.1/8`. In `S-GW` section: - `SGW_IPV4_ADDRESS_FOR_S11` to `127.0.11.2/8`. Example like following: ```shell= ... S6A : { S6A_CONF = "/var/snap/oai-cn/current/mme_fd.conf"; # YOUR MME freeDiameter config file path HSS_HOSTNAME = "oai"; # THE HSS HOSTNAME }; ... # ------- MME served GUMMEIs # MME code DEFAULT size = 8 bits # MME GROUP ID size = 16 bits GUMMEI_LIST = ( {MCC="208" ; MNC="93"; MME_GID="4" ; MME_CODE="1"; } # YOUR GUMMEI CONFIG HERE ); # ------- MME served TAIs # TA (mcc.mnc:tracking area code) DEFAULT = 208.34:1 # max values = 999.999:65535 # maximum of 16 TAIs, comma separated # !!! Actually use only one PLMN TAI_LIST = ( {MCC="208" ; MNC="93"; TAC = "1"; } # YOUR TAI CONFIG HERE ); NETWORK_INTERFACES : { # MME binded interface for S1-C or S1-MME communication (S1AP), can be ethernet interface, virtual ethernet interface, we don't advise wireless interfaces MME_INTERFACE_NAME_FOR_S1_MME = "lo:1"; # YOUR NETWORK CONFIG HERE MME_IPV4_ADDRESS_FOR_S1_MME = "127.0.1.10/24"; # YOUR NETWORK CONFIG HERE # MME binded interface for S11 communication (GTPV2-C) MME_INTERFACE_NAME_FOR_S11_MME = "lo"; # YOUR NETWORK CONFIG HERE MME_IPV4_ADDRESS_FOR_S11_MME = "127.0.11.1/8"; # YOUR NETWORK CONFIG HERE MME_PORT_FOR_S11_MME = 2123; # YOUR NETWORK CONFIG HERE }; ... S-GW : { # S-GW binded interface for S11 communication (GTPV2-C), if none selected the ITTI message interface is used SGW_IPV4_ADDRESS_FOR_S11 = "127.0.11.2/8"; # YOUR NETWORK CONFIG HERE }; ... ``` Initialize MME again. ``` shell= $ sudo oai-cn.mme-init ``` You can now run the HSS and MME with the following command. ``` shell= $ sudo oai-cn.hss $ sudo oai-cn.mme ``` In the HSS window, there should be output related to the connecting MME. The last line there should be: ```shell= 'STATE_CLOSED' -> 'STATE_OPEN' '<HOSTNAME>.openair4G.eur' ``` ![](https://i.imgur.com/rXa9wIv.png) ### Configure SPGW Finally, we configure SPGW. Create the configuration files: ``` shell= $ sudo oai-cn.spgw-init ``` To show the actual folder, run follows: ```shell= $ sudo oai-cn.spgw-conf-get ``` Modify `spgw.conf` manually. ```shell= $ sudo vim /var/snap/oai-cn/current/spgw.conf ``` In the `spgw.conf` file, section `S-GW->NETWORK_INTERFACES`, change/check: - `SGW_INTERFACE_NAME_FOR_S11` to `lo`. - `SGW_IPV4_ADDRESS_FOR_S11` to `127.0.11.2/8`. - `SGW_INTERFACE_NAME_FOR_S1U_S12_S4_UP` to `lo:1` or `"YOUR IP INTERFACE"`. - `SGW_IPV4_ADDRESS_FOR_S1U_S12_S4_UP` to `127.0.1.10/24` or `"YOUR IP ADDRESS/24"`. You can type `ifconfig` to check your IP info. As mentioned previously, S5 does not exist so it does not need configuration. The remote controller sections will be important for LL-MEC later. In the `P-GW->NETWORK_INTERFACES` section, change/check: - `PGW_INTERFACE_NAME_FOR_SGI` to the interface through which you are connected to the internet. `enp4s0` for example. - `DEFAULT_DNS_IPV4_ADDRESS` to have the DNS server of your network. Example like following: ```shell= ... S-GW : { NETWORK_INTERFACES : { # S-GW binded interface for S11 communication (GTPV2-C), if none selected the ITTI message interface is used SGW_INTERFACE_NAME_FOR_S11 = "lo"; # STRING, interface name, YOUR NETWORK CONFIG HERE SGW_IPV4_ADDRESS_FOR_S11 = "127.0.11.2/8"; # STRING, CIDR, YOUR NETWORK CONFIG HERE # S-GW binded interface for S1-U communication (GTPV1-U) can be ethernet interface, virtual ethernet interface, we don't advise wireless interfaces SGW_INTERFACE_NAME_FOR_S1U_S12_S4_UP = "lo:1"; # STRING, interface name, YOUR NETWORK CONFIG HERE, USE "lo" if S-GW run on eNB host SGW_IPV4_ADDRESS_FOR_S1U_S12_S4_UP = "127.0.1.10/24"; SGW_IPV4_PORT_FOR_S1U_S12_S4_UP = 2152; # INTEGER, port number, PREFER NOT CHANGE UNLESS YOU KNOW WHAT YOU ARE DOING # S-GW binded interface for S5 or S8 communication, not implemented, so leave it to none SGW_INTERFACE_NAME_FOR_S5_S8_UP = "none"; # STRING, interface name, DO NOT CHANGE (NOT IMPLEMENTED YET) SGW_IPV4_ADDRESS_FOR_S5_S8_UP = "0.0.0.0/24"; # STRING, CIDR, DO NOT CHANGE (NOT IMPLEMENTED YET) # external controller for managing context of UE and its user plane SGW_REMOTE_CONTROLLER_ENABLED = "no"; SGW_REMOTE_CONTROLLER_IPV4_ADDRESS = "192.168.0.105"; SGW_REMOTE_CONTROLLER_PORT = 9999; }; ... P-GW = { NETWORK_INTERFACES : { # P-GW binded interface for S5 or S8 communication, not implemented, so leave it to none PGW_INTERFACE_NAME_FOR_S5_S8 = "none"; # STRING, interface name, DO NOT CHANGE (NOT IMPLEMENTED YET) # P-GW binded interface for SGI (egress/ingress internet traffic) PGW_INTERFACE_NAME_FOR_SGI = "enp4s0"; # STRING, YOUR NETWORK CONFIG HERE PGW_MASQUERADE_SGI = "yes"; # STRING, {"yes", "no"}. YOUR NETWORK CONFIG HERE, will do NAT for you if you put "yes". UE_TCP_MSS_CLAMPING = "no"; # STRING, {"yes", "no"}. }; ... # DNS address communicated to UEs DEFAULT_DNS_IPV4_ADDRESS = "8.8.8.8"; # YOUR NETWORK CONFIG HERE DEFAULT_DNS_SEC_IPV4_ADDRESS = "8.8.4.4"; # YOUR NETWORK CONFIG HERE }; ``` If it is needed to modify `DEFAULT_DNS_IPV4_ADDRESS` and `DEFAULT_DNS_SEC_IPV4_ADDRESS` according to your DNS server IPs, type following command to find network interface card, or you can ignore this step. ```shell= $ nmcli connection ``` ![](https://i.imgur.com/7EPgOs5.png) Then type following command to check the information about this card. ```shell= nmcli connection show <NAME> ``` We type `nmcli connection show Wired\ connection\ 1` for example: ![](https://i.imgur.com/QInJN5r.png) `ipv4.dns` is a DNS server IP, you might see two IP. Modify the DNS server IP in `spgw.conf`as following: ```shell= ... # DNS address communicated to UEs DEFAULT_DNS_IPV4_ADDRESS = "192.168.106.10"; # YOUR NETWORK CONFIG HERE DEFAULT_DNS_SEC_IPV4_ADDRESS = "192.168.106.12"; # YOUR NETWORK CONFIG HERE ... ``` Initialize SPGW again. ``` shell= $ sudo oai-cn.spgw-init ``` After complete build up OAI-CN, we can run HSS、MME and SPGW on different terminals by order. ``` shell= $ sudo oai-cn.hss $ sudo oai-cn.mme $ sudo oai-cn.spgw ``` HSS will show 'STATE_CLOSED' -> 'STATE_OPEN'. MME will show info about connected eNB and UE. SPGW will show SPGW-APP task interface: DONE. ![](https://i.imgur.com/Q0hbdnY.png) p.s. `sudo oai-cn.start-all` can run all HSS、MME and SPGW, but inconvenient to watch log. :::spoiler **Helpful Command** ```shell= nano@nano:~$ oai-cn.help Usage: sudo oai-ran.[x] args App [x] is enb, cudu, and rru Note: root priviliage required Options: oai-cn.hss-init: initialize HSS oai-cn.hss: run HSS oai-cn.hss-journal: get the oai-cn.hssed logs oai-cn.hss-reset-db: oai-cn.hss-restart: oai-cn.hss-start: oai-cn.hss-status: oai-cn.hss-stop; oai-cn.hss-add-mme: oai-cn.hss-add-user: oai-cn.hss-conf-get: oai-cn.hss-conf-list: oai-cn.hss-conf-set: oai-cn.hss-conf-show: oai-cn.hss-dump-mmeid: oai-cn.hss-dump-users: oai-cn.mme-start: start the oai-cn.mmed daemon oai-cn.mme-stop: stop the oai-cn.mmed daemon oai-cn.mme-restart: restart the oai-cn.mmed daemon oai-cn.mme-status: get the oai-cn.mmed status oai-cn.mme-journal: get the oai-cn.mmed logs oai-cn.mme: run MME oai-cn.mme-init: initialize MME oai-cn.mme-conf-set: set the MME configuration file oai-cn.mme-conf-get: get the current MME configuration file (mme.conf) oai-cn.mme-conf-show: show the path to the MME configuration file (mme.conf) oai-cn.mme-conf-list: list all the SPGW configuration files (mme.conf, mme_fd) oai-cn.spgw-start: start the oai-cn.spgwd daemon oai-cn.spgw-stop: stop the oai-cn.spgwd daemon oai-cn.spgw-restart: restart the oai-cn.spgwd daemon oai-cn.spgw-status: get the oai-cn.spgwd status oai-cn.spgw-journal: get the oai-cn.spgwd logs oai-cn.spgw: run SPGW oai-cn.spgw-init: initialize SPGW oai-cn.spgw-init: initialize SPGW oai-cn.spgw-conf-set: set the SPGW configuration file oai-cn.spgw-conf-get: get the current SPGW configuration file (spgw.conf) oai-cn.spgw-conf-show: show the path to the SPGW configuration file (spgw.conf) oai-cn.spgw-conf-list: list all the SPGW configuration files (spgw.conf) help: print this help ``` ::: ## Problem ### &check; HSS attaching failed :::danger :::success **solution** Check the database if there stores the SIM card info what we are testing. ```shell= $ mysql -u root -p oai_db` mysql> select imsi, hex(users.key), sqn, hex(rand), hex(OPc) from users where imsi regexp "^20895"; ## Assume PLMN is 20895 ``` ::: ### &check; HSS unknow database "oai_db" :::danger **wrong message** ![](https://i.imgur.com/N2PiV2U.png) :::success **solution** Enter MySQL to create database as oai_db for HSS. ```shell= $ mysql -u root -p mysql> CREATE DATABASE oai_db; ``` ![](https://i.imgur.com/2qaexF6.png) Select database. ```shell= mysql> USE oai_db; ``` ![](https://i.imgur.com/qcSP7Cj.png) Exit. ```shell= exit ``` ::: ### &check; Can't enter MySQL :::danger **wrong message1** `sudo mysql` failed. ![](https://i.imgur.com/Uhn0Q83.png) :::success **solution** ```shell= mysql -u root -p ``` :::danger **wrong message2** Forget password. ![](https://i.imgur.com/9ZWHArS.png) :::success **solution1** Password usually is `localhost` or what you set when installed MySQL(`linux` for example). **solution2** Enter `/etc/mysql/debian.cnf` to check the password of client. ```shell= sudo cat /etc/mysql/debian.cnf ``` ![](https://i.imgur.com/YTDxajA.png) Choose one client and type its password. ```shell= mysql -udebian-sys-maint -p ``` ![](https://i.imgur.com/bbCbaS3.png) Now, you can modify database in MySQL. Exit MySQL. ```shell= exit ``` Ref. http://mustgeorge.blogspot.com/2011/11/mysql-error-1045-28000-using-password.html ::: ### &check; eNB can't not find MME and cashed :::danger **wrong message** HSS log: ![](https://i.imgur.com/yPJXzCl.png) Wireshark: ![](https://i.imgur.com/Cwdk9Tv.png) :::success **solution** Clean the HSS and compile it again. ```shell= $ cd ~/mosaic5g/oai-cn/scripts $ ./build_hss -c ``` ::: ### &check; Can't apt-get update :::danger **wrong message** ![](https://i.imgur.com/yJnvlUo.png) :::success **solution** ```shell= $ sudo rm -R /var/lib/apt/lists/lock ``` ![](https://i.imgur.com/4I1e8BC.png) Ref. https://www.ubuntu-tw.org/modules/newbb/viewtopic.php?post_id=290136 ::: ### &check; Error signal 11 :::danger **wrong message** The SDR is likely not connect or detected. ```shell= Error: signal 11: /snap/oai-ran/18/enb/oai-ran(signal_handler+0x79)[0x5283e9] /lib/x86_64-linux-gnu/libc.so.6(+0x354b0)[0x7fed795fd4b0] ``` :::success **solution** ```shell= $ sudo uhd_usrp_probe $ sudo uhd_usrp_probe --args="type=b200" ``` ::: ### &check; Lost command :::info #### CN Enter the install from https://snapcraft.io/oai-cn. Copy the command. sudo snap install oai-cn modify it to below ``` sudo snap install oai-cn --devmode ``` #### RAN Enter the install from https://snapcraft.io/oai-cn. Copy the command. sudo snap install oai-cn modify it to below ``` sudo snap install oai-ran --devmode ``` and so on to other nodes. ::: ### &check; IP addresses for RAN and CN :::info Be sure you have at least two IP addresses for RAN and CN. You can let HSS, MME, SPGW have the same IP, but must let RAN have different IP to CN. :::

    Import from clipboard

    Paste your markdown or webpage here...

    Advanced permission required

    Your current role can only read. Ask the system administrator to acquire write and comment permission.

    This team is disabled

    Sorry, this team is disabled. You can't edit this note.

    This note is locked

    Sorry, only owner can edit this note.

    Reach the limit

    Sorry, you've reached the max length this note can be.
    Please reduce the content or divide it to more notes, thank you!

    Import from Gist

    Import from Snippet

    or

    Export to Snippet

    Are you sure?

    Do you really want to delete this note?
    All users will lose their connection.

    Create a note from template

    Create a note from template

    Oops...
    This template has been removed or transferred.
    Upgrade
    All
    • All
    • Team
    No template.

    Create a template

    Upgrade

    Delete template

    Do you really want to delete this template?
    Turn this template into a regular note and keep its content, versions, and comments.

    This page need refresh

    You have an incompatible client version.
    Refresh to update.
    New version available!
    See releases notes here
    Refresh to enjoy new features.
    Your user state has changed.
    Refresh to load new user state.

    Sign in

    Forgot password

    or

    By clicking below, you agree to our terms of service.

    Sign in via Facebook Sign in via Twitter Sign in via GitHub Sign in via Dropbox Sign in with Wallet
    Wallet ( )
    Connect another wallet

    New to HackMD? Sign up

    Help

    • English
    • 中文
    • Français
    • Deutsch
    • 日本語
    • Español
    • Català
    • Ελληνικά
    • Português
    • italiano
    • Türkçe
    • Русский
    • Nederlands
    • hrvatski jezik
    • język polski
    • Українська
    • हिन्दी
    • svenska
    • Esperanto
    • dansk

    Documents

    Help & Tutorial

    How to use Book mode

    Slide Example

    API Docs

    Edit in VSCode

    Install browser extension

    Contacts

    Feedback

    Discord

    Send us email

    Resources

    Releases

    Pricing

    Blog

    Policy

    Terms

    Privacy

    Cheatsheet

    Syntax Example Reference
    # Header Header 基本排版
    - Unordered List
    • Unordered List
    1. Ordered List
    1. Ordered List
    - [ ] Todo List
    • Todo List
    > Blockquote
    Blockquote
    **Bold font** Bold font
    *Italics font* Italics font
    ~~Strikethrough~~ Strikethrough
    19^th^ 19th
    H~2~O H2O
    ++Inserted text++ Inserted text
    ==Marked text== Marked text
    [link text](https:// "title") Link
    ![image alt](https:// "title") Image
    `Code` Code 在筆記中貼入程式碼
    ```javascript
    var i = 0;
    ```
    var i = 0;
    :smile: :smile: Emoji list
    {%youtube youtube_id %} Externals
    $L^aT_eX$ LaTeX
    :::info
    This is a alert area.
    :::

    This is a alert area.

    Versions and GitHub Sync
    Get Full History Access

    • Edit version name
    • Delete

    revision author avatar     named on  

    More Less

    Note content is identical to the latest version.
    Compare
      Choose a version
      No search result
      Version not found
    Sign in to link this note to GitHub
    Learn more
    This note is not linked with GitHub
     

    Feedback

    Submission failed, please try again

    Thanks for your support.

    On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

    Please give us some advice and help us improve HackMD.

     

    Thanks for your feedback

    Remove version name

    Do you want to remove this version name and description?

    Transfer ownership

    Transfer to
      Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

        Link with GitHub

        Please authorize HackMD on GitHub
        • Please sign in to GitHub and install the HackMD app on your GitHub repo.
        • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
        Learn more  Sign in to GitHub

        Push the note to GitHub Push to GitHub Pull a file from GitHub

          Authorize again
         

        Choose which file to push to

        Select repo
        Refresh Authorize more repos
        Select branch
        Select file
        Select branch
        Choose version(s) to push
        • Save a new version and push
        • Choose from existing versions
        Include title and tags
        Available push count

        Pull from GitHub

         
        File from GitHub
        File from HackMD

        GitHub Link Settings

        File linked

        Linked by
        File path
        Last synced branch
        Available push count

        Danger Zone

        Unlink
        You will no longer receive notification when GitHub file changes after unlink.

        Syncing

        Push failed

        Push successfully