Cisco Hub-Spoke
三層×××配置指導
引言
在BGP/MPLS三層×××網絡中,經過×××的Route Target屬性來控制×××路由信息在各Site 之間的發佈和接收。××× Export Route Target和Import Route Target的設置相互獨立,而且能夠經過設置多個值,能夠實現靈活的×××間的互訪控制,這裏我首先經過Cisco的設備講解Hub-Spoke方式的三層×××的配置以及一些關鍵點。
應用場景
Hub-Spoke ×××的核心思想是在×××中設置中心訪問控制設備,其它用戶的互訪都經過中心訪問控制設備進行。上圖是一個典型的Hub-Spoke網絡,其中的元素分別爲Hub-PE、Hub-CE、Spoke-PE和Spoke-CE,通常狀況下Spoke-PE均與Hub-PE互聯,Spoke-PE之間無需互聯。在這裏Hub-PE看上去有點相似於路由反射器RR的功能,其實並非這樣的,能夠經過後面的配置中咱們能夠看到,在Hub-PE上並無配置任何RR的功能,這裏是經過Hub-PE和Spoke-PE互聯,組成以Hub-PE爲核心的星形網絡,而後經過Hub-CE將兩個×××之間的路由信息導通,而且進行互訪控制,在這裏,我就不對具體作那些互訪控制進行詳細的闡述了,在配好Hub-Spoke的×××以後,經過Hub-CE進行互訪控制實際上是件很簡單的事情。
Hub-Spoke組網的優勢主要體如今能夠方便的實現×××間的受限訪問,好比不一樣企業間的互訪,不多是徹底互訪的,因此受限訪問是很典型而且很實際的應用,這也是基於安全這一前提的。
配置要點
對於Hub-Spoke的組網,須要設置兩個Route Target,其一表示用於接收從Spoke-PE發佈的路由信息,其二表示用於向Spoke-PE發佈路由信息。各Site在PE上的vrf的Route Target設置原則大體爲:
Spoke-PE上設置Import Target和Export Target分別對應上面提到的兩個Route Target;
Hub-PE上須要使用兩個接口(能夠是一個CE,也能夠是兩個或多個CE),其一隻用來接收Spoke-PE發佈的路由信息,其二隻用來向Spoke-PE發佈路由信息,與Spoke-PE上的Import和Export Route Target正好相反。
從上圖能夠看出:Spoke Site之間的通訊經過Hub Site進行:
Hub-PE可以接收全部Spoke-PE發佈的×××-IPv4路由信息;
Hub-PE發佈的×××-IPv4路由可以爲全部Spoke-PE接收;
Hub-PE將從Spoke-PE學到的路由信息發佈給其餘Spoke-PE,所以,Spoke Site之間能夠經過Hub Site互訪,而Hub Site正好經過在自身上設置互訪控制策略對Spoke Site之間的互訪進行控制和管理;
任意Spoke-PE的Import Route Target屬性不與其它Spoke-PE的Export Route Target屬性相同。所以,任意兩個Spoke-PE之間不直接發佈×××-IPv4路由,Spoke Site之間不能直接互訪。這裏咱們配置的是域內三層×××,因爲Spoke-PE均是隻和Hub-PE創建IBGP鄰居關係,故根據BGP路由信息發佈的原則,IBGP鄰居不會把本身從IBGP鄰居學到的路由信息向其餘IBGP鄰居發佈,因此從這一點上來看Spoke-PE之間也不會直接發佈×××-IPv4路由。
因爲在PE-CE之間互聯會採用EBGP的方式,那麼Hub-Spoke組網中就會出現as-path有環的問題,因此這裏咱們在配置時必須在Hub-PE和Spoke-PE上配置能夠接收自治系統號重複的路由經過。
數據設計
因爲通常的跨域×××配置示例都是兩個AS,這裏我故意調整成了三個AS,其實也沒什麼變化,就是多配置一些EBGP鄰居而已。
Loopback地址:202.1.1.X/32,X=1、2、3、4、5、6,即路由器序號;
接口地址:80.X.Y.Z/24,X/Y=路由器序號,Z=1、2,路由器序號小的爲1,大的爲2;
IGP:PE-PE之間部署ISIS-L2和LDP,PE-CE之間採用EBGP互聯;
AS:R1 AS號爲1,R5 AS號爲500,R6 AS號爲600,R2、R3和R4的AS號爲100;
詳細配置
爲了節約版本,只羅列出6臺路由器的相關配置,其餘無關配置均不貼出來。
[R1]
R1#show run
!
version 12.4
!
hostname R1
!
ip cef
!
interface Loopback0
ip address 202.1.1.1 255.255.255.255
!
interface Ethernet4/0
ip address 80.1.2.1 255.255.255.0
duplex half
!
router bgp 1
no synchronization
bgp log-neighbor-changes
redistribute connected
neighbor 80.1.2.2 remote-as 100
no auto-summary
!
end
R1#
[R2]
R2#show run
!
version 12.4
!
hostname R2
!
ip cef
!
ip vrf vrf10
rd 200:1
route-target export 100:1
route-target import 200:1
!
interface Loopback0
ip address 202.1.1.2 255.255.255.255
ip router
isis
isis
circuit-type level-2-only
!
interface Ethernet4/0
ip vrf forwarding vrf10
ip address 80.1.2.2 255.255.255.0
duplex half
!
interface Ethernet4/1
ip address 80.2.3.1 255.255.255.0
ip router
isis
duplex half
mpls ip
isis
circuit-type level-2-only
!
router
isis
net 49.0000.0000.0000.2222.00
is-type level-2-only
metric-style wide
!
router bgp 100
no synchronization
bgp log-neighbor-changes
neighbor 202.1.1.3 remote-as 100
neighbor 202.1.1.3 update-source Loopback0
no auto-summary
!
address-family ***v4
neighbor 202.1.1.3 activate
neighbor 202.1.1.3 send-community extended
neighbor 202.1.1.3 allowas-in
exit-address-family
!
address-family ipv4 vrf vrf10
redistribute connected
neighbor 80.1.2.1 remote-as 1
neighbor 80.1.2.1 activate
no synchronization
exit-address-family
!
end
R2#
[R3]
R3#show run
!
version 12.4
!
hostname R3
!
ip cef
!
ip vrf vrf_in
rd 300:1
route-target import 100:1
!
ip vrf vrf_out
rd 300:2
route-target export 200:1
!
interface Loopback0
ip address 202.1.1.3 255.255.255.255
ip router
isis
isis
circuit-type level-2-only
!
interface Ethernet4/0
ip vrf forwarding vrf_in
ip address 80.3.6.1 255.255.255.0
duplex half
!
interface Ethernet4/1
ip address 80.2.3.2 255.255.255.0
ip router
isis
duplex half
mpls ip
isis
circuit-type level-2-only
!
interface Ethernet4/2
ip address 80.3.4.1 255.255.255.0
ip router
isis
duplex half
mpls ip
isis
circuit-type level-2-only
!
interface Ethernet4/3
ip vrf forwarding vrf_out
ip address 80.6.3.1 255.255.255.0
duplex half
!
router
isis
net 49.0000.0000.0000.3333.00
is-type level-2-only
metric-style wide
!
router bgp 100
no synchronization
bgp log-neighbor-changes
neighbor 202.1.1.2 remote-as 100
neighbor 202.1.1.2 update-source Loopback0
neighbor 202.1.1.4 remote-as 100
neighbor 202.1.1.4 update-source Loopback0
no auto-summary
!
address-family ***v4
neighbor 202.1.1.2 activate
neighbor 202.1.1.2 send-community extended
neighbor 202.1.1.4 activate
neighbor 202.1.1.4 send-community extended
exit-address-family
!
address-family ipv4 vrf vrf_out
redistribute connected
neighbor 80.6.3.2 remote-as 600
neighbor 80.6.3.2 activate
neighbor 80.6.3.2 allowas-in
no synchronization
exit-address-family
!
address-family ipv4 vrf vrf_in
redistribute connected
neighbor 80.3.6.2 remote-as 600
neighbor 80.3.6.2 activate
no synchronization
exit-address-family
!
end
R3#
[R4]
R4#show run
!
version 12.4
!
hostname R4
!
ip cef
!
ip vrf vrf10
rd 400:1
route-target export 100:1
route-target import 200:1
!
interface Loopback0
ip address 202.1.1.4 255.255.255.255
ip router
isis
isis
circuit-type level-2-only
!
interface Ethernet4/2
ip address 80.3.4.2 255.255.255.0
ip router
isis
duplex half
mpls ip
isis
circuit-type level-2-only
!
interface Ethernet4/3
ip vrf forwarding vrf10
ip address 80.4.5.1 255.255.255.0
duplex half
!
router
isis
net 49.0000.0000.0000.4444.00
is-type level-2-only
metric-style wide
!
router bgp 100
no synchronization
bgp log-neighbor-changes
neighbor 202.1.1.3 remote-as 100
neighbor 202.1.1.3 update-source Loopback0
no auto-summary
!
address-family ***v4
neighbor 202.1.1.3 activate
neighbor 202.1.1.3 send-community extended
neighbor 202.1.1.3 allowas-in
exit-address-family
!
address-family ipv4 vrf vrf10
redistribute connected
neighbor 80.4.5.2 remote-as 500
neighbor 80.4.5.2 activate
no synchronization
exit-address-family
!
end
R4#
[R5]
R5#show run
!
version 12.4
!
hostname R5
!
ip cef
!
interface Loopback0
ip address 202.1.1.5 255.255.255.255
!
interface Ethernet4/3
ip address 80.4.5.2 255.255.255.0
duplex half
!
router bgp 500
no synchronization
bgp log-neighbor-changes
redistribute connected
neighbor 80.4.5.1 remote-as 100
no auto-summary
!
end
R5#
[R6]
R6#show run
!
version 12.4
!
hostname R6
!
ip cef
!
interface Loopback0
ip address 202.1.1.6 255.255.255.255
!
interface Ethernet4/0
ip address 80.3.6.2 255.255.255.0
duplex half
!
interface Ethernet4/3
ip address 80.6.3.2 255.255.255.0
duplex half
!
router bgp 600
no synchronization
bgp log-neighbor-changes
neighbor 80.3.6.1 remote-as 100
neighbor 80.6.3.1 remote-as 100
no auto-summary
!
end
R6#