欢迎您访问365答案网,请分享给你的朋友!
生活常识 学习资料

在Ubuntu中安装FRR构建虚拟路由器

时间:2023-06-28

安装依赖关系

apt-get updateapt-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.debdpkg -i libyang2_2.0.0-0_amd64.debapt-cache policy libpcre32-3apt-cache policy libpcrecpp0v5apt-get install libpcre16-3=2:8.38-3.1 libpcre32-3=2:8.38-3.1 libpcrecpp0v5=2:8.38-3.1 libpcre3-devdpkg -i libyang-dev_2.0.0-0_amd64.debapt-get install libpcre2-devapt-get -f installapt-get install protobuf-c-compiler libprotobuf-c-devapt-get install libzmq5 libzmq3-dev

添加FRR用户和组

groupadd -r -g 92 frrgroupadd -r -g 85 frrvtyadduser --system --ingroup frr --home /var/run/frr/ --gecos "FRR suite" --shell /sbin/nologin frrusermod -a -G frrvty frr

编译阶段

git clone https://github.com/frrouting/frr.git frrcd 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-datacenter --enable-vtysh --enable-backtrace --enable-ospfapi --enable-ospfclient --enable-isisd --enable-snmp --enable-multipath=6 --enable-shell-access --disable-sysrepo --enable-fpmmakemake install

在make之前可能出现错误:libelf headers are required for building clippy

解决办法:apt-get install libelf-dev

安装FRR配置文件

install -m 775 -o frr -g frr -d /var/log/frrinstall -m 775 -o frr -g frrvty -d /etc/frrinstall -m 640 -o frr -g frrvty tools/etc/frr/vtysh.conf /etc/frr/vtysh.confinstall -m 640 -o frr -g frr tools/etc/frr/frr.conf /etc/frr/frr.confinstall -m 640 -o frr -g frr tools/etc/frr/daemons.conf /etc/frr/daemons.confinstall -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 IPv4net.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 hostnet.ipv6.conf.all.forwarding=12、sysctl -p

启用守护线程

vim /etc/frr/daemons将要使用的功能都改完yes

安装服务文件

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


Copyright © 2016-2020 www.365daan.com All Rights Reserved. 365答案网 版权所有 备案号:

部分内容来自互联网,版权归原作者所有,如有冒犯请联系我们,我们将在三个工作时内妥善处理。