# 0428 OAI Training Course ###### tags: `OAI` Slides for presentation : [here](http://140.118.123.114/for_New/OAI_Training_0428.pdf) ## Set up OAI eNB and EPC in a single Virtual Machine eNB and EPC are in a single machine (same host). Note: the procedure will be almost same if you use physical mahine! --- ==Connection scenario:== ![](https://i.imgur.com/6jytx21.png) --- The benefit of this deployment: - Easy to setup the develop environment for eNB protocol test. - This deployment can show the connection between instance with a very easy way - Really bring internet via wireless to UE! Hardware requirements: - Intel based CPU with 4 cores at 2.7GHz or above - 8G RAM or above - USB3.0 - Ubuntu 14.04 ### Install Virtual Machine I prefer [VMware](https://my.vmware.com/en/web/vmware/free#desktop_end_user_computing/vmware_workstation_player/12_0) [Ubuntu img for 14.04](http://ubuntu.cs.nctu.edu.tw/ubuntu-cd/14.04.5/ubuntu-14.04.5-desktop-amd64.iso) ==Create a New virtual Machine== ![](https://i.imgur.com/5iGrKDc.png) ==Select the image that we have downloaded== ![](https://i.imgur.com/27XvY9H.png) ==Enter the hostname and user name : oai== ![](https://i.imgur.com/uBsKWkE.png) ==Set whatever you want== ![](https://i.imgur.com/3sCgeJJ.png) ==Hardware setting== ![](https://i.imgur.com/ah4KZHX.png) ![](https://i.imgur.com/2GTBfYh.png) ![](https://i.imgur.com/2HSubwh.png) Then start the installation, after the installation we can get into next step. ### OAI environment set up and installation #### Environment / low-latency kernel setup ```shell= # always do this when you have a new system oai@ubuntu:~$ sudo apt-get update # if you don't want to use vim, you can use gedit instead of the following edit command oai@ubuntu:~$ sudo apt-get install vim # change hostname oai@ubuntu:~$ sudo vim /etc/hostname replace ubuntu to oai oai@ubuntu:~$ sudo vim /etc/hosts replace ubuntu to oai.openair4G.eur oai then reboot machine, open terminal you shall see oai@oai:~$ # install git oai@oai:~$ sudo apt-get install git -y # clone the eNB/UE source code oai@oai:~$ git clone https://gitlab.eurecom.fr/oai/openairinterface5g.git # clone the EPC source code oai@oai:~$ git clone https://github.com/OPENAIRINTERFACE/openair-cn.git oai@oai:~$ cd openair-cn/ # swtich the branch to the one that we gonna use oai@oai:~/openair-cn$ git checkout v0.3.2 # Install low-lentency kernel oai@oai:~$ sudo apt-get install linux-lowlatency-lts-vivid -y # Set cpu scaling oai@oai:~$ sudo apt-get install cpufrequtils oai@oai:~$ sudo vim /etc/default/cpufrequtils add GOVERNOR="performance" to this file oai@oai:~$ sudo update-rc.d ondemand disable # remove the kernel we won't used oai@oai:~$ dpkg --get-selections | grep linux-image linux-image-3.19.0-80-lowlatency install linux-image-4.4.0-31-generic install linux-image-extra-4.4.0-31-generic install linux-image-generic-lts-xenial install linux-image-lowlatency-lts-vivid install oai@oai:~$ sudo apt-get purge linux-image-4.4.0-31-generic linux-image-extra-4.4.0-31-generic linux-image-generic-lts-xenial oai@oai:~$ sudo update-grub2 reboot! ``` Fine, we can get into the last step! check uname -a first, you will have ![](https://i.imgur.com/2ULZkpO.png) :::info If you can't do the copy and paste from host to guest, try the following command. ::: ``` sudo apt-get install open-vm-tools-desktop reboot ``` #### Openair-CN (EPC) installation ```shell= # Enter the script of epc installation oai@oai:~$ cd openair-cn/SCRIPTS/ # Install the package which is needed from HSS oai@oai:~/openair-cn/SCRIPTS$ sudo ./build_hss -i ``` - Set MySQL password to ==**linux**== - Choose apache - Set phpmyadmin password to ==**linux**== ```shell= # Install the package which is needed from epc (including MME and SPGW) oai@oai:~/openair-cn/SCRIPTS$ sudo ./build_epc -i ``` #### Openairinterface eNB installation ```shell= oai@oai:~/openair-cn/SCRIPTS$ cd ~/openairinterface5g/cmake_targets/ # Install the package which is needed from eNB, including UHD driver oai@oai:~/openairinterface5g/cmake_targets$ sudo ./build_oai -I --eNB -x --install-system-files -w USRP # Note if you do any modification related to source code, this compiling script should run to adapt your modification oai@oai:~/openairinterface5g/cmake_targets$ sudo ./build_oai -w USRP -x -c --eNB ``` --- (Only for M-CORD implementation) #### Openairinterface eNB CU installation ```shell= oai@oai:~/openair-cn/SCRIPTS$ cd ~/openairinterface5g/cmake_targets/ oai@oai:~/openairinterface5g/cmake_targets$ git checkout feature-127-protocol-split # Install the package which is needed from eNB, including UHD driver oai@oai:~/openairinterface5g/cmake_targets$ sudo ./build_oai -I --eNB -x --install-system-files --pdcp-split -t ETHERNET # Note if you do any modification related to source code, this compiling script should run to adapt your modification oai@oai:~/openairinterface5g/cmake_targets$ sudo ./build_oai -t ETHERNET -c --eNB ``` conf: http://140.118.123.114/conf/ --- #### Configuration Setting for connect eNB to EPC eNB configuration ```shell= # Copy the configruation files we will use for eNB oai@oai:~/openairinterface5g/cmake_targets$ cd ~/openairinterface5g/targets/PROJECTS/GENERIC-LTE-EPC/CONF/ oai@oai:~/openairinterface5g/targets/PROJECTS/GENERIC-LTE-EPC/CONF$ cp enb.band7.tm1.50PRB.usrpb210.conf ~/ oai@oai:~/openairinterface5g/targets/PROJECTS/GENERIC-LTE-EPC/CONF$ cd # Modify eNB configuration oai@oai:~$ vim enb.band7.tm1.50PRB.usrpb210.conf ``` Edit the following part ```shell= ~ ////////// MME parameters: mme_ip_address = ( { ipv4 = "192.170.0.1"; ipv6 = "192:168:30::17"; active = "yes"; preference = "ipv4"; } ); NETWORK_INTERFACES : { ENB_INTERFACE_NAME_FOR_S1_MME = "eth0:3"; ENB_IPV4_ADDRESS_FOR_S1_MME = "192.170.0.2/24"; ENB_INTERFACE_NAME_FOR_S1U = "eth0:4"; ENB_IPV4_ADDRESS_FOR_S1U = "192.170.1.2/24"; ENB_PORT_FOR_S1U = 2152; # Spec 2152 }; ~ ``` Record your eth0 ip address ```shell= oai@oai:~$ ifconfig eth0 Link encap:Ethernet HWaddr 00:0c:29:95:8e:c2 inet addr:192.168.239.128 Bcast:192.168.239.255 Mask:255.255.255.0 inet6 addr: fe80::20c:29ff:fe95:8ec2/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:400004 errors:0 dropped:0 overruns:0 frame:0 TX packets:117545 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:600609444 (600.6 MB) TX bytes:7270652 (7.2 MB) lo Link encap:Local Loopback inet addr:127.0.0.1 Mask:255.0.0.0 inet6 addr: ::1/128 Scope:Host UP LOOPBACK RUNNING MTU:65536 Metric:1 RX packets:651 errors:0 dropped:0 overruns:0 frame:0 TX packets:651 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:72652 (72.6 KB) TX bytes:72652 (72.6 KB) ``` EPC configuration ```shell= oai@oai:~$ cd openair-cn/BUILD/EPC/ oai@oai:~/openair-cn/BUILD/EPC$ vim epc.conf.in ``` Modify the following part: ``` ~ REALM = "openair4G.eur"; # DO NOT CHANGE ~ S6A : { S6A_CONF = "/usr/lib/../etc/freeDiameter/mme_fd.conf";# DO NOT CHANGE HSS_HOSTNAME = "oai"; # DO NOT CHANGE }; ~ TAI_LIST = ( {MCC="208" ; MNC="93"; TAC = "1"; }, # YOUR TAI CONFIG HERE {MCC="208" ; MNC="93"; TAC = "2"; }, # YOUR TAI CONFIG HERE {MCC="208" ; MNC="93"; TAC = "3"; }, # YOUR TAI CONFIG HERE {MCC="208" ; MNC="93"; TAC = "4"; }, # YOUR TAI CONFIG HERE {MCC="208" ; MNC="93"; TAC = "5"; } # YOUR TAI CONFIG HERE ); ~ LOGGING : { # OUTPUT choice in { "CONSOLE", "`path to file`", "`IPv4@`:`TCP port num`"} # `path to file` must start with '.' or '/' # if TCP stream choice, then you can easily dump the traffic on the remote or local host: nc -l `TCP port num` > received.txt OUTPUT = "CONSOLE"; ~ # P-GW binded interface for SGI (egress/ingress internet traffic) PGW_INTERFACE_NAME_FOR_SGI = "eth0"; # YOUR NETWORK CONFIG HERE PGW_IPV4_ADDRESS_FOR_SGI = "192.168.239.128/24"; # YOUR NETWORK CONFIG HERE PGW_MASQUERADE_SGI = "yes"; ~ # DNS address communicated to UEs DEFAULT_DNS_IPV4_ADDRESS = "140.118.31.99"; # YOUR NETWORK CONFIG HERE DEFAULT_DNS_SEC_IPV4_ADDRESS = "8.8.8.8"; # YOUR NETWORK CONFIG HERE ~ ``` ### Run OAI ! ```shell= oai@oai:~/openair-cn/BUILD/EPC$ cd ~/openair-cn/SCRIPTS/ oai@oai:~/openair-cn/SCRIPTS$ sudo ./build_epc -i oai@oai:~/openair-cn/SCRIPTS$ sudo ./build_epc -c -l oai@oai:~/openair-cn/SCRIPTS$ sudo ./build_hss -c -l Open 2 terminals oai@oai:~/openair-cn/SCRIPTS$ sudo ./run_epc -i -r 036 ================== Statistics ================== 000294 00040:845928 7F23ACAF9700 DEBUG MME-AP SRC/MME_APP/mme_app_statistics.c:0037 | Global | Since last display | 000295 00040:845929 7F23ACAF9700 DEBUG MME-AP SRC/MME_APP/mme_app_statistics.c:0038 UE | 0 | 0 | 000296 00040:845930 7F23ACAF9700 DEBUG MME-AP SRC/MME_APP/mme_app_statistics.c:0039 Bearers | 0 | 0 | oai@oai:~/openair-cn/SCRIPTS$ sudo ./run_hss Open 1 terminal oai@oai:~$ cd openairinterface5g/cmake_targets/lte_build_oai/build/ oai@oai:~/openairinterface5g/cmake_targets/lte_build_oai/build$ sudo ifconfig eth0:3 192.170.0.2 up oai@oai:~/openairinterface5g/cmake_targets/lte_build_oai/build$ sudo ifconfig eth0:4 192.170.1.2 up oai@oai:~/openairinterface5g/cmake_targets/lte_build_oai/build$ sudo ./lte-softmodem -E -O ~/enb.band7.tm1.50PRB.usrpb210.conf -d ```