知識科普:MPLS VPN 運營商基於企業VPN的解決方案

案例拓撲

知識科普:MPLS VPN 運營商基於企業VPN的解決方案

需求分析

IPSEC VPN,GRE VPN等Intranet Vpn很難適應大規模的VPN,同時所有的VPN部署都需要用戶獨立完成,也增加了用戶端設備的負擔。MPLS是多協議標籤轉換協議,在MPLS網絡中,使用標籤轉發代替傳統的路由查詢,從而提高包的轉發速度。MPLS同時支持標籤的嵌套,MPLS和MPBGP結合完美的產生了一種新型VPN,MPLS VPN。這項技術使用戶不必干涉VPN的實現,同時也是運營商的一個商機。

上圖從CE1到CE2所有的網絡(除.1.1.1.1和5.5.5.5)全部為公網,PE1,P,PE2之間是MPLS網絡。我們用CE1的環回口和CE2的環回口模擬兩個局域網,我們的目標就是在這兩個私網上建立VPN隧道,使兩個私網可以互通。

三.實驗步驟

1.配置各接口地址

CE1(config)#int f0/0

CE1(config-if)#ip add 192.168.1.1 255.255.255.0

CE1(config-if)#no shut

CE1(config-if)#ip add 1.1.1.1 255.255.255.0

CE1(config-if)#no shut

PE1(config)#int f0/0

PE1(config-if)#ip add 192.168.1.2 255.255.255.0

PE1(config-if)#no shut

PE1(config-if)#int f0/1

PE1(config-if)#ip add 100.1.1.1 255.255.255.252

PE1(config-if)#no shut

PE1(config-if)#ip add 2.2.2.2 255.255.255.0

P(config)#int f0/0

P(config-if)#ip add 100.1.1.2 255.255.255.252

P(config-if)#no shut

P(config-if)#int f0/1

P(config-if)#ip add 200.1.1.1 255.255.255.252

P(config-if)#no shut

P(config)#int lo0

P(config-if)#ip add 3.3.3.3 255.255.255.0

PE2(config)#int f0/0

PE2(config-if)#ip add 200.1.1.2 255.255.255.252

PE2(config-if)#no shut

PE2(config-if)#int f0/1

PE2(config-if)#ip add 192.168.2.1 255.255.255.0

PE2(config-if)#no shut

PE2(config)#int lo0

PE2(config-if)#ip add 4.4.4.4 255.255.255.0

CE2(config)#int f0/0

CE2(config-if)#ip add 192.168.2.2 255.255.255.0

CE2(config-if)#no shut

CE2(config)#int lo0

CE2(config-if)#ip add 5.5.5.5 255.255.255.0

2.在PE1,P,PE2上宣告OPSF協議

PE1(config)#router ospf 1

PE1(config-router)#net 100.1.1.0 0.0.0.3 area 0

PE1(config-router)#net 2.2.2.0 0.0.0.255 area 0

P(config-if)#router ospf 1

P(config-router)#net 100.1.1.0 0.0.0.3 area 0

P(config-router)#net 200.1.1.0 0.0.0.3 area 0

P(config-router)#net 3.3.3.0 0.0.0.255 area 0

PE2(config-if)#router ospf 1

PE2(config-router)#net 200.1.1.0 0.0.0.3 area 0

E2(config-router)#net 4.4.4.0 0.0.0.255 area 0

3.在PE1,P,PE2上啟用cef快速轉發功能 注:由於Cisco的CEF是唯一使用FIB表的第3層交換機制,所以必須在運行MPLS的所有路由器上啟用CEF

PE1(config)#ip cef ;思科快速轉發功能,對於數據流的高速緩存應用到接口,不必經過內存和CUP,MPLS需要CEF支持。數據流組成 源地址,源端口,目標地址,目標端口,上層協議號

P(config)#ip cef

PE2(config)#ip cef

4.在PE1的F0/1,P的兩個以太接口,PE2的F0/0啟用MPLS

PE1(config)#int f0/1

PE1(config-if)#mpls ip

P(config)#int range f0/0 -1

P(config-if-range)#mpls ip

PE2(config)#int f0/0

PE2(config-if)#mpls ip

5.在CE1和CE2上配置靜態路由

CE1(config)#ip route 5.5.5.0 255.255.255.0 192.168.1.2

CE2(config)#ip route 1.1.1.0 255.255.255.0 192.168.2.1

6.在PE1和PE2上創建vrf(VPN路由轉發)實例

PE1(config)#ip vrf vpna ;vpn實例名稱只具有本地意義

PE1(config-vrf)#rd 100:1 ;RD加在私有地址的前面,以便在公網上傳輸時互相區分,vpnv4=rd+私有地址

PE1(config-vrf)#route-target both 100:2 ;RT用來做路由取捨,看對方發的路由本地是否接收。這裡的both指import和export,如果對方的export和本端import同,則學習到本實例。

PE2(config)#ip vrf vpnb

PE2(config-vrf)#rd 100:1

PE2(config-vrf)#route-target both 100:2 ;本端的export與對待import對應

RT是路由喜好,因此我們可以用RT來創建各種VPN,如全網互聯性,所有分佈到總部型,extranet型等……..

7. 定義PE1的FO/0和PE2的F0/1與各種VRF關聯。如果這個接口預先配置了IP地址,它自動將原IP地址刪除,定義好關聯後,再行配置IP地址。

PE1(config-if)#ip vrf forward vpna

% Interface FastEthernet0/0 IP address 192.168.1.2 removed due to enabling VRF vpna

PE1(config-if)#ip add 192.168.1.2 255.255.255.0

PE2(config-if)#ip vrf forward vpnb

% Interface FastEthernet0/1 IP address 192.168.2.1 removed due to enabling VRF vpnb

PE2(config-if)#ip add 192.168.2.1 255.255.255.0

8.在PE1和PE2上為自己的vpn實例添加vrf路由

PE1(config)#ip route vrf vpna 1.1.1.0 255.255.255.0 192.168.1.1

PE2(config)#ip route vrf vpnb 5.5.5.0 255.255.255.0 192.168.2.2

9.在PE1和PE2上配置IBGP

PE1(config)#router bgp 100 ;AS 100

PE1(config-router)#bgp router-id 2.2.2.2 ;BGP router-id 2.2.2.2

PE1(config-router)#neighbor 4.4.4.4 remote-as 100 ;BGP對等體和對等體自制系統

PE1(config-router)#neighbor 4.4.4.4 update-source lo0 ;更新lo0口,BGP更新源使用環回口,可以避免兩邊建立BGP關係時源和目的不相同

PE1(config-router)#no synchronization ;關閉BGP與IGP同步,因為這些是私網路由

PE1(config-router)#no auto ;關閉GBP自動彙總

PE1(config-router)#address-family vpnv4 ;配置BGP攜帶vpn4信息,並進入address family模式

PE1(config-router-af)#neighbor 4.4.4.4 activate ;對等體地址,並激活

PE1(config-router-af)#neighbor 4.4.4.4 send-community extended ;發送所有的附屬信息,此時的BGP就是MPGBP了,即多協議BGP

PE1(config-router-af)#exit

PE1(config-router)#address-family ipv4 vrf vpna ;發送vpn實例的路由信息PE1(config-router-af)#no synchronization

PE1(config-router-af)#redistribute static ;重分佈靜態(1.1.1.0)路由到bgp,這樣PE2的vpnb實例才能學到本地路由

PE2(config)#router bgp 100

PE2(config-router)#bgp router-id 4.4.4.4

PE2(config-router)#neighbor 2.2.2.2 remote-as 100

PE2(config-router)#neighbor 2.2.2.2 update-source 4.4.4.4

PE2(config-router)#neighbor 2.2.2.2 update-source lo0

PE2(config-router)#no synchronization

PE2(config-router)#address-family vpnv4

PE2(config-router-af)#neighbor 2.2.2.2 activate

PE2(config-router-af)#neighbor 4.4.4.4 send-community extended

% Cannot configure the local system as neighbor

PE2(config-router-af)#neighbor 2.2.2.2 send-community extended

PE2(config-router-af)#exit

PE2(config-router)#address-family ipv4 vrf vpnb

PE2(config-router-af)#no synchronization

PE2(config-router-af)#redistribute static

10.查看PE2路由表

知識科普:MPLS VPN 運營商基於企業VPN的解決方案

CE2上PING 1.1.1.1

知識科普:MPLS VPN 運營商基於企業VPN的解決方案

實驗到此結束。


分享到:


相關文章: