Ubuntu 17.04 安装 OpenAirInterface (OAI)修订教程

来源:互联网 发布:mysql 5.7 msi 安装 编辑:程序博客网 时间:2024/06/09 22:08

Ubuntu 17.04 安装 OpenAirInterface (OAI)教程


        本文在另外一篇博客的基础上经过实验修改部分内容,原文链接 http://blog.csdn.net/jxwxg/article/details/73744702。经过实验5M带宽下相对稳定。连接2个手机都可以正常上网。

  国外有一个大神写了一个基于Ubuntu 17.04安装OAI eNB,UE和EPC一整套系统的教程。原文链接https://open-cells.com/index.php/2017/06/07/openair-single-machine-ubuntu-17-04-after-major-epc-update/ 。笔者亲测有效,整套系统可以在 5M 带宽下成功运行。原文有一个小地方有问题,笔者对此略微做了修改,现把教程复制到下文,权当分享。方便无法翻墙的同学学习。

  干货,绝对不坑。


  如果在安装依赖库过程中出现如下错误

[cpp] view plain copy
  1. cloning to '/opt/ssh'...  
  2. fatal:unable to access'https://gist.github.com/2190472.git/' : Failed to connect to gist.github.comport 443: Connection timed out  

解决方法:(其实可以自己copy一份放到其他地发,只要能快速连上下载就行)

  则用vim打开 build_helper文件,即 vim tools/build_helper  注释下面两行代码

[cpp] view plain copy
  1. $SUDO rm -fr /opt/ssh  
  2. $SUDO git clonehttps://gist.github.com/2190472.git /opt/ssh  




OpenAir, single machine Ubuntu 17.04, after major EPC update

(updated: 2017, June 7th)

This document explains how to install and configure OAI EPC+eNB on one single Ubuntu 17.04 64 bits machine connected with a regular UE (a Huawei E3272), routing the UE traffic to internet.

We use EPC after a major contribution in May 2017: a lot of code has been modified, all directories names were changes, configuration parameters names/values changed.

The description uses a USRP B210 board, a Lime SDR page is provided separately.

We also explain how to simplify, fix existing issues, to make a single computer as a full LTE network: EPC+eNB.

Known limitations fixed in the hereafter description

  • OAI EPC require kernel >= 4.7, so we have to use Ubuntu 17.04
    • We already pushed some enhancements in OAI, nevertheless some more are required
  • GTP UDP ports are in conflict for eNB and SGW
  • Useless link between OAI and the Ubuntu/Linux hostname removed
  • Several simplifications and precisions to make easier and reliable installations

Install Ubuntu

  • Prepare a machine: a 4 actual cores, no hyper-threading.
    All other configuration in OAI Wiki (C1 states, …) describes is about useless.
  • Download Ubuntu 17.04 64 bits version iso file
  • create a usb key to boot on it
  • install Ubuntu: choose to install Third party SW, and to upgrade all packages while installing
  • do: apt update; apt upgrade until the machine is up-to-date
  • install git and configure your identification in git:
    sudo apt install git 

  • 1. address:
  • https://gitlab.eurecom.fr/oai/openairinterface5g/wikis/GetSources

  • 2. Configure git with your name/email address (only important if you are developer and want to checkin code to Git):
    git config --global user.name "Your Name"
    git config --global user.email "Your email address"

  • 3. Add a certificate from gitlab.eurecom.fr to your Ubuntu 14.04 installation:
  • echo -n | openssl s_client -showcerts -connect gitlab.eurecom.fr:443 2>/dev/null | sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p' | sudo tee -a /etc/ssl/certs/ca-certificates.crt

  • 4. Disable certificate check completely if you do not have root access to /etc/ssl directory
  • git config --global http.sslverify false

  • 5. Checkout RAN repository (eNB RAN + UE RAN):
    git clone https://gitlab.eurecom.fr/oai/openairinterface5g.git

  • 6. Checkout EPC (Core Network) repository:
    git clone https://gitlab.eurecom.fr/oai/openair-cn.git

  • 7. Optionally (openair-cn build script can install it for you):
    git clone https://gitlab.eurecom.fr/oai/xtables-addons-oai.git
  • if you are upset with sudo password, add this line in /etc/sudoers
    • xxxxxx ALL=(ALL) NOPASSWD: ALL (xxxxxx is your login name)
    • sudo will not ask anymore for a password
In order to checkout the Git repository (for OAI Developers/admins with login to gitlab server)

Please send email to {openair_tech (AT) eurecom (DOT) fr} to be added to the repository
as a developer (only important for users who want to commit code to the repository). If
you do not have account on gitlab.eurecom.fr, please register yourself to gitlab.eurecom.fr.


Checkout with using ssh keys:
  • You will need to put your ssh keys in https://gitlab.eurecom.fr/profile/keys to access to the git repo. Once that is done, checkout the git repository using:
  • git clone git@gitlab.eurecom.fr:oai/openairinterface5g.git
Checkout with user name/password prompt:
  • git clone https://YOUR_USERNAME@gitlab.eurecom.fr/oai/openairinterface5g.git
  • git clone https://YOUR_USERNAME@gitlab.eurecom.fr/oai/openair-cn.git
  • git clone https://YOUR_USERNAME@gitlab.eurecom.fr/oai/xtables-addons-oai.git (optional, openair-cn build script can do it for you)

Which branch to checkout?

develop: This branch contains recent commits that are tested on our test bench.

Please see the work flow page :

https://gitlab.eurecom.fr/oai/openairinterface5g/wikis/GitLabWorkFlow

you can find the latest stable tag release here :

https://gitlab.eurecom.fr/oai/openairinterface5g/tags

Older SVN Release (deprecated and not RECOMMENDED for end user)
Old SVN Release
GitLab Migration Notes
Note that git repository does not contain any branches/tags from SVN.
Only https://svn.eurecom.fr/openair4G/trunk
is migrated from r4000 to Git to reduce the size of the repository.

Install USRP drivers

Ettus has not yet released their driver for Ubuntu 17.04, we take it from source:

  • sudo apt-get install libboost-all-dev libusb-1.0-0-dev python-mako doxygen python-docutils python-requests cmake build-essential
  • git clone git://github.com/EttusResearch/uhd.git
  • cd uhd; mkdir host/build; cd host/build
  • cmake -DCMAKE_INSTALL_PREFIX=/usr ..
  • make -j4
  • sudo make install
  • sudo ldconfig
  • sudo /usr/lib/uhd/utils/uhd_images_downloader.py

nano@nano:~/openairinterface5g/myworkspace$ sudo /usr/lib/uhd/utils/uhd_images_downloader.py 
Images destination:      /usr/share/uhd/images
Downloading images from: http://files.ettus.com/binaries/images/uhd-images_003.010.001.001-27-g47672ede.zip
Downloading images to:   /tmp/tmpenroFp/uhd-images_003.010.001.001-27-g47672ede.zip
57416 kB / 57416 kB (100%)

Images successfully installed to: /usr/share/uhd/images

也可以将zip文件download后保存好后,手动解压缩到/sur/share/uhd/image .

或者按照官方文档安装:

https://kb.ettus.com/Building_and_Installing_the_USRP_Open-Source_Toolchain_(UHD_and_GNU_Radio)_on_Linux


注意:此处安装UHD驱动后,会出现非root用户权限的问题,使用sudo也能识别USRP,但后面执行程序的时候会出问题。解决方法如下:

cd /usr/lib/uhd/utils   或者:cd /usr/local/lib/uhd/utils 看你默认安装在哪里

sudo cp uhd-usrp.rules /etc/udev/rules.d/ 

sudo udevadm control --reload-rules 
sudo udevadm trigger

Download our modifications

download: patches

extract the data: tar xf opencells-mods.tgz

Download & Compile the eNB on 17.04

  • git clone https://gitlab.eurecom.fr/oai/openairinterface5g.git
  • cd openairinterface5g
  • git checkout develop
  • We tested with commit 7580d021d387cc63fcf6ecbb97a87b816676a06f  Tue Jun 6 17:59:32 2017 +0200

  • 注意版本号,那一串commit  log 数字要对上,否在可能出现问题

  • As we already tested and merged in develop updates for Ubuntu 17.04
  • A few more updates are required for Ubuntu 17.04
    replace the file cmake_targets/tools/build_helper by the file in our archive:
    • cp opencells-mods/cmake_targets/tools/build_helper cmake_targets/tools/build_helper
  • Now, you should be able to build as usual the eNB
    • source oaienv                                    # configure the shell
    • ./cmake_targets/build_oai -I       # install SW packages from internet
    • ./cmake_targets/build_oai  -w USRP --eNB --UE # compile eNB         (--UE一定要加,不然后面运行程序也出错)
可能会出现下面错误:
git found: /usr/bin/git
CMake Error at /home/nano/openairinterface5g/cmake_targets/CMakeLists.txt:302 (message):
  /home/nano/openairinterface5g/cmake_targets/tools/generate_asn1: error
Call Stack (most recent call first):
  CMakeLists.txt:19 (include)


-- Configuring incomplete, errors occurred!
build have failed

一般是由于文件夹拷贝导致里面可执行文件没有执行权限。
可对整个文件加可执行权限解决,EPC类似处理。
chmod -R +x openairinterface5g

Download and patch EPC

First, clone OAI EPC:

  • git clone https://gitlab.eurecom.fr/oai/openair-cn.git
  • cd openair-cn
  • git checkout develop

(we used: commit 67180ca07c3f543fb6efde13bfdd88ec153185c7 Date: Tue May 30 10:16:31 2017 +0200

注意版本号,那一串commit  log 数字要对上,否在可能出现问题

Add Ubuntu 17.04 for compilation and fix some bugs

  • cp opencells-mods/build/tools/build_helper  build/tools/build_helper        备注:原文这条命令有误,笔者按照作者意图进行了修改
  • patch -i opencells-mods/src/common/common_defs.h.patch src/common/common_defs.h
  • patch -i opencells-mods/src/oai_mme/oai_mme.c.patch src/oai_mme/oai_mme.c                (这行patch的时候不成功,直接copy覆盖)
  • patch -i opencells-mods/src/oai_hss/utils/hss_config.c.patch src/oai_hss/utils/hss_config.c

Remove link between Linux host name and LTE diameter protocol configuration

  • patch -i opencells-mods/src/s6a/s6a_peer.c.patch src/s6a/s6a_peer.c

Add usage of the input address for the SGW input socket

  • patch -i opencells-mods/src/gtpv1-u/gtp_mod_kernel.c.patch src/gtpv1-u/gtp_mod_kernel.c
  • patch -i opencells-mods/src/gtpv1-u/gtp_mod_kernel.h.patch src/gtpv1-u/gtp_mod_kernel.h
  • patch -i opencells-mods/src/gtpv1-u/gtpv1u_task.c.patch src/gtpv1-u/gtpv1u_task.c

No kernel module patch is required anymore: generic Ubuntu kernel 17.04 works fine with OAI

Install third party SW for EPC

  • cd openair-cn; source oaienv; cd scripts
  • ./build_hss -i
    • Do you want to install freeDiameter 1.2.0 ?: yes
    • set your MySQL password and remember it!
    • Answer yes to install: freeDiameter 1.2.0
    • phpmyadmin:
      • choose light or apache as you prefer
      • Configure database for phpmyadmin with dbconfig-common: yes
      • password: same as MySQL for simplicity
      • We don’t use phpmyadmin later in this procedure, nevertheless we tested successfully also with it
  • Install 3PP SW for mme and spgw
  • ./build_mme -i
    • Do you want to install freeDiameter 1.2.0: no
    • Do you want to install asn1c rev 1516 patched? <y/N>: no
    • Do you want to install libgtpnl ? <y/N>: yes
    • wireshark permissions: as you prefer
  • ./build_spgw -i
    • Do you want to install libgtpnl ? <y/N>: no

Compile the EPC nodes

No difficulty found in this phase.

  • cd openair-cn; source oaienv; cd scripts
  • ./build_hss   有error 解决如下
  • ./build_mme  有error 解决如下
  • ./build_spgw



Our Network setup description

I’ve made a simple configuration for this all-in-one setup.

Each node is on a separate IP address, this address is used for all it’s interfaces. In our case of all-in-one, we take addresses on the loopback: this will be fine on all your machines.

  • HSS is on localhost: 127.0.0.1
  • eNB is on 127.0.0.10
  • MME is on 127.0.0.20
  • SPGW is on 127.0.0.30

The LTE diameter configuration is now isolated fromlinux hostname.

realm for our EPC: “OpenAir5G.Alliance”, so, full distinguish names (FQDN) are: hss.OpenAir5G.Alliance, mme.OpenAir5G.Alliance

Install this configuration for eNB

In your eNB configuration file, the network is now fixed, as lo interface always exists and our computer internal addresses also:

////////// MME parameters: mme_ip_address = ( { ipv4 = "127.0.0.20"; ipv6 = "192:168:30::17"; active = "yes"; preference = "ipv4"; } );NETWORK_INTERFACES :  { ENB_INTERFACE_NAME_FOR_S1_MME = "lo"; ENB_IPV4_ADDRESS_FOR_S1_MME = "127.0.0.10/8";ENB_INTERFACE_NAME_FOR_S1U = "lo"; ENB_IPV4_ADDRESS_FOR_S1U = "127.0.0.10/8"; ENB_PORT_FOR_S1U = 2152; # Spec 2152 };

In the eNB config file, you need also to set the MCC and MNC as per your SIM card:

tracking_area_code = “1”;
mobile_country_code = “208”;
mobile_network_code = “92”;

And obviously, your radio parameters.

Wwe tested with USRP B210 and two parameter files: 10MHz band, 20MHz band, Huawei E3272 UE, a cavity duplexer a simple antenna, about 1 meter distance UE/eNB antenna.

  • openairinterface5g/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.50PRB.usrpb210.conf
  • openairinterface5g/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.100PRB.usrpb210.conf

Install this configuration for EPC

For the EPC, we install in OAI default directory: /usr/local/etc/oai

  • sudo mkdir -p /usr/local/etc/oai
  • sudo cp -rp opencells-mods/config_epc/* /usr/local/etc/oai

Then, you should generate the cyphering certificates:

  • cd openair-cn; source oaienv; cd scripts
  • ./check_hss_s6a_certificate /usr/local/etc/oai/freeDiameter hss.OpenAir5G.Alliance
  • ./check_mme_s6a_certificate /usr/local/etc/oai/freeDiameter mme.OpenAir5G.Alliance

Only the SGi output to internet need to be configured.
In /usr/local/etc/oai/spgw.conf,
your should set the Ethernet interface that is connected to Internet, and,
to tell to the PGW to implement NAPT for the UE traffic

这里根据自己的外网填写,我的是 wlp5s0

 PGW_INTERFACE_NAME_FOR_SGI = "enp3s0";  PGW_MASQUERADE_SGI = "yes";

For the SIM card, you’ll have more to do:

  • SIM MCC/MNC should be duplicated
    • eNB: See above in eNB configuration chapter
    • MME
      • file: /usr/local/etc/oai/mme.conf to update
        • GUMMEI_LIST = ( MCC=”208″ ; MNC=”92″; MME_GID=”4″ ; MME_CODE=”1″; } );
        • TAI_LIST = ({MCC=”208″ ; MNC=”92″; TAC = “1”; } );
    • HSS
      • Configure the password for MySQL
        • in /usr/local/etc/oai/hss.conf, set password as the password you created during MySQL installation
      • A HSS database in text is in: opencells-mods/opencells_db.sql
        • It is pre-configured with the mme id
        • A SIM user in network 001/01 (the test network defined by 3GGP) is already created.
        • 10 users is network 208/92 (a French test network) are also created
        • Each time you import this db, it erases the entire database
          (example: you set mysql password to “linux”)
          • ./hss_db_import 127.0.0.1 root linux oai_db opencells-mods/opencells_db.sql
        • We use to modify the db by updating this file with regular text editor,
          then we re-load the entire database,
          but, if you prefer, usage of http://localhost/phpmyadmin is fine
        • The important values to set are:
          • table pdn:
            • all IMSI are listed, with the APN: these values are in UE/USIM
          • table users:
            • all IMSI, key (Ki) and OPc must be the same inUSIM card
            • Sqn increments automatically  when the UE authenticate in both USIM and HSS DB: it should be set as per USIM internal incrementation
      • SIM card update
        • Open cells UICC and card reader will  be supported

白卡:

        写 http://127.0.0.1/phpmyadmin   里面的参数就可以啦,

       里面预设了10个IMSI :208920100001100-208920100001109

       Ki:6874736969202073796d4b2079650a73

       OPC: 504f20634f6320504f50206363500a4f

       R1-R5:  4000204060

Final test and verification

open 4 terminal windows

  1. in first window
    • cd openair-cn; source oaienv; cd SCRIPTS; ./run_hss
  2. in second window
    • cd openair-cn; source oaienv; cd SCRIPTS; ./run_mme
  3. in third window
    • cd openair-cn; source oaienv; cd SCRIPTS; sudo -E ./run_spgw
  4. in last windows
    • sudo bash
    • cd openairinterface5g; source oaienv
    • sudo ./lte-softmodem -d -O ~/openairinterface5g/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf
  5. Connect the UE, it should attach to network and be able to reach internet through OAI network

We re-built this procedure from scratch and tested two machines: i5-4570 and i5-6600K.

On the i5-4570, at maximum traffic,the eNB is stable on 10MHz band at full user data speed.

On the i5-6600K, we obtain stable performance at maximum traffic over 20MHz, transmission mode 1 (SISO),one single UE over-the-air 1 meter distance:

我的电脑配置 i5-6700HQ CPU, 5M带宽还算稳定,10M 20M 貌似有点不稳定。截了2张图


原创粉丝点击