实验要求:
实验总结:
建邻:
R1和R2之间是普通的EBGP建邻
注:R1和R2用彼此的物理接口地址来建邻、
R2和R3、R3和R4、R2和R4分别之间都是IBGP用环回建邻
注:要修改更新源地址为环回,且要记住IBGP之间的数据包的TTL值默认是255!
R4和R5之间用的是EBGP环回建邻
注:要修改更新源地址,且记住EBGP之间的数据包的TTL值默认是1!这里需要修改为2,不然不可达,无法建邻
宣告路由:
问题:
一、为什么要R2与R3建邻,R4和R3建邻,R2和R4建邻这样建邻?
答:考虑IBGP的水平分割;R1的环回的路由会传到R3,不能从R3传到R4,只能从R2传到R4。同样R5的环回的路由,传到R2需要通过R4,传到R2不会通过R3,传到R3需要通过R4。
r2(config-router)#neighbor 4.4.4.4 next-hop-self
将路由传递给邻居4.4.4.4时修改下一跳地址为本地
答:路由信息由目标网络号和属性构成,在AS中传递路由信息时,属性不会变,故下一跳地址也不会变!!那么我们需要下一个路由知道他的正确的下一跳地址才能正确的路由!!因为是本地传给它的路由!!所以我们需要改下一跳地址为本地!!
答:因为BGP协议是AS-BY-AS,它是以一个AS为一跳,所以,在一个AS中传递时属性不变!!
Show run
R1
hostname R1
!
interface Loopback0
ip address 1.1.1.1 255.255.255.0
!
interface Serial0/0
ip address 17.1.1.1 255.255.255.0
clock rate 2000000
!
router bgp 1
no synchronization
bgp log-neighbor-changes
network 1.1.1.0 mask 255.255.255.0
neighbor 17.1.1.2 remote-as 2
no auto-summary
!
R2
hostname R2
!
interface Loopback0
ip address 2.2.2.2 255.255.255.0
!
interface Serial0/0
ip address 17.1.1.2 255.255.255.0
clock rate 2000000
!
interface Serial0/1
ip address 27.1.1.1 255.255.255.0
clock rate 2000000
!
router ospf 1
log-adjacency-changes
network 2.2.2.2 0.0.0.0 area 0
network 27.1.1.0 0.0.0.255 area 0
!
router bgp 2
no synchronization
bgp log-neighbor-changes
network 2.2.2.0 mask 255.255.255.0
neighbor 3.3.3.3 remote-as 2
neighbor 3.3.3.3 update-source Loopback0
neighbor 3.3.3.3 next-hop-self
neighbor 4.4.4.4 remote-as 2
neighbor 4.4.4.4 update-source Loopback0
neighbor 4.4.4.4 next-hop-self
neighbor 17.1.1.1 remote-as 1
no auto-summary
!
R3
hostname R3
!
interface Loopback0
ip address 3.3.3.3 255.255.255.0
!
interface Serial0/0
ip address 27.1.1.2 255.255.255.0
clock rate 2000000
!
interface Serial0/1
ip address 37.1.1.1 255.255.255.0
clock rate 2000000
!
router ospf 1
log-adjacency-changes
network 3.3.3.3 0.0.0.0 area 0
network 27.1.1.0 0.0.0.255 area 0
network 37.1.1.0 0.0.0.255 area 0
!
router bgp 2
no synchronization
bgp log-neighbor-changes
network 3.3.3.0 mask 255.255.255.0
neighbor 2.2.2.2 remote-as 2
neighbor 2.2.2.2 update-source Loopback0
neighbor 4.4.4.4 remote-as 2
neighbor 4.4.4.4 update-source Loopback0
no auto-summary
!
R4
hostname R4
!
interface Loopback0
ip address 4.4.4.4 255.255.255.0
!
interface Serial0/0
ip address 37.1.1.2 255.255.255.0
clock rate 2000000
!
interface Serial0/1
ip address 47.1.1.1 255.255.255.0
clock rate 2000000
!
router ospf 1
log-adjacency-changes
network 4.4.4.4 0.0.0.0 area 0
network 37.1.1.0 0.0.0.255 area 0
!
router bgp 2
no synchronization
bgp log-neighbor-changes
network 4.4.4.0 mask 255.255.255.0
neighbor 2.2.2.2 remote-as 2
neighbor 2.2.2.2 update-source Loopback0
neighbor 2.2.2.2 next-hop-self
neighbor 3.3.3.3 remote-as 2
neighbor 3.3.3.3 update-source Loopback0
neighbor 3.3.3.3 next-hop-self
neighbor 5.5.5.5 remote-as 3
neighbor 5.5.5.5 ebgp-multihop 2
neighbor 5.5.5.5 update-source Loopback0
no auto-summary
!
ip forward-protocol nd
ip route 5.5.5.0 255.255.255.0 47.1.1.2
!
R5
hostname R5
!
interface Loopback0
ip address 5.5.5.5 255.255.255.0
!
interface Serial0/0
ip address 47.1.1.2 255.255.255.0
clock rate 2000000
!
router bgp 3
no synchronization
bgp log-neighbor-changes
network 5.5.5.0 mask 255.255.255.0
neighbor 4.4.4.4 remote-as 2
neighbor 4.4.4.4 ebgp-multihop 2
neighbor 4.4.4.4 update-source Loopback0
no auto-summary
!
ip forward-protocol nd
ip route 4.4.4.0 255.255.255.0 47.1.1.1
!