![bird2 BGP 如何从同一 ASN 但从另一个路由器宣布子网](https://linux22.com/image/772536/bird2%20BGP%20%E5%A6%82%E4%BD%95%E4%BB%8E%E5%90%8C%E4%B8%80%20ASN%20%E4%BD%86%E4%BB%8E%E5%8F%A6%E4%B8%80%E4%B8%AA%E8%B7%AF%E7%94%B1%E5%99%A8%E5%AE%A3%E5%B8%83%E5%AD%90%E7%BD%91.png)
我正在尝试了解有关 BGP / IPv6 的更多信息,这是我的目标:
目前,为了进行测试,我有一个来自提供商的虚拟机,它可以为我提供/44
网络
这是该虚拟机上的当前配置:
router id <IP of VM>;
define OWNASN = 1234;
protocol device {
scan time 10;
}
protocol direct {
ipv6;
interface "dummy*";
}
# templates
template bgp AS1234v6 {
local as OWNASN;
ipv6 {
import all;
export filter {
if net = 2a0e:87c0:620::/44 then accept;
reject;
};
};
graceful restart on;
}
protocol bgp VM1 from AS1234v6 {
neighbor <ipv6 of provider> as 1111;
source address <ipv6 of VM>;
}
protocol bgp VM2 from AS1234v6 {
description "test delegation";
neighbor <public IP ov VM2> as OWNASN;
source address <ipv6 of VM>;
}
如果在该虚拟机中我向主界面添加了一个别名,如下所示:
ip -6 addr add 2a0e:87c0:620::1/64 dev eth0
然后我可以从任何主机 ping 到该地址,到目前为止一切正常,但现在我想要有 3 个子网:
- 2a0e:87c0:620:1::/64
- 2a0e:87c0:620:2::/64
- 2a0e:87c0:620:3::/64
为了测试并使事情变得简单,我用另一台虚拟机替换了上图中的隧道和 pfSense。
在该 VM 中,我还安装了 bird2,并使用以下配置:
router id <public IP of VM>;
protocol device {
scan time 10;
}
protocol direct {
disabled;
}
protocol static my_routes {
ipv6;
route 2a0e:87c0:620:1::/64 reject;
}
filter export_my_routes {
if proto = "my_routes" then {
accept;
}
reject;
}
protocol bgp uplink0 {
local as 1234;
neighbor <public IP of VM1> as 1234;
source address <public IPv6>;
ipv6 {
import all;
export filter export_my_routes;
};
graceful restart on;
}
通过此我设法建立一个会话:
$ birdc s p
BIRD 2.0.8 ready.
Name Proto Table State Since Info
device1 Device --- up 19:13:19.082
direct1 Direct --- down 19:13:19.082
my_routes Static master6 up 19:13:19.082
uplink0 BGP --- up 19:13:22.095 Established
但是如果我在此新虚拟机上添加别名,则无法 ping 到它,并出现此错误:
From 2001:1900:5:4::189 icmp_seq=356 Time exceeded: Hop limit
在主虚拟机(来自提供商的虚拟机)上,我现在在日志中看到:
Invalid NEXT_HOP attribute
因此,需要一些帮助,了解如何将网络从内部路由器通告到外部路由器,以及如何配置每个设备中的子网以便进行路由?想知道使用什么网关?可能吗fe80::1%vtnet0
?