我创建了一个虚拟网络实验室来测试 BGP 路由。该实验室由两个用作最终用户的 Debian Docker 镜像和两个运行 Alpine Linux 和 Quagga 的镜像组成,用作路由器。该实验室具有以下架构:
容器具有以下网络配置(不包括环回):
PC1# ip addr && ip route 显示:
57: eth0@if58: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default
link/ether 02:42:ac:13:00:03 brd ff:ff:ff:ff:ff:ff link-netnsid 0
inet 172.19.0.3/16 brd 172.19.255.255 scope global eth0
valid_lft forever preferred_lft forever
default via 172.19.0.2 dev eth0
172.19.0.0/16 dev eth0 proto kernel scope link src 172.19.0.3
PC2# ip addr && ip route 显示:
62: eth0@if63: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default
link/ether 02:42:ac:14:00:03 brd ff:ff:ff:ff:ff:ff link-netnsid 0
inet 172.20.0.3/16 brd 172.20.255.255 scope global eth0
valid_lft forever preferred_lft forever
default via 172.20.0.2 dev eth0
172.20.0.0/16 dev eth0 proto kernel scope link src 172.20.0.3
R1# ip addr && ip route 显示:
17: eth0@if18: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default
link/ether 02:42:ac:12:00:02 brd ff:ff:ff:ff:ff:ff
inet 172.18.0.2/16 brd 172.18.255.255 scope global eth0
valid_lft forever preferred_lft forever
49: eth3@if50: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default
link/ether 02:42:ac:13:00:02 brd ff:ff:ff:ff:ff:ff
inet 172.19.0.2/16 brd 172.19.255.255 scope global eth3
valid_lft forever preferred_lft forever
default via 172.18.0.1 dev eth0
172.18.0.0/16 dev eth0 proto kernel scope link src 172.18.0.2
172.19.0.0/16 dev eth3 proto kernel scope link src 172.19.0.2
R2# ip addr && ip route 显示:
43: eth0@if44: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default
link/ether 02:42:ac:12:00:03 brd ff:ff:ff:ff:ff:ff
inet 172.18.0.3/16 brd 172.18.255.255 scope global eth0
valid_lft forever preferred_lft forever
60: eth1@if61: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default
link/ether 02:42:ac:14:00:02 brd ff:ff:ff:ff:ff:ff
inet 172.20.0.2/16 brd 172.20.255.255 scope global eth1
valid_lft forever preferred_lft forever
default via 172.18.0.1 dev eth0
172.18.0.0/16 dev eth0 proto kernel scope link src 172.18.0.3
172.20.0.0/16 dev eth1 proto kernel scope link src 172.20.0.2
R1# 显示运行配置:
Current configuration:
!
hostname R1
password xxx
!
router bgp 65530
bgp router-id 172.19.0.2
network 172.19.0.0/16
neighbor 172.18.0.3 remote-as 65531
!
line vty
!
end
R2# 显示运行配置:
Current configuration:
!
hostname R2
password xxx
!
router bgp 65531
bgp router-id 172.20.0.2
network 172.20.0.0/16
neighbor 172.18.0.2 remote-as 65530
!
line vty
!
R1> 显示 ip bgp:
BGP table version is 0, local router ID is 172.19.0.2
Status codes: s suppressed, d damped, h history, * valid, > best, = multipath,
i internal, r RIB-failure, S Stale, R Removed
Origin codes: i - IGP, e - EGP, ? - incomplete
Network Next Hop Metric LocPrf Weight Path
*> 172.19.0.0 0.0.0.0 0 32768 i
*> 172.20.0.0 172.18.0.3 0 0 65531 i
Total number of prefixes 2
R2> 显示 ip bgp:
BGP table version is 0, local router ID is 172.20.0.2
Status codes: s suppressed, d damped, h history, * valid, > best, = multipath,
i internal, r RIB-failure, S Stale, R Removed
Origin codes: i - IGP, e - EGP, ? - incomplete
Network Next Hop Metric LocPrf Weight Path
*> 172.19.0.0 172.18.0.2 0 0 65530 i
*> 172.20.0.0 0.0.0.0 0 32768 i
Total number of prefixes 2
问题是 PC1 与 R2 或 PC2 没有连接(无法 ping),反之亦然。注意:
- R1_container 可以 ping 172.18.0.3。
- PC1可以ping通172.18.0.2。
- PC1 无法 ping 172.18.0.3。
- PC1 无法 ping 172.20.0.3。
必须做出哪些改变?