How To Send Internet Route By BIRD?

背景

BIRD是一个BGP守护进程,可以同真实的物理设备建立BGP邻居,并灵活控制路由的收发,尝尝可以看到IXP或云提供商(如Equinix)使用此开源软件。我将使用BIRD给Peer路由器发送Internet路由,以帮我完成演练,但看上去BIRD作为BGP Speaker或控制BGP路由比较好用,但生成路由并不是特别灵活,需要把路由批量灌到Kernel中,然后重分发到BGP并发给Peer路由器,此篇文章总结下如何使用BIRD。

相关链接

BIRD只是众多BGP开源软件中的一个,其他的还有如Quagga/FRR,ExaBGP等,我在查找BIRD时也看到了一些对比文章,一起列在下面,供以后方便查阅:

BIRD2 User Guide:

BIRD安装

[root@bird-162 ~]# yum install bird2*
[root@bird-162 ~]# yum install bird6*

定制Loopback?Dummy Port?直连接口?

这里有个问题,就是到底让BIRD使用哪种接口去跟远端的路由器建立BGP?不同接口有不同问题,经过踩坑后,发现最靠谱的还是直连接口,下面是一些已经踩的坑:

  • 为了让设置清晰明了,最开始想用loopback接口,如lo:2,在部署v4的BIRD时,没有任何问题;但当部署v6的BIRD6时,发现了一些问题:
    • v6的环回地址只能附属在主接口上,也就是lo,不能在lo:2上,这样导致v4用lo:2,v6用lo;
    • 在lo配置v6地址后,发现ping不通远端,导致bgp无法建立,确认路由都没问题,IPv6的数据转发也都打开了,就是ping不通,感觉对于loopback端口,v4和v6还是有一些不一样的地方;
  • 如果只是静态配置dummy port(ip link add internet type dummy)很容易,但这有个问题,我没法关联路由文件与这个dummy端口,看上去需要在“network-scripts”中匹配,如ifcfg-eth1,对应的v4,v6路由文件 是route-eth1,route6-eth1;另外此配置重启后,端口就消失了,如果想重启后仍然存在,还需要配置好几个地方才能开启dummy端口;

网络拓扑

Server 基础配置

如上图所示,为了方便,把v4,v6 全路由放进两个不同的路由实例中,然后在BIRD和BIRD6中分别调用相应的实例,这样做会比较清洗,路由也会比较干净,不会影响服务器的原有的路由配置,也省去了BIRD上的filter配置;

配置v4和v6的路由实例

[root@bird-162 ~]# more /etc/iproute2/rt_tables 
#
# reserved values
#
255     local
254     main
253     default
0       unspec
84      bird4
86      bird6
#
# local
#
#1      inr.ruhep

如果需要用VRF进行隔离,可以参考这篇文章,也可以参考下面的文档,为了方便,文本单独附在下面:

https://www.kernel.org/doc/Documentation/networking/vrf.txt

下面是一个Example,建立VRF,让VRF up,把管理端口放入VRF,并加上默认路由,重启仍生效:

[root@trex-161 ~]# echo "net.ipv4.udp_l3mdev_accept = 1" >> /etc/sysctl.conf
[root@trex-161 ~]# echo "net.ipv4.tcp_l3mdev_accept = 1" >> /etc/sysctl.conf
[root@trex-161 ~]# sysctl -p
net.ipv4.udp_l3mdev_accept = 1
net.ipv4.tcp_l3mdev_accept = 1
[root@trex-161 ~]# more /etc/rc.local 
......
touch /var/lock/subsys/local

# Refer to linux vrf, add follow cmd
# There is ip address for eth0 in "ifcfg-eth0" 

ip link add dev MGT_VRF type vrf table 2
ip link set dev MGT_VRF up
ip link set dev eth0 master MGT_VRF
ip route add 0.0.0.0/0 via 172.16.211.1 vrf MGT_VRF
[root@trex-161 ~]#
[root@trex-161 ~]# chmod +x /etc/rc.d/rc.local
[root@trex-161 ~]# source /etc/rc.local
[root@trex-161 ~]# reboot
Connection to 172.16.211.162 closed by remote host.
Connection to 172.16.211.162 closed.
[root@beihe-terminal-server ~]# ssh [email protected]
[email protected]'s password: 
Last login: Wed Nov  3 21:26:28 2021 from 172.16.211.155
[root@trex-161 ~]# ip -br link show type vrf 
MGT_VRF          UP             62:22:47:30:f9:e9 <NOARP,MASTER,UP,LOWER_UP> 
[root@trex-161 ~]# ip route show vrf MGT_VRF
default via 172.16.211.1 dev eth0 
172.16.211.0/24 dev eth0 proto kernel scope link src 172.16.211.162 
[root@trex-161 ~]# 
[root@trex-161 ~]# ping -I MGT_VRF 172.16.211.1
ping: Warning: source address might be selected on device other than MGT_VRF.
PING 172.16.211.1 (172.16.211.1) from 172.16.211.162 MGT_VRF: 56(84) bytes of data.
64 bytes from 172.16.211.1: icmp_seq=1 ttl=255 time=1.16 ms
64 bytes from 172.16.211.1: icmp_seq=2 ttl=255 time=1.06 ms
^C
--- 172.16.211.1 ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 1000ms
rtt min/avg/max/mdev = 1.066/1.114/1.163/0.058 ms
[root@trex-161 ~]# ip vrf exec MGT_VRF ssh 172.16.211.143
The authenticity of host '172.16.211.143 (172.16.211.143)' can't be established.
RSA key fingerprint is SHA256:HGQUCSMyNonFC/C2TstIV9gfzq0WBzZZ3wYnKk8lqWQ.
RSA key fingerprint is MD5:c0:d9:36:bd:46:a6:2b:10:7d:03:2f:38:5c:cc:97:a1.
Are you sure you want to continue connecting (yes/no)?

如果需要无缝恢复,直接把下面命令存入文本,然后source即可:

[root@trex-161 ~]# more recovery-vrf
ip link set dev eth0 nomaster
ip route add 0.0.0.0/0 via 172.16.211.1
[root@trex-161 ~]# source recovery-vrf
[root@trex-161 ~]# packet_write_wait: Connection to 172.16.211.162 port 22: Broken pipe
[root@beihe-terminal-server ~]# 

—”

配置eth1端口

[root@bird-162 ~]# more /etc/sysconfig/network-scripts/ifcfg-eth1
TYPE=Ethernet
PROXY_METHOD=none
BROWSER_ONLY=no
BOOTPROTO=none
IPV4_FAILURE_FATAL=no
IPV6INIT=yes
IPV6_AUTOCONF=no
NETWORKING_IPV6=yes
IPV6_DEFROUTE=no
IPV6_FAILURE_FATAL=no
IPV6_ADDR_GEN_MODE=stable-privacy
NAME=eth1
DEVICE=eth1
ONBOOT=yes
IPADDR0=30.1.1.1
PREFIX0=24
IPV6ADDR=2001::30:1:1:1/120
NM_CONTROLLED=no

所有端口默认都是由NetworkManager进行管理,如果设备重启,NM会监控端口启动以及路由加载,根据测试结果会导致NM持续100%而无法降到正常范围,导致有些程序就无法打开了,如Trex GUI,因此建议用”NM_CONTROLLED=no“把此端口移除NM的控制范围,平时可以用这个命令来控制端口的up/down,不过需要注意的是,路由文件的加载仍然需要通过“systemctl restart network”来控制

ifdown eth1
ifup eth1

关于端口up/down,这里有篇文章可以参考:6 different commands to restart network in RHEL/CentOS 7/8

配置v4和v6路由文件

[root@bird-162 ~]# ls -l /etc/sysconfig/network-scripts/ |grep eth1
-rw-r--r--  1 root root   297 Oct  8 19:49 ifcfg-eth1
-rw-r--r--  1 root root   161 Oct  8 22:13 route6-eth1
-rw-r--r--  1 root root   174 Oct  8 22:14 route-eth1
[root@bird-162 ~]# more /etc/sysconfig/network-scripts/route6-eth1 
2001:1::/64 dev eth1 table 86
600:6001:110b::/48 dev eth1 table 86
2001::/32 dev eth1 table 86
2001:4:112::/48 dev eth1 table 86
2001:200::/32 dev eth1 table 86
[root@bird-162 ~]# more /etc/sysconfig/network-scripts/route-eth1 
1.0.0.0/24 dev eth1 table 84
1.0.4.0/22 dev eth1 table 84
1.0.4.0/24 dev eth1 table 84
1.0.5.0/24 dev eth1 table 84
1.0.6.0/24 dev eth1 table 84
1.0.7.0/24 dev eth1 table 84
[root@bird-162 ~]# systemctl restart network   # 重启生效
[root@bird-162 ~]# ip route show table 84
1.0.0.0/24 dev eth1 proto static scope link metric 101 
1.0.4.0/24 dev eth1 proto static scope link metric 101 
1.0.4.0/22 dev eth1 proto static scope link metric 101 
1.0.5.0/24 dev eth1 proto static scope link metric 101 
1.0.6.0/24 dev eth1 proto static scope link metric 101 
1.0.7.0/24 dev eth1 proto static scope link metric 101 
[root@bird-162 ~]# 
[root@bird-162 ~]# ip -6 route show table 86
600:6001:110b::/48 dev eth1 proto static metric 101 pref medium
2001::/32 dev eth1 proto static metric 101 pref medium
2001:1::/64 dev eth1 proto static metric 101 pref medium
2001:4:112::/48 dev eth1 proto static metric 101 pref medium
2001:200::/32 dev eth1 proto static metric 101 pref medium
[root@bird-162 ~]# 

配置静态到远端路由器

因为在非默认路由表中的路由想测试,需要临时放通,如:How to do a ping test through a non default routing table?为了避免麻烦,建议去往远端路由器的静态路由在Global中配置,而不在BIRD中配置,另外注意,每次用“systemctl restart network”后,路由会消失,需要再次加回去:

[root@bird-162 ~]# ip route add 12.3.1.0/24 via 30.1.1.2
[root@bird-162 ~]# ip -6 route add 2001::12:3:1:0/120 via 2001::30:1:1:2
[root@bird-162 ~]#
[root@bird-162 ~]#
[root@bird-162 ~]# ping 12.3.1.1
PING 12.3.1.1 (12.3.1.1) 56(84) bytes of data.
64 bytes from 12.3.1.1: icmp_seq=1 ttl=62 time=8.46 ms
64 bytes from 12.3.1.1: icmp_seq=2 ttl=62 time=5.83 ms
^C
--- 12.3.1.1 ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 1000ms
rtt min/avg/max/mdev = 5.831/7.148/8.466/1.320 ms
[root@bird-162 ~]# 
[root@bird-162 ~]# ping -6 2001::12:3:1:1
PING 2001::12:3:1:1(2001::12:3:1:1) 56 data bytes
64 bytes from 2001::12:3:1:1: icmp_seq=1 ttl=62 time=8.96 ms
64 bytes from 2001::12:3:1:1: icmp_seq=2 ttl=62 time=11.3 ms
^C
--- 2001::12:3:1:1 ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 1000ms
rtt min/avg/max/mdev = 8.967/10.135/11.303/1.168 ms

配置 bird.conf

[root@bird-162 ~]# more /etc/bird.conf
log syslog all;

router id 30.1.1.1;

filter rt_import
{
	accept;
}

filter rt_export
{
#	if source = RTS_STATIC then reject;   # if you config static in bird, filter when bgp export, not use now
	accept;
}

protocol device {
	scan time 10;                 # Scan interfaces every 10 seconds
}

# Disable automatically generating direct routes to all network interfaces, not use now
protocol direct direct1 {
	ipv4;
#	interface "eth1";
}

# Forbid synchronizing BIRD routing tables with the OS kernel.
protocol kernel {
	learn;                        # Learn kernel route
#	persist;                      # Don't remove routes on bird shutdown
	ipv4 {
		import all;
		export none;
	};
	kernel table 84;              # Only import table 84 route 
}

# Static IPv4 routes, not use now
protocol static {
#	ipv4;
#	route 100.25.0.15/32 via 30.1.1.2;
}

# BGP peers
protocol bgp uplink0 {
	description "BGP uplink juniper vmx";
	local 30.1.1.1 as 400;
	neighbor 12.3.1.1 as 50000;
	hold time 90;
	multihop 5;

	ipv4 {
		import filter rt_import;
		export filter rt_export;
#		next hop address 20.1.1.1;   # Working under IPv4
    };
}

配置 bird6.conf

[root@bird-162 ~]# more /etc/bird6.conf
log syslog all;

router id 30.1.1.1;

filter rt_import
{
	accept;
}

filter rt_export
{
#	if source = RTS_STATIC then reject;       # if you config static in bird, filter when bgp export, not use now
	if ( net = 2001::30:1:1:0/120 ) then reject;
	accept;
}

protocol device {
	scan time 10;           # Scan interfaces every 10 seconds
}

# Disable automatically generating direct routes to all network interfaces, not use now
protocol direct direct1 {
#	interface "eth1";               # Disable by default
}

# Forbid synchronizing BIRD routing tables with the OS kernel.
protocol kernel {
	learn;                        # Learn kernel route
#	persist;                      # Don't remove routes on bird shutdown
	import all;
	export none;                  # Export static to kernel, no static, so none
	kernel table 86;              # Only import table 86 route 
}

# Static IPv6 routes, not use now
protocol static {
#	route 2001::12:3:1:0/120 via 2001::30:1:1:2;
}

# BGP peers
protocol bgp uplink0 {
	description "BGP uplink juniper vmxv6";
	local 2001::30:1:1:1 as 400;
	neighbor 2001::12:3:1:1 as 50000;
	hold time 90;
	multihop 5;

	import none;
	export filter rt_export;
#	next hop address 2001::20:1:1:1; # Not working under IPv6... why?
}

启动BIRD和BIRD6

[root@bird-162 ~]# systemctl start bird
[root@bird-162 ~]# systemctl start bird6
[root@bird-162 ~]# systemctl status bird
● bird.service - BIRD Internet Routing Daemon
   Loaded: loaded (/usr/lib/systemd/system/bird.service; disabled; vendor preset: disabled)
   Active: active (running) since Sat 2021-10-09 01:23:26 CST; 1min 0s ago
 Main PID: 8264 (bird)
    Tasks: 1
   CGroup: /system.slice/bird.service
           └─8264 /usr/sbin/bird -f -u bird -g bird

Oct 09 01:23:26 bird-162 systemd[1]: Started BIRD Internet Routing Daemon.
Oct 09 01:23:26 bird-162 bird[8264]: Started
Oct 09 01:23:28 bird-162 bird[8264]: Next hop address 12.3.1.1 resolvable through recursive route for 12.3.1.0/24
[root@bird-162 ~]# 
[root@bird-162 ~]# 
[root@bird-162 ~]# systemctl status bird6
● bird6.service - BIRD Internet Routing Daemon
   Loaded: loaded (/usr/lib/systemd/system/bird6.service; disabled; vendor preset: disabled)
   Active: active (running) since Sat 2021-10-09 01:18:44 CST; 5min ago
 Main PID: 8001 (bird6)
    Tasks: 1
   CGroup: /system.slice/bird6.service
           └─8001 /usr/sbin/bird6 -f -u bird6 -g bird6

Oct 09 01:18:44 bird-162 systemd[1]: Started BIRD Internet Routing Daemon.
Oct 09 01:18:44 bird-162 bird6[8001]: Started

如果启动失败了,那么可以查看log,所有log默认在“/var/log/messages”中,一般都是语法错误,如下面的例子:

[root@bird-162 network-scripts]# systemctl status bird
● bird.service - BIRD Internet Routing Daemon
   Loaded: loaded (/usr/lib/systemd/system/bird.service; disabled; vendor preset: disabled)
   Active: failed (Result: start-limit) since Tue 2021-09-28 23:11:29 CST; 3s ago
  Process: 15881 ExecStart=/usr/sbin/bird -f -u bird -g bird (code=exited, status=1/FAILURE)
 Main PID: 15881 (code=exited, status=1/FAILURE)

Sep 28 23:11:29 bird-162 systemd[1]: Unit bird.service entered failed state.
Sep 28 23:11:29 bird-162 systemd[1]: bird.service failed.
Sep 28 23:11:29 bird-162 systemd[1]: bird.service holdoff time over, scheduling restart.
Sep 28 23:11:29 bird-162 systemd[1]: Stopped BIRD Internet Routing Daemon.
Sep 28 23:11:29 bird-162 systemd[1]: start request repeated too quickly for bird.service
Sep 28 23:11:29 bird-162 systemd[1]: Failed to start BIRD Internet Routing Daemon.
Sep 28 23:11:29 bird-162 systemd[1]: Unit bird.service entered failed state.
Sep 28 23:11:29 bird-162 systemd[1]: bird.service failed.

[root@bird-162 network-scripts]# more /var/log/messages

Sep 28 23:11:23 bird-162 avahi-daemon[726]: Server startup complete. Host name is bird-869.local. Local service cookie is 140
6863944.
Sep 28 23:11:23 bird-162 avahi-daemon[726]: Withdrawing workstation service for virbr0-nic.
Sep 28 23:11:23 bird-162 avahi-daemon[726]: Withdrawing address record for 192.168.122.1 on virbr0.
Sep 28 23:11:23 bird-162 avahi-daemon[726]: Withdrawing workstation service for virbr0.
Sep 28 23:11:23 bird-162 avahi-daemon[726]: Withdrawing workstation service for eth2.
Sep 28 23:11:23 bird-162 avahi-daemon[726]: Withdrawing address record for 30.1.1.1 on eth1.
Sep 28 23:11:23 bird-162 avahi-daemon[726]: Withdrawing workstation service for eth1.
Sep 28 23:11:23 bird-162 avahi-daemon[726]: Withdrawing address record for 172.16.211.162 on eth0.
Sep 28 23:11:23 bird-162 avahi-daemon[726]: Withdrawing workstation service for eth0.
Sep 28 23:11:23 bird-162 avahi-daemon[726]: Withdrawing workstation service for lo.
Sep 28 23:11:23 bird-162 avahi-daemon[726]: Host name conflict, retrying with bird-870
Sep 28 23:11:23 bird-162 avahi-daemon[726]: Registering new address record for 192.168.122.1 on virbr0.IPv4.
Sep 28 23:11:23 bird-162 avahi-daemon[726]: Registering new address record for 30.1.1.1 on eth1.IPv4.
Sep 28 23:11:23 bird-162 avahi-daemon[726]: Registering new address record for fe80::81ff:c9aa:c0db:1a on eth0.*.
Sep 28 23:11:23 bird-162 avahi-daemon[726]: Registering new address record for 172.16.211.162 on eth0.IPv4.
Sep 28 23:11:23 bird-162 avahi-daemon[726]: Registering HINFO record with values 'X86_64'/'LINUX'.
Sep 28 23:11:28 bird-162 systemd: Started BIRD Internet Routing Daemon.
Sep 28 23:11:28 bird-162 bird: /etc/bird.conf:18:2 syntax error, unexpected IMPORT
Sep 28 23:11:28 bird-162 bird: bird: /etc/bird.conf:18:2 syntax error, unexpected IMPORT
Sep 28 23:11:28 bird-162 systemd: bird.service: main process exited, code=exited, status=1/FAILURE
Sep 28 23:11:28 bird-162 systemd: Unit bird.service entered failed state.
Sep 28 23:11:28 bird-162 systemd: bird.service failed.
Sep 28 23:11:28 bird-162 systemd: bird.service holdoff time over, scheduling restart.
Sep 28 23:11:28 bird-162 systemd: Stopped BIRD Internet Routing Daemon.
Sep 28 23:11:28 bird-162 systemd: Started BIRD Internet Routing Daemon.
Sep 28 23:11:28 bird-162 bird: /etc/bird.conf:18:2 syntax error, unexpected IMPORT
Sep 28 23:11:28 bird-162 bird: bird: /etc/bird.conf:18:2 syntax error, unexpected IMPORT
Sep 28 23:11:28 bird-162 systemd: bird.service: main process exited, code=exited, status=1/FAILURE
Sep 28 23:11:28 bird-162 systemd: Unit bird.service entered failed state.
Sep 28 23:11:28 bird-162 systemd: bird.service failed.

Peer路由器配置

由于在BIRD6中用“next hop address”不生效,所以v4/v6的下一跳均在收路由方向更改;另外华为的vNE40E以及思科的XRv9k跟BIRD建立连接后收路由很慢,还经常flapping,由于时间有限,所以就只验证了Juniper的;

root@Peer# run show configuration | display set 
set version 20.4R1.12
set system host-name Peer
set system root-authentication encrypted-password "$6$SisLeo75$N0lE.jJ9BDReihlcu4I4HKNJvth59BbXMpgDMfnnEcigvgrwAR.7qMJEdJcyJ/s5nTkYHfhgzpDZhf2PDq..N0"
set system syslog file messages any notice
set system syslog file messages authorization info
set system syslog file interactive-commands interactive-commands any
set system processes dhcp-service traceoptions file dhcp_logfile
set system processes dhcp-service traceoptions file size 10m
set system processes dhcp-service traceoptions level all
set system processes dhcp-service traceoptions flag packet
set interfaces ge-0/0/0 description "link to ISP2"
set interfaces ge-0/0/0 unit 0 family inet address 12.3.1.1/24
set interfaces ge-0/0/0 unit 0 family inet6 address 2001::12:3:1:1/120
set interfaces fxp0 unit 0 family inet dhcp vendor-id Juniper:vmx:VM615ED0997B
set interfaces fxp0 unit 0 family inet6 dhcpv6-client client-type stateful
set interfaces fxp0 unit 0 family inet6 dhcpv6-client client-ia-type ia-na
set interfaces fxp0 unit 0 family inet6 dhcpv6-client client-identifier duid-type duid-ll
set interfaces fxp0 unit 0 family inet6 dhcpv6-client vendor-id Juniper:vmx:VM615ED0997B
set interfaces lo0 unit 0 family inet address 100.25.0.15/32 primary
set interfaces lo0 unit 0 family inet address 100.25.0.15/32 preferred
set policy-options policy-statement INv4 then next-hop 20.1.1.1
set policy-options policy-statement INv6 then next-hop 2001::20:1:1:1
set policy-options policy-statement PASS then accept
set routing-options rib inet6.0 static route 2001::30:1:1:0/120 next-hop 2001::12:3:1:2
set routing-options rib inet6.0 static route 2001::20:1:1:0/120 next-hop 2001::12:3:1:2
set routing-options static route 30.1.1.1/32 next-hop 12.3.1.2
set routing-options static route 20.1.1.1/32 next-hop 12.3.1.2
set routing-options router-id 100.25.0.15
set routing-options autonomous-system 50000
set routing-options autonomous-system asdot-notation
set protocols router-advertisement interface fxp0.0
set protocols bgp group TO-BIRD6 type external
set protocols bgp group TO-BIRD6 multihop ttl 10
set protocols bgp group TO-BIRD6 neighbor 2001::30:1:1:1 description BIRD6
set protocols bgp group TO-BIRD6 neighbor 2001::30:1:1:1 local-address 2001::12:3:1:1
set protocols bgp group TO-BIRD6 neighbor 2001::30:1:1:1 import INv6
set protocols bgp group TO-BIRD6 neighbor 2001::30:1:1:1 export PASS
set protocols bgp group TO-BIRD6 neighbor 2001::30:1:1:1 peer-as 400
set protocols bgp group TO-BIRD type external
set protocols bgp group TO-BIRD multihop ttl 10
set protocols bgp group TO-BIRD neighbor 30.1.1.1 description BIRD
set protocols bgp group TO-BIRD neighbor 30.1.1.1 local-address 12.3.1.1
set protocols bgp group TO-BIRD neighbor 30.1.1.1 import INv4
set protocols bgp group TO-BIRD neighbor 30.1.1.1 export PASS
set protocols bgp group TO-BIRD neighbor 30.1.1.1 peer-as 400

[edit]
root@Peer# run show bgp summary                    
Threading mode: BGP I/O
Default eBGP mode: advertise - accept, receive - accept
Groups: 2 Peers: 2 Down peers: 0
Table          Tot Paths  Act Paths Suppressed    History Damp State    Pending
inet.0               
                       6          6          0          0          0          0
inet6.0              
                       5          5          0          0          0          0
Peer                     AS      InPkt     OutPkt    OutQ   Flaps Last Up/Dwn State|#Active/Received/Accepted/Damped...
30.1.1.1                400         26         23       0       3        9:36 Establ
  inet.0: 6/6/6/0
2001::30:1:1:1          400         24         24       0      11        9:38 Establ
  inet6.0: 5/5/5/0

[edit]
root@Peer# run show route protocol bgp 1.0.0.0/24 detail |grep protocol 
                Protocol next hop: 20.1.1.1

[edit]
root@Peer# run show route protocol bgp 600:6001:110b::/48 detail |grep proto   
                Protocol next hop: 2001::20:1:1:1

验证BIRD以及BIRD6

[root@bird-162 ~]# birdc
BIRD 2.0.8 ready.
bird> show route
Table master4:
1.0.4.0/24           unicast [kernel1 01:23:26.739] * (10)
        dev eth1
1.0.4.0/22           unicast [kernel1 01:23:26.739] * (10)
        dev eth1
1.0.0.0/24           unicast [kernel1 01:23:26.739] * (10)
        dev eth1
12.3.1.0/24          unreachable [uplink0 01:35:37.826 from 12.3.1.1] * (100) [AS50000i]
30.1.1.1/32          unreachable [uplink0 01:35:37.826 from 12.3.1.1] * (100) [AS50000i]
100.25.0.15/32       unreachable [uplink0 01:35:37.826 from 12.3.1.1] * (100) [AS50000i]
1.0.5.0/24           unicast [kernel1 01:23:26.739] * (10)
        dev eth1
1.0.6.0/24           unicast [kernel1 01:23:26.739] * (10)
        dev eth1
1.0.7.0/24           unicast [kernel1 01:23:26.739] * (10)
        dev eth1
20.1.1.1/32          unreachable [uplink0 01:35:37.826 from 12.3.1.1] * (100) [AS50000i]
bird> 
bird> show protocols all 
Name       Proto      Table      State  Since         Info
device1    Device     ---        up     01:23:26.738  

direct1    Direct     ---        up     01:23:26.738  

kernel1    Kernel     master4    up     01:23:26.738  
  Channel ipv4
    State:          UP
    Table:          master4
    Preference:     10
    Input filter:   ACCEPT
    Output filter:  REJECT
    Routes:         6 imported, 0 exported, 6 preferred
    Route change stats:     received   rejected   filtered    ignored   accepted
      Import updates:              6          0          0          0          6
      Import withdraws:            0          0        ---          0          0
      Export updates:             14          6          8        ---          0
      Export withdraws:            4        ---        ---        ---          0

static1    Static     master4    up     01:23:26.738  
  Channel ipv4
    State:          UP
    Table:          master4
    Preference:     200
    Input filter:   ACCEPT
    Output filter:  REJECT
    Routes:         0 imported, 0 exported, 0 preferred
    Route change stats:     received   rejected   filtered    ignored   accepted
      Import updates:              0          0          0          0          0
      Import withdraws:            0          0        ---          0          0
      Export updates:              0          0          0        ---          0
      Export withdraws:            0        ---        ---        ---          0

uplink0    BGP        ---        up     01:35:37.826  Established   
  Description:    BGP uplink juniper vmx
  BGP state:          Established
    Neighbor address: 12.3.1.1
    Neighbor AS:      50000
    Local AS:         400
    Neighbor ID:      100.25.0.15
    Local capabilities
      Multiprotocol
        AF announced: ipv4
      Route refresh
      Graceful restart
      4-octet AS numbers
      Enhanced refresh
      Long-lived graceful restart
    Neighbor capabilities
      Multiprotocol
        AF announced: ipv4
      Route refresh
      Graceful restart
      4-octet AS numbers
      Long-lived graceful restart
    Session:          external multihop AS4
    Source address:   30.1.1.1
    Hold timer:       58.642/90
    Keepalive timer:  15.953/30
  Channel ipv4
    State:          UP
    Table:          master4
    Preference:     100
    Input filter:   rt_import
    Output filter:  rt_export
    Routes:         4 imported, 6 exported, 4 preferred
    Route change stats:     received   rejected   filtered    ignored   accepted
      Import updates:              4          0          0          0          4
      Import withdraws:            0          0        ---          0          0
      Export updates:             14          8          0        ---          6
      Export withdraws:            0        ---        ---        ---          0
    BGP Next hop:   30.1.1.1
    IGP IPv4 table: master4
[root@bird-162 ~]# birdc6
BIRD 1.6.8 ready.
bird> show route
2001::30:1:1:0/120 dev eth1 [direct1 01:18:44] * (240)
2001:1::/64        dev eth1 [kernel1 01:18:44] * (10)
2001::/32          dev eth1 [kernel1 01:18:44] * (10)
2001:200::/32      dev eth1 [kernel1 01:18:44] * (10)
2001:4:112::/48    dev eth1 [kernel1 01:18:44] * (10)
600:6001:110b::/48 dev eth1 [kernel1 01:18:44] * (10)
bird> 
bird> show protocols all
name     proto    table    state  since       info
device1  Device   master   up     01:18:44    
  Preference:     240
  Input filter:   ACCEPT
  Output filter:  REJECT
  Routes:         0 imported, 0 exported, 0 preferred
  Route change stats:     received   rejected   filtered    ignored   accepted
    Import updates:              0          0          0          0          0
    Import withdraws:            0          0        ---          0          0
    Export updates:              0          0          0        ---          0
    Export withdraws:            0        ---        ---        ---          0

direct1  Direct   master   up     01:18:44    
  Preference:     240
  Input filter:   ACCEPT
  Output filter:  REJECT
  Routes:         1 imported, 0 exported, 1 preferred
  Route change stats:     received   rejected   filtered    ignored   accepted
    Import updates:              1          0          0          0          1
    Import withdraws:            0          0        ---          0          0
    Export updates:              0          0          0        ---          0
    Export withdraws:            0        ---        ---        ---          0

kernel1  Kernel   master   up     01:18:44    
  Preference:     10
  Input filter:   ACCEPT
  Output filter:  REJECT
  Routes:         5 imported, 0 exported, 5 preferred
  Route change stats:     received   rejected   filtered    ignored   accepted
    Import updates:              5          0          0          0          5
    Import withdraws:            0          0        ---          0          0
    Export updates:              7          7          0        ---          0
    Export withdraws:            0        ---        ---        ---          0

static1  Static   master   up     01:18:44    
  Preference:     200
  Input filter:   ACCEPT
  Output filter:  REJECT
  Routes:         0 imported, 0 exported, 0 preferred
  Route change stats:     received   rejected   filtered    ignored   accepted
    Import updates:              0          0          0          0          0
    Import withdraws:            0          0        ---          0          0
    Export updates:              0          0          0        ---          0
    Export withdraws:            0        ---        ---        ---          0

uplink0  BGP      master   up     01:35:35    Established   
  Description:    BGP uplink juniper vmxv6
  Preference:     100
  Input filter:   REJECT
  Output filter:  rt_export
  Routes:         0 imported, 5 exported, 0 preferred
  Route change stats:     received   rejected   filtered    ignored   accepted
    Import updates:              3          0          3          0          0
    Import withdraws:            0          0        ---          3          0
    Export updates:              6          0          1        ---          5
    Export withdraws:            0        ---        ---        ---          0
  BGP state:          Established
    Neighbor address: 2001::12:3:1:1
    Neighbor AS:      50000
    Neighbor ID:      100.25.0.15
    Neighbor caps:    refresh restart-aware llgr-aware AS4
    Session:          external multihop AS4
    Source address:   2001::30:1:1:1
    Hold timer:       86/90
    Keepalive timer:  14/30

添加Internet v4/v6路由

把v4和v6的全量路由写入到“route-eth1”和“route6-eth1”中,重启network,路由缓慢写入kernel,此时进程“NetworkManager”的CPU利用率会持续100%,系统会先加载v4再加载v6,可以通过下面命令查看,另外如果需要直接使用这两个修改好的文件,可以从这里下载:

[root@bird-162 ~]# ip route show table 84 |wc -l
896881
[root@bird-162 ~]# ip -6 route show table 86 |wc -l
140080

如果需要最新的internet 路由,可以看我之前的blog:How to Import Global Route in IXIA

在路由器上也可以验证收到了这些路由:

root@Peer> show bgp summary    
Threading mode: BGP I/O
Default eBGP mode: advertise - accept, receive - accept
Groups: 2 Peers: 2 Down peers: 0
Table          Tot Paths  Act Paths Suppressed    History Damp State    Pending
inet.0               
                  896881     896881          0          0          0          0
inet6.0              
                  140080     140080          0          0          0          0
Peer                     AS      InPkt     OutPkt    OutQ   Flaps Last Up/Dwn State|#Active/Received/Accepted/Damped...
30.1.1.1                400        971          5       0       4        1:33 Establ
  inet.0: 896881/896881/896881/0
2001::30:1:1:1          400        256          5       0      12        1:03 Establ
  inet6.0: 140080/140080/140080/0

root@Peer> 
本文出自 Frank's Blog

版权声明:


本文链接:How To Send Internet Route By BIRD?
版权声明:本文为原创文章,仅代表个人观点,版权归 Frank Zhao 所有,转载时请注明本文出处及文章链接
你可以留言,或者trackback 从你的网站

One Response to “How To Send Internet Route By BIRD?”

  1. 哈哈哈哈说道:

    太棒了

留言哦

blonde teen swallows load.xxx videos