• 安装依赖关系

    apt-get update
    apt-get install \
       git autoconf automake libtool make libreadline-dev texinfo \
       pkg-config libpam0g-dev libjson-c-dev bison flex python3-pytest \
       libc-ares-dev python3-dev libsystemd-dev python-ipaddress python3-sphinx \
       install-info build-essential libsystemd-dev libsnmp-dev perl libcap-dev
    
  • 安装FRR依赖于的libyang库

    wget https://ci1.netdef.org/browse/LIBYANG-LIBYANG2-150/artifact/shared/Ubuntu-16.04-x86_64-Packages/libyang2_2.0.0-0_amd64.deb 
    wget https://ci1.netdef.org/browse/LIBYANG-LIBYANG2-150/artifact/shared/Ubuntu-16.04-x86_64-Packages/libyang-dev_2.0.0-0_amd64.deb
    apt-get install libpcre2-8-0
    dpkg -i libyang2_2.0.0-0_amd64.deb
    apt-cache policy libpcre32-3
    apt-cache policy libpcrecpp0v5
    apt-get install libpcre16-3=2:8.38-3.1 libpcre32-3=2:8.38-3.1 libpcrecpp0v5=2:8.38-3.1 libpcre3-dev
    apt-get install libpcre2-dev
    dpkg -i libyang-dev_2.0.0-0_amd64.deb
    apt-get install protobuf-c-compiler libprotobuf-c-dev
    apt-get install libzmq5 libzmq3-dev
    apt-get install libelf-dev
    
  • 添加FRR用户和组

    groupadd -r -g 92 frr
    groupadd -r -g 85 frrvty
    adduser --system --ingroup frr --home /var/run/frr/ \
       --gecos "FRR suite" --shell /sbin/nologin frr
    usermod -a -G frrvty frr
    
  • 编译阶段

    git clone https://github.com/frrouting/frr.git frr
    cd frr
    ./bootstrap.sh
    ./configure \
        --prefix=/usr \
        --includedir=\${prefix}/include \
        --enable-exampledir=\${prefix}/share/doc/frr/examples \
        --bindir=\${prefix}/bin \
        --sbindir=\${prefix}/lib/frr \
        --libdir=\${prefix}/lib/frr \
        --libexecdir=\${prefix}/lib/frr \
        --localstatedir=/var/run/frr \
        --sysconfdir=/etc/frr \
        --with-moduledir=\${prefix}/lib/frr/modules \
        --with-libyang-pluginsdir=\${prefix}/lib/frr/libyang_plugins \
        --enable-configfile-mask=0640 \
        --enable-logfile-mask=0640 \
        --enable-snmp=agentx \
        --enable-multipath=64 \
        --enable-user=frr \
        --enable-group=frr \
        --enable-vty-group=frrvty \
        --with-pkg-git-version \
        --enable-systemd=yes \
        --enable-doc-html --enable-ripd --enable-ripngd --enable-ldpd --enable-bgpdd --enable-eigrpd --enable-gcc-rdynamic --enable-watchfrr  --enable-vtysh --enable-backtrace --enable-ospfapi --enable-ospfclient --enable-isisd --enable-snmp --enable-multipath=6 --enable-shell-access --disable-sysrepo --enable-fpm
    make
    make install
    
  • 安装FRR配置文件

    install -m 775 -o frr -g frr -d /var/log/frr
    install -m 775 -o frr -g frrvty -d /etc/frr
    sudo install -m 640 -o frr -g frr /dev/null /etc/frr/zebra.conf
    sudo install -m 640 -o frr -g frr /dev/null /etc/frr/bgpd.conf
    sudo install -m 640 -o frr -g frr /dev/null /etc/frr/ospfd.conf
    sudo install -m 640 -o frr -g frr /dev/null /etc/frr/ospf6d.conf
    sudo install -m 640 -o frr -g frr /dev/null /etc/frr/isisd.conf
    sudo install -m 640 -o frr -g frr /dev/null /etc/frr/ripd.conf
    sudo install -m 640 -o frr -g frr /dev/null /etc/frr/ripngd.conf
    sudo install -m 640 -o frr -g frr /dev/null /etc/frr/pimd.conf
    sudo install -m 640 -o frr -g frr /dev/null /etc/frr/ldpd.conf
    sudo install -m 640 -o frr -g frr /dev/null /etc/frr/nhrpd.conf
    sudo install -m 640 -o frr -g frrvty /dev/null /etc/frr/vtysh.conf
    sudo install -m 755 tools/frr /etc/init.d/frr
    install -m 640 -o frr -g frrvty tools/etc/frr/vtysh.conf /etc/frr/vtysh.conf
    install -m 640 -o frr -g frr tools/etc/frr/frr.conf /etc/frr/frr.conf
    install -m 640 -o frr -g frr tools/etc/frr/daemons.conf /etc/frr/daemons.conf
    install -m 640 -o frr -g frr tools/etc/frr/daemons /etc/frr/daemons
    
  • 调整sysctl

    1、vim /etc/sysctl.conf
    # Uncomment the next line to enable packet forwarding for IPv4
    net.ipv4.ip_forward=1
    
    # Uncomment the next line to enable packet forwarding for IPv6
    #  Enabling this option disables Stateless Address Autoconfiguration
    #  based on Router Advertisements for this host
    net.ipv6.conf.all.forwarding=1
    
    2、
    sysctl -p
    
  • 启用守护线程

    vim /etc/frr/daemons
    将要使用的功能都改完yes
    
  • 安装服务文件

    install -m 644 tools/frr.service /etc/systemd/system/frr.service
    systemctl enable frr
    systemctl start frr
    #查看服务状态
    service frr status 
    

Logo

权威|前沿|技术|干货|国内首个API全生命周期开发者社区

更多推荐