剖析使用物理端口建立的BGP關係(實驗部分)
拓撲圖:
hostname R1
no ip domain lookup
interface Loopback0
ip address 1.1.1.1 255.255.255.0
interface Ethernet0/1
ip address 12.1.1.1 255.255.255.0
router bgp 1
no synchronization
bgp router-id 1.1.1.1
bgp log-neighbor-changes
network 1.1.1.0 mask 255.255.255.0
network 12.1.1.0 mask 255.255.255.0
neighbor 12.1.1.2 remote-as 1
no auto-summary
hostname R2
no ip domain lookup
interface Loopback0
ip address 2.2.2.2 255.255.255.0
interface Ethernet0/0
ip address 12.1.1.2 255.255.255.0
interface Ethernet0/1
ip address 23.1.1.1 255.255.255.0
router bgp 1
no synchronization
bgp router-id 2.2.2.2
bgp log-neighbor-changes
network 2.2.2.0 mask 255.255.255.0
network 12.1.1.0 mask 255.255.255.0
network 23.1.1.0 mask 255.255.255.0
neighbor 12.1.1.1 remote-as 1
neighbor 23.1.1.2 remote-as 1
no auto-summary
line con 0
exec-timeout 0 0
logging synchronous
hostname R3
interface Loopback0
ip address 3.3.3.3 255.255.255.0
interface Ethernet0/0
ip address 23.1.1.2 255.255.255.0
interface Ethernet0/1
ip address 34.1.1.1 255.255.255.0
router bgp 1
no synchronization
bgp router-id 3.3.3.3
bgp log-neighbor-changes
network 3.3.3.0 mask 255.255.255.0
network 23.1.1.0 mask 255.255.255.0
neighbor 23.1.1.1 remote-as 1
no auto-summary
line con 0
exec-timeout 0 0
logging synchronous
現在看下路由表
R3# show ip bgp
BGP table version is 5, local router ID is 3.3.3.3
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
r RIB-failure, S Stale
Origin codes: i - IGP, e - EGP, ? - incomplete
Network Next Hop Metric LocPrf Weight Path
*>i2.2.2.0/24 23.1.1.1 0 100 0 i
*> 3.3.3.0/24 0.0.0.0 0 32768 i
*>i12.1.1.0/24 23.1.1.1 0 100 0 i
* i23.1.1.0/24 23.1.1.1 0 100 0 i
*> 0.0.0.0 0 32768 i
試驗現象:
R3# show ip bgp
BGP table version is 5, local router ID is 3.3.3.3
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
r RIB-failure, S Stale
Origin codes: i - IGP, e - EGP, ? - incomplete
Network Next Hop Metric LocPrf Weight Path
*>i2.2.2.0/24 23.1.1.1 0 100 0 i
*> 3.3.3.0/24 0.0.0.0 0 32768 i
*>i12.1.1.0/24 23.1.1.1 0 100 0 i
* i23.1.1.0/24 23.1.1.1 0 100 0 i
*> 0.0.0.0 0 32768 i
這個時間我們看到效果了吧!那是因爲R1要和R3建立BGP鄰居關係,而BGP中建立的鄰居關係是依據TCP來做的,在初始狀態下,R3沒有到達R1的路由條目,所以我們要啓用任何的三層路由協議。只要R3中能有R1 的路由條目就行