当用不同的方式为BGP注入路由时,起源代码将标识路由的来源。
(在BGP表中,Network为“i”,重分布是“?”)
实验拓扑如下:
R2上将来自IGP的路由10.3.3.3/32用network指令注入BGP;在R4上将来自IGP的路由10.3.3.3/32使用重分布的方式引入BGP。
完成实验拓扑的基础配置R1如下:
hostname R1
!
interface Loopback0
ip address 10.1.0.1 255.255.255.0
!
interface Loopback1
ip address 10.1.1.1 255.255.255.0
!
interface Ethernet0/0
ip address 10.12.1.1 255.255.255.0
no sh
!
router bgp 100
bgp router-id 1.1.1.1
network 10.1.0.0 mask 255.255.255.0
network 10.1.1.0 mask 255.255.255.0
aggregate-address 10.1.0.0 255.255.0.0 summary-only
neighbor 10.12.1.2 remote-as 234
!
end
R2的配置如下:
hostname R2
!
interface Loopback1
ip address 2.2.2.2 255.255.255.255
!
interface Ethernet0/0
ip address 10.12.1.2 255.255.255.0
no sh
!
interface Ethernet0/1
ip address 10.23.0.2 255.255.255.0
no sh
!
router eigrp 10
network 0.0.0.0
passive-interface default
no passive-interface Ethernet0/1
!
router bgp 234
bgp router-id 2.2.2.2
network 10.3.3.3 mask 255.255.255.255
neighbor IBGP peer-group
neighbor IBGP remote-as 234
neighbor IBGP update-source Loopback1
neighbor IBGP next-hop-self
neighbor 3.3.3.3 peer-group IBGP
neighbor 4.4.4.4 peer-group IBGP
neighbor 10.12.1.1 remote-as 100
!
end
R3的配置如下:
hostname R3
!
interface Loopback0
ip address 10.3.3.3 255.255.255.255
!
interface Loopback1
ip address 3.3.3.3 255.255.255.255
!
interface Ethernet0/0
ip address 10.23.0.3 255.255.255.0
no sh
!
interface Ethernet0/1
ip address 10.34.0.3 255.255.255.0
no sh
!
router eigrp 10
network 0.0.0.0
!
router bgp 234
bgp router-id 3.3.3.3
neighbor IBGP peer-group
neighbor IBGP remote-as 234
neighbor IBGP update-source Loopback1
neighbor 2.2.2.2 peer-group IBGP
neighbor 4.4.4.4 peer-group IBGP
!
end
R4的配置如下:
hostname R4
!
interface Loopback1
ip address 4.4.4.4 255.255.255.255
!
interface Ethernet0/0
ip address 10.45.2.4 255.255.255.0
no sh
!
interface Ethernet0/1
ip address 10.34.0.4 255.255.255.0
no sh
!
router eigrp 10
network 0.0.0.0
passive-interface Ethernet0/0
!
router bgp 234
bgp router-id 4.4.4.4
redistribute eigrp 10 route-map RED
neighbor IBGP peer-group
neighbor IBGP remote-as 234
neighbor IBGP update-source Loopback1
neighbor IBGP next-hop-self
neighbor 2.2.2.2 peer-group IBGP
neighbor 3.3.3.3 peer-group IBGP
neighbor 10.45.2.5 remote-as 500
!
ip prefix-list RED seq 5 permit 10.3.3.3/32
!
route-map RED permit 10
match ip address prefix-list RED
!
R5的配置如下:
hostname R5
!
interface Loopback2
ip address 10.1.2.5 255.255.255.0
!
interface Loopback3
ip address 10.1.3.5 255.255.255.0
!
interface Ethernet0/0
ip address 10.45.2.5 255.255.255.0
no sh
!
router bgp 500
bgp router-id 5.5.5.5
network 10.1.2.0 mask 255.255.255.0
network 10.1.3.0 mask 255.255.255.0
aggregate-address 10.1.0.0 255.255.0.0 summary-only
neighbor 10.45.2.4 remote-as 234
!
end
在R3上查看网络10.3.3.3/32的BGP表和路由详细信息如下:
其他路由器的BGP表和路由查看略。
当通过起源代码做BGP选路决策时,可以看到IGP的“i”是由于重分布的“?”的选路规则。
另外,在操作本AS的多宿主环境的BGP网络出站流量时,使用本地优先级控制更合适。(随后的实验将逐步演示。)