(1)本實驗主要論述了 BGP協議中、next-hop-self 的根本緣由、如上圖 R3學習到R1 的1.1.1.1/32路由的下一跳是R1 的接口f0/0 的IP地址 12.1.1.一、爲何?ide
R3#sh ip bgp BGP table version is 4, 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 * i1.1.1.1/32 12.1.1.1 0 100 0 1 i r>i2.2.2.2/32 23.1.1.2 0 100 0 i *> 3.3.3.3/32 0.0.0.0 0 32768 i R3#
(2)基本配置以下
R1配置:oop
interface Loopback1 ip address 1.1.1.1 255.255.255.255 interface FastEthernet0/0 ip address 12.1.1.1 255.255.255.0 duplex auto speed auto router bgp 1 no synchronization bgp log-neighbor-changes network 1.1.1.1 mask 255.255.255.255 neighbor 12.1.1.2 remote-as 234 no auto-summary
R2配置:學習
interface Loopback2 ip address 2.2.2.2 255.255.255.255 ! interface FastEthernet0/0 ip address 12.1.1.2 255.255.255.0 duplex auto speed auto ! interface FastEthernet0/1 ip address 23.1.1.2 255.255.255.0 duplex auto speed auto ! router ospf 1 log-adjacency-changes network 2.2.2.2 0.0.0.0 area 0 network 23.1.1.2 0.0.0.0 area 0 ! router bgp 234 no synchronization bgp log-neighbor-changes network 2.2.2.2 mask 255.255.255.255 neighbor 12.1.1.1 remote-as 1 neighbor 23.1.1.3 remote-as 234 no auto-summary !
R3配置:code
interface Loopback3 ip address 3.3.3.3 255.255.255.255 ! interface FastEthernet0/0 no ip address shutdown duplex auto speed auto ! interface FastEthernet0/1 ip address 23.1.1.3 255.255.255.0 duplex auto speed auto ! router ospf 1 log-adjacency-changes network 3.3.3.3 0.0.0.0 area 0 network 23.1.1.3 0.0.0.0 area 0 ! router bgp 234 no synchronization bgp log-neighbor-changes network 3.3.3.3 mask 255.255.255.255 neighbor 23.1.1.2 remote-as 234 no auto-summary !
(3)配置next-hop-self以後效果:router
R2(config)#router bgp 234 R2(config-router)#neighbor 23.1.1.3 next-hop-self
R3#sh ip bgp BGP table version is 6, 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 *>i1.1.1.1/32 23.1.1.2 0 100 0 1 i r>i2.2.2.2/32 23.1.1.2 0 100 0 i *> 3.3.3.3/32 0.0.0.0 0 32768 i R3#
(4)緣由分析:
記得我在講解BGP概述時候曾經跟學生講過、BGP這個EGP協議是工做在AS by AS之間的、BGP着眼的邊界是AS、那麼從這個角度來看咱們應該把一個AS號內的設備邏輯當成是一臺
大的路由器、接口
R1 當作是一臺大的路由器1 、R2和R3當作是一臺大的路由器2 、2收到1的路由、下一跳默認天然指向1的接口IP地址 12.1.1.1/24ip