BGP Player 的第一步,以 Debian11 和 Bird2 为例,Debian11 源里的 Bird2 有这么一丢丢的老。

拉代码,装打包用的软件包,编译安装,我这用 v2.13.1 了。

1
2
3
4
5
6
7
8
9
10
sudo su -
apt update
apt install -y build-essential autoconf git flex bison m4 libssh-dev libncurses-dev libreadline-dev
cd /root
git clone https://gitlab.nic.cz/labs/bird.git -b v2.13.1 bird-src
cd bird-src
autoreconf
./configure --prefix=/usr --sysconfdir=/etc/bird --runstatedir=/run/bird
make
make install

配置 Bird 专用的用户和组,别用 root 跑 Bird 吧?

1
2
echo "bird:x:108:114::/run/bird:/usr/sbin/nologin" >> /etc/passwd
echo "bird:x:114:" >> /etc/group

配置服务(Service)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
vim /usr/lib/systemd/system/bird.service

[Unit]
Description=BIRD Internet Routing Daemon
After=network.target

[Service]
ExecStartPre=/usr/sbin/bird -p
ExecReload=/usr/sbin/birdc configure
ExecStart=/usr/sbin/bird -c /etc/bird/bird.conf -f -u bird -g bird -s /usr/var/run/bird.ctl
Restart=on-abort

[Install]
WantedBy=multi-user.target

起飞

1
2
3
4
systemctl daemon-reload
systemctl restart bird
systemctl status bird.service
systemctl enable bird

鸟炸了怎么办?看看发生了什么。

1
2
systemctl status bird.service
journalctl -xe

PS:后面还是 Mikrotik 一把梭吧。