free5gc-compose 环境搭建

环境

ㅤ ㅤVMware + fedora35

系统环境

  1. 常规更新 和 开发环境
dnf update -y
dnf groupinstall "Development Tools" "Development Libraries" -y
# 内核可能会更新
reboot 
  1. docker && docker-compose 安装
  • docker
curl -sSL https://get.daocloud.io/docker | sh
  • docker-compose
curl -L https://get.daocloud.io/docker/compose/releases/download/v2.9.0/docker-compose-`uname -s`-`uname -m` -o /usr/bin/docker-compose && chmod +x /usr/bin/docker-compose
  1. gtp5g && libgtp5gnl
    ㅤ ㅤ安装编译 gtp5g 和 libgtp5gnl 需要用到的库
dnf -y install libtool pkg-config libmnl-devel libyaml-devel
  • gtp5g
git clone https://github.com/free5gc/gtp5g.git
cd gtp5g
make clean && make
make install
  • libgtp5gnl
git clone https://github.com/free5gc/libgtp5gnl.git
cd libgtp5gnl
autoreconf -iv
./configure --prefix=`pwd`
make
./run.sh UPF_PDR_FAR_QER
  1. free5gc-compose
git clone https://github.com/free5gc/free5gc-compose.git
cd free5gc-compose
make base
docker-compose build
docker-compose up

遇到的问题

  1. gtp5g 编译失败
eth_type_trans [-Werror=implicit-function-declaration]

ㅤ ㅤ修改 Makefile

EXTRA_CFLAGS += -Wno-misleading-indentation -Wuninitialized -Wno-implicit-function-declaration
  1. free5gc-compose 编译失败
  • docker 镜像下载失败
echo {"registry-mirrors": ["https://docker.mirrors.ustc.edu.cn"]} > /etc/docker/daemon.json
  • 从 deb.debian.org 和 security.debian.org 下载失败
    ㅤ ㅤ修改为国内源,修改 Dockerfile,在 "RUN apt-get update" 前加入以下信息
RUN sed -i 's|security.debian.org|mirrors.ustc.edu.cn|g' /etc/apt/sources.list \
&& sed -i 's|deb.debian.org|mirrors.ustc.edu.cn|g' /etc/apt/sources.list
  • github 下载失败
    ㅤ ㅤ通过第三方下载,修改 Dockerfile,在 "RUN ... git clone" 前加入以下信息
RUN git config --global url."https://hub.fastgit.xyz/".insteadOf "https://github.com/"
RUN git config --global protocol.https.allow always
RUN git config --global http.sslverify false
  • go 模块下载失败
    ㅤ ㅤ修改为国内源
RUN export GOPROXY=https://goproxy.io
RUN export GO111MODULE=on
RUN go env -w GOPROXY=https://goproxy.io
  • cmake 下载失败
    ㅤ ㅤ修改 Dockerfile
&& wget https://download.fastgit.org/Kitware/CMake/releases/download/v3.22.1/cmake-3.22.1-linux-x86_64.sh -O cmake_installer.sh \
  1. SCTP socket could not be created
terminate called after throwing an instance of 'sctp::SctpError'
  what():  SCTP socket could not be created
Aborted (core dumped)

ㅤ ㅤ如果是虚拟机或云主机,检查 "/etc/default/grub",如果 "GRUB_CMDLINE_LINUX" 中存在 "ipv6.disable=1 ", 删除 " ipv6.disable=1 ";如果没有,检查主机是否禁用了 IPV6;原因是 SCTP 创建 socket 时,使用的参数是 "AF_INET6";

grub2-mkconfig -o /boot/grub2/grub.cfg
reboot

ㅤ ㅤ挂载 sctp

modprobe sctp
lsmod | grep sctp

ㅤ ㅤ开机自动挂载sctp

echo "sctp" >> /etc/modules
posted @ 2022-08-03 11:35  sfdevs  阅读(561)  评论(0)    收藏  举报