Setting up OAI-CN + OAI-C-RAN + Flexran(3 PC) Setup === [TOC] The following is the steps I did to Establish the test environment involving UE, oai-cn, RRU and BBU. ## Hardware Requirements - 3 PC (1 for RRU, 1 for RCC & 1 for EPC) Core-i5 4460, 4GB RAM at minimum - Ubuntu 16.04 LTS - USRP B210 (connect to PC with USB 3.0) - Cisco Catalyst 2960 Switch (Optional)(you can use just router) ![](https://i.imgur.com/A4IFmSI.jpg) ## OAI-CN setup (for EPC) ### Clone Repo First, clone build script from mosaic5g repository `git clone https://gitlab.eurecom.fr/mosaic5g/mosaic5g.git` ### Install OAI-CN by snap ``` cd mosaic5g/ sudo ./build_m5g -C # install oai-cn by snap ``` ### Prepare MySQL Make sure that MySQL is installed ```shell $ sudo apt install mysql-server mysql-client ``` Set your desired password for 'root' user. (reccomended password is 'linux') ### Configure HSS First, run `sudo oai-cn.hss-init` to initialize. Use `oai-cn.hss-conf-get` to get the location of config file. ``` oai@oai:~$ oai-cn.hss-conf-get /var/snap/oai-cn/current/hss.conf ``` Edit the `hss.conf`, following is an example. ``` ... 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"; }; ``` - Comment the first OPERATOR_KEY and uncomment the second one - Make sure the options of MySQL is correct (server, user, pass) In `hss_fd.conf`, change the following lines, ``` ... Identity = "oai.openair4G.eur"; # Change oai to your hostname ... ``` Run `oai-cn.hss-init` again to apply changes. If the settings are fine, you should see this, ``` oai@oai:~$ sudo oai-cn.hss ... Initializing s6a layer: DONE ``` ### Configure MME Run `sudo oai-cn.mme-init` to Initialize. Edit the following files `mme.conf`, `mme_fd.conf` Similar to **HSS**, use `oai-cn.mme-conf-get` to get the location of the config file. ``` oai@oai:~$ oai-cn.mme-conf-get /var/snap/oai-cn/current/mme.conf oai@oai:~$ cat /var/snap/oai-cn/current/mme mme.cacert.pem mme.cakey.pem mme.cert.pem mme.conf mme_fd.conf mme.key.pem ``` You'll find out that they are all in the same directory. Revise `mme.conf` according to following example, ``` ... S6A : { ... HSS_HOSTNAME = "oai"; # Change it to your hostname }; ... # Make sure MCC=208, MNC=93 GUMMEI_LIST = ( {MCC="208" ; MNC="93"; MME_GID="4" ; MME_CODE="1"; } # YOUR GUMMEI CONFIG HERE ); ... # Make sure MCC=208, MNC=93 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 = "eno1"; # YOUR NETWORK CONFIG HERE MME_IPV4_ADDRESS_FOR_S1_MME = "192.168.1.122/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 }; ``` Revise `mme_fd.conf` according to the following example, ``` ... # Uncomment if the framework cannot resolv it. Identity = "oai.openair4G.eur"; #Change oai to your hostname Realm = "openair4G.eur"; ... ConnectPeer= "oai.openair4G.eur" { ConnectTo = "127.0.0.1"; No_SCTP ; No_IPv6; Prefer_TCP; No_TLS; port = 3868; realm = "openair4G.eur";}; # The same, change oai to your hostname ``` ### Test running MME and HSS Run **HSS** and then run **MME** with `sudo oai-cn.mme`. If the setting is correct, you should see this in **MME** terminal ``` ... 000206 00001:791935 7FD6127FC700 DEBUG S6A rts/mme/build/src/s6a/s6a_peer.c:0163 Peer oai.openair4G.eur is now connected... ``` At **HSS**, you should see ``` ... 03/19/19,00:12:34.792561 NOTI 'STATE_CLOSED' -> 'STATE_OPEN' 'oai.openair4G.eur' ``` ### Configure SPGW Run `sudo oai-cn.spgw-init` to initialize. Use `oai-cn.spgw-conf-get` to get the location of config files. ``` oai@oai:~$ oai-cn.spgw-conf-get /var/snap/oai-cn/current/spgw.conf ``` Follow below example to change the spgw.conf, ``` ... 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 = "eno1"; # STRING, interface name, YOUR NETWORK CONFIG HERE, USE "lo" if S-GW run on eNB host SGW_IPV4_ADDRESS_FOR_S1U_S12_S4_UP = "192.168.1.122/24"; # STRING, CIDR, YOUR NETWORK CONFIG HERE 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 = "yes"; SGW_REMOTE_CONTROLLER_IPV4_ADDRESS = "140.118.123.100"; SGW_REMOTE_CONTROLLER_PORT = 9999; }; ... P-GW = { NETWORK_INTERFACES : { # P-GW binded interface for SGI (egress/ingress internet traffic) PGW_INTERFACE_NAME_FOR_SGI = "eno1"; # Your interface to internet ... # DNS address communicated to UEs DEFAULT_DNS_IPV4_ADDRESS = "8.8.8.8"; # DNS server of your internet ... ``` Run **SPGW** with `sudo oai-cn.spgw`, you'll see ``` oai@oai:~$ sudo oai-cn.spgw ... Initializing SPGW-APP task interface: DONE ``` ## OAI-RAN (RRU) ### Clone Repo First, clone build script from mosaic5g repository `git clone https://gitlab.eurecom.fr/mosaic5g/mosaic5g.git` ### Install OAI-RAN Install OAI-RAN by snap ``` sudo ./build_m5g -R # install oai-ran by snap ``` ### Configure RRU (without flexran first) We'll use `sudo oai-ran.enb` to run our eNB. But before that, get the config file ``` oai@oai:~$ sudo oai-ran.enb-conf-get /var/snap/oai-ran/current/enb.band7.tm1.50PRB.usrpb210.conf ``` We need to change the config file to the RRU config file so it will run as an RRU and not a monolothic eNB ``` oai@oai:~$ sudo oai-ran.enb-conf-set /var/snap/oai-ran/current/rru.conf ``` Change `rru.conf` according to following example, ``` RUs = ( { local_if_name = "eno1"; remote_address = "192.168.1.200" local_address = "192.168.1.201"; local_portc = 50000; remote_portc = 50000; local_portd = 50001; remote_portd = 50001; local_rf = "yes" tr_preference = "udp_if4p5"; nb_tx = 1; nb_rx = 1; max_pdschReferenceSignalPower = -24; max_rxgain = 120; bands = [7,13]; } ); ``` ## OAI-RAN (RCC) ### Clone Repo First, clone build script from mosaic5g repository `git clone https://gitlab.eurecom.fr/mosaic5g/mosaic5g.git` ### Install OAI-RAN Install OAI-RAN by snap ``` sudo ./build_m5g -R # install oai-ran by snap ``` ### Configure RCC We'll use `sudo oai-ran.enb` to run our eNB. But before that, get the config file ``` oai@oai:~$ sudo oai-ran.enb-conf-get /var/snap/oai-ran/18/enb.band7.tm1.50PRB.usrpb210.conf ``` We need to change the config file to the RCC config file so it will run as an RCC/BBU and not a monolothic eNB ``` oai@oai:~$ sudo oai-ran.enb-conf-set /var/snap/oai-ran/current/rcc.band7.tm1.if4p5.50PRB.conf ``` Change `rcc.band7.tm1.if4p5.50PRB.conf` according to following example, ``` ... plmn_list = ( { mcc = 208; mnc = 93; mnc_length = 2; } ); ... ////////// MME parameters: mme_ip_address = ( { ipv4 = "192.168.1.122"; ipv6 = "192:168:30::17"; active = "yes"; preference = "ipv4"; } ); NETWORK_INTERFACES : { ENB_INTERFACE_NAME_FOR_S1_MME = "eno1"; ENB_IPV4_ADDRESS_FOR_S1_MME = "192.168.1.201/24"; ENB_INTERFACE_NAME_FOR_S1U = "eno1"; ENB_IPV4_ADDRESS_FOR_S1U = "192.168.1.201/24"; ENB_PORT_FOR_S1U = 2152; # Spec 2152 ENB_IPV4_ADDRESS_FOR_X2C = "192.168.1.201/24"; ENB_PORT_FOR_X2C = 36422; # Spec 36422 }; ... NETWORK_CONTROLLER : { FLEXRAN_ENABLED = "no"; ... ``` Now we are ready to run everything and connect a UE. ## Run OAI ``` ## Run manually Run HSS oai@oai:~$ sudo oai-cn.hss Run MME oai@oai:~$ sudo oai-cn.mme Run SPGE oai@oai:~$ sudo oai-cn.spgw ## Run and stop all epc component as a service oai@oai:~$ sudo oai-cn.start-all oai@oai:~$ sudo oai-cn.stop-all ## Run RRU/RCC oai@oai:~$ sudo oai-ran.enb ``` ## Setup Flexran in RCC ![](https://i.imgur.com/4LaHav7.jpg) The only difference is that we need to add network Controller config to the rcc config ``` oai@oai:~$ oai-cn.spgw-conf-get /var/snap/oai-cn/current/spgw.conf ``` ``` ... plmn_list = ( { mcc = 208; mnc = 93; mnc_length = 2; } ); ... ////////// MME parameters: mme_ip_address = ( { ipv4 = "192.168.1.122"; ipv6 = "192:168:30::17"; active = "yes"; preference = "ipv4"; } ); NETWORK_INTERFACES : { ENB_INTERFACE_NAME_FOR_S1_MME = "eno1"; ENB_IPV4_ADDRESS_FOR_S1_MME = "192.168.1.201/24"; ENB_INTERFACE_NAME_FOR_S1U = "eno1"; ENB_IPV4_ADDRESS_FOR_S1U = "192.168.1.201/24"; ENB_PORT_FOR_S1U = 2152; # Spec 2152 ENB_IPV4_ADDRESS_FOR_X2C = "192.168.1.201/24"; ENB_PORT_FOR_X2C = 36422; # Spec 36422 }; ... NETWORK_CONTROLLER : { FLEXRAN_ENABLED = "yes"; FLEXRAN_INTERFACE_NAME = "eno1"; FLEXRAN_IPV4_ADDRESS = "192.168.1.122"; FLEXRAN_PORT = 2210; FLEXRAN_CACHE = "/mnt/oai_agent_cache"; FLEXRAN_AWAIT_RECONF = "no"; }; ``` ## FlexRAN Setup (for eNodeB Controller) Install FlexRAN by snap ``` sudo ./build_m5g -F # install oai-ran by snap ``` We'll use `sudo flexran` to run our FlexRAN. Now we are ready to run everything and connect a UE. ## Run OAI and FlexRAN ``` ## Run EPC manually Run HSS oai@oai:~$ sudo oai-cn.hss Run MME oai@oai:~$ sudo oai-cn.mme Run SPGE oai@oai:~$ sudo oai-cn.spgw ## Run and stop as a service oai@oai:~$ sudo oai-cn.start-all oai@oai:~$ sudo oai-cn.stop-all ## Run FlexRAN oai@oai:~$ sudo flexran ## Run eNB oai@oai:~$ sudo oai-ran.enb ```