FRRouting tutorial
本記事について
FRRoutingのインストール完了までの構築メモ、基本的には公式ドキュメントに沿って進める
公式ドキュメント(Ubuntu 18.04 LTS — FRR latest documentation)
通り実施しても意外とすんなりいかなかったので備忘録として残しておく
実際のCLI操作については対象外
構築環境
OS : 18.04.2 LTS (Bionic Beaver)
(http://releases.ubuntu.com/18.04/ : ubuntu-18.04.2-desktop-amd64.iso)
FRR : FRRouting 7.1 (2019/07/05 時点でstable)
事前準備
sudo apt update sudo apt install -y vim curl openssh-server systemctl enable ssh systemctl restart ssh
FRR Installation
libyang Install (FRR 7.0以上で必要)
sudo apt install -y gcc cmake libpcre3 libpcre3-dev git pkg-config doxygen flex bison graphviz devscripts debhelper rpm git clone https://github.com/CESNET/libyang.git cd libyang mkdir build; cd build cmake -DENABLE_LYD_PRIV=ON -DCMAKE_INSTALL_PREFIX:PATH=/usr -D CMAKE_BUILD_TYPE:String="Release" .. make sudo make install
FRR Dependencies
sudo 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
Protocol Buffer
sudo apt-get install protobuf-c-compiler libprotobuf-c-dev
ZeroMQ
sudo apt-get install libzmq5 libzmq3-dev
ADD FRR user and groups
sudo groupadd -r -g 92 frr sudo groupadd -r -g 85 frrvty sudo adduser --system --ingroup frr --home /var/run/frr/ \ --gecos "FRR suite" --shell /sbin/nologin frr sudo usermod -a -G frrvty frr
Compile
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 \ --enable-systemd=yes \ --with-pkg-git-version \ --with-pkg-extra-version=-MyOwnFRRVersion make sudo make install
Install FRR configuration files
sudo install -m 775 -o frr -g frr -d /var/log/frr sudo install -m 775 -o frr -g frrvty -d /etc/frr sudo install -m 640 -o frr -g frrvty tools/etc/frr/vtysh.conf /etc/frr/vtysh.conf sudo install -m 640 -o frr -g frr tools/etc/frr/frr.conf /etc/frr/frr.conf sudo install -m 640 -o frr -g frr tools/etc/frr/daemons.conf /etc/frr/daemons.conf sudo install -m 640 -o frr -g frr tools/etc/frr/daemons /etc/frr/daemons
Tweak sysctls
vim /etc/sysctl.conf --- uncomment # 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 --- reboot
Add MPLS kernel modules
vim /etc/modules-load.d/modules.conf --- 末尾に追加 # Load MPLS Kernel Modules mpls_router mpls_iptunnel sudo modprobe mpls-router mpls-iptunnel ---
Enable MPLS Forwarding
vim /etc/sysctl.conf --- 末尾に追加(interface名は環境に合わせて変更) # Enable MPLS Label processing on all interfaces net.mpls.conf.eth0.input=1 net.mpls.conf.eth1.input=1 net.mpls.conf.eth2.input=1 net.mpls.platform_labels=100000 ---
Install service files
cd frr sudo install -m 644 tools/frr.service /etc/systemd/system/frr.service sudo systemctl enable frr
Enable daemons
vim /etc/frr/daemons --- 必要箇所をyesに変更 bgpd=yes ospfd=yes ospf6d=yes ripd=yes ripngd=yes isisd=yes pimd=yes ldpd=yes nhrpd=yes eigrpd=yes babeld=yes sharpd=yes pbrd=yes bfdd=yes fabricd=yes vrrpd=yes ---
Start FRR
sudo systemctl start frr # vtysh Hello, this is FRRouting (version 7.2-dev-MyOwnFRRVersion-g82502cd). Copyright 1996-2005 Kunihiro Ishiguro, et al. This is a git build of frr-7.1-dev-542-gc682502cd Associated branch(es): local:master github/frrouting/frr.git/master frr#
↑の画面が出てくればFRRoutingの環境構築終わりだけどもう少しだけ続く
hostname変更 (Ubuntu 18.04 LTS — FRR latest documentation)
hostnameの変更はFRRのCLI上からではなくvtysh,confを直接変更する必要がある
vim /etc/frr/vtysh.conf --- hostname frr ---
configの保存先
defaultでは、/etc/frr/frr.conf に全ての設定を書き込むが
We recommend you do not mix the use of the two types of files. Further, it is better not to use the integrated frr.conf file, as any syntax error in it can lead to /all/ of your daemons being unable to start up. Per daemon files are more robust as impact of errors in configuration are limited to the daemon in whose file the error is made.
あまり好ましくないとのことなのでそれぞれのdaemonのconfファイルに書き込む設定にする
vim /etc/frr/vtysh.conf --- no service integrated-vtysh-config --- systemctl restart frr
これで write mem するとそれぞれのconfファイルに書き込まれる 次回は、FRRoutingで何かやる