動態多點×××配置(Dynamic Multipoint ×××)

  一般來說 IPSEC的流量分佈於基於總部與分支之間,分支與分支之間的流量分佈較少,若分支到分支通信必須跨越中心,這會耗費中心的資源並導致帶寬佔用導致延時.而且分支多的時候,管理與維護必將繁瑣,且不便於維護和排錯.如果讓分支到分支的流量不跨越中心,而且引入動態路由,將使得網絡便於維護和得到充分利用.

但是IPSEC只支持單播加密,而動態路由的更新依賴於多播(RIPV1)或組播(RIPV2,EIGRP,OSPF),到這裏我們便引入了動態多點××× (DM×××)的概念。
動態多點××× 依賴於GRE和NHRP
GRE:通用路由封裝。它可以封裝任意一種的網絡協議,所以非常適合於×××中作爲封裝路由協議.由於GRE包是單播包(不加密),所以適合用IPSEC加密在×××之間傳輸,這樣也可以作爲GRE Over IPSec

百科連接 http://baike.baidu.com/view/1004.htm

NHRP:下一跳解析協議 用於連接到非廣播多路訪問(NBMA)式子網絡的源站(主機或路由器)決定到達目標站間的 “ NBMA 下一跳 ”的互聯網絡層地址和 NBMA 子網地址。如果目的地與 NBMA 子網連接, NBMA 下一跳就是目標站;否則, NBMA 下一跳是從 NBMA 子網到目標站最近的出口路由器。 NHRP 被設計用於 NBMA 子網下的多重協議互聯網絡層環境中。

 

  在到達要生成響應的站之前, NBMA 子網內的 NHRP 解析請求經過一個甚至更多的跳。包括源站在內的每個站選擇一個它要轉發 NHRP 解析請求所去的鄰近 NHS 。 NHS 選擇過程是:在能返回路由決定的協議層路由表上應用目的協議層地址。這種路由選擇決定用於轉發 NHRP 請求給下游的 NHS 。先前提到的目標協議層地址存放在 NHRP 解析請求包中。注意:即使一個協議層地址被用來獲取路由選擇決定, NHRP 包不會被封裝於協議層頭,而是通過由它自己的頭描述的封裝形式存放於 NBMA 層。

百科連接:http://baike.baidu.com/view/876129.htm

簡單來說NHRP就是尋找到某條動態路由最近的下一跳而存在的

下面看動態隧道的建立

1.分支到中心(Spoke−to−Hub)的動態隧道建立

在DM×××網絡中,各分支路由通過IPSEC加密GRE通道連接到中心路由,中心路由TUNNEL 配置如下:

  1. interface Tunnel0
     ip address 192.168.1.1 255.255.255.0

     ip nhrp authentication cisco
     ip nhrp map multicast dynamic
     ip nhrp network-id 999
     ip nhrp cache non-authoritative
     ip ospf network broadcast
     tunnel source FastEthernet1/0
     tunnel mode gre multipoint
     tunnel protection ipsec profile cisco

其中某分支TUNNEL配置如下:

  1. interface Tunnel0  
  2.  ip address 192.168.1.3 255.255.255.0  
  3.  ip nhrp authentication cisco  
  4.  ip nhrp map multicast 202.96.128.2  
  5.  ip nhrp map 192.168.1.1 202.96.128.2  
  6.  ip nhrp network-id 999  
  7.  ip nhrp nhs 192.168.1.1  
  8.  ip nhrp cache non-authoritative  
  9.  ip ospf network broadcast  
  10.  tunnel source FastEthernet1/0  
  11.  tunnel mode gre multipoint  
  12.  tunnel protection ipsec profile cisco 

由於分支路由器外網端口的IP地址是自動獲取的(許多機構大都是採用ADSL),每次連接公網的IP地址可能不同,所以中心路由器無法根據該地址信息進行配置。分支路由器上則必須依據中心路由器的公網IP地址和NHRP協議來配置GRE隧道,中心路由器不必針對所有分支分別配置GRE或IPSec信息,新加入的分支路由器將自動註冊到中心路由器,將大大簡化中心路由器的配置。

2、分支到分支(Spoke−to−Spoke)的動態隧道建立

分支到中心(Spoke−to−Hub)的隧道一旦建立便持續存在,但各分支之間並不需要持續隧道。當一個分支需要向另一個分支需要通信時,它利用NHRP來動態獲取目的分支的IP地址。該過程中,中心路由器充當NHRP服務器的角色,響應NHRP請求,向源分支提供目標分支的公網地址。於是,兩個分支之間通過端口動態建立IPSec隧道,進行數據傳輸,過程就像DNS查詢一樣,該隧道在預定義的週期之後將關閉.

在路由器初始化後,中心路由器會通過持續存在的隧道向分支路由器宣告其它分支子網的可達路由。這樣分支路由器的路由表中到達其它分支子網的“下一跳”地址仍是中心路由器的隧道端口地址,而不是其它分支路由器的隧道端口地址,這個問題如果我們使用的是鏈路狀態路由協議的時候,是不存在下一跳地址被改變,但是如果我們使用的是距離向量型路由協議(RIP,EIGRP)的時候,默認是開啓水平分割的,必須關閉,否則,分支路由器將無法學習到通往其它分支子網的路由。另外各點的TUNNEL下必須開啓ip ospf broadcast,不然使用OSPF會導致上述問題

下面是主要配置
拓撲如下:

 

中心路由器R1配置如下:

  1. crypto isakmp policy 10 //ISAKMP策略  
  2.  encr 3des  
  3.  authentication pre-share  
  4. crypto isakmp key 110 address 0.0.0.0 0.0.0.0  
  5. !  
  6. !  
  7. crypto ipsec transform-set myset esp-3des esp-md5-hmac //統一IPSC策略集爲ESP  
  8. !  
  9. crypto ipsec profile cisco //IPSEC配置profile  
  10.  set transform-set myset   
  11.  
  12. interface Tunnel0  
  13.  ip address 192.168.1.1 255.255.255.0  
  14.  no ip redirects  
  15.  ip nhrp authentication cisco //nhrp認證  
  16.  ip nhrp map multicast dynamic 
  17.  ip nhrp network-id 999 //network-id認證  
  18.  ip nhrp cache non-authoritative  
  19.  ip ospf network broadcast //OSPF接口類型  
  20.  tunnel source FastEthernet1/0  
  21.  tunnel mode gre multipoint //接口爲GRE 多播  
  22.  tunnel protection ipsec profile cisco //啓用IPSEC的profile  
  23. !  
  24. interface FastEthernet1/0  
  25.  ip address 202.96.128.2 255.255.255.0  
  26.  duplex auto  
  27.  speed auto  
  28. !  
  29. router ospf 100  //OSPF動態路由  
  30.  log-adjacency-changes  
  31. router-id 192.168.1.1
  32.  network 3.3.3.0 0.0.0.255 area 0  
  33.  network 192.168.1.0 0.0.0.255 area 0  
  34. !  
  35. ip route 0.0.0.0 0.0.0.0 202.96.128.1 

分支R5配置:

  1. crypto isakmp policy 10  
  2.  encr 3des  
  3.  authentication pre-share  
  4. crypto isakmp key 110 address 0.0.0.0 0.0.0.0  
  5. !  
  6. crypto ipsec transform-set myset esp-3des esp-md5-hmac   
  7. !  
  8. crypto ipsec profile cisco  
  9.  set transform-set myset   
  10.  
  11. !  
  12. interface Loopback0  
  13.  ip address 2.2.2.1 255.255.255.0  
  14. !  
  15. interface Tunnel0  
  16.  ip address 192.168.1.2 255.255.255.0  
  17.  no ip redirects  
  18.  ip nhrp authentication cisco  
  19.  ip nhrp map multicast 202.96.128.2 //靜態指向Hub的物理接口地址  
  20.  ip nhrp map 192.168.1.1 202.96.128.2 ////創建一個邏輯IP地址和NBMA地址的靜態綁定  
  21.  ip nhrp network-id 999  
  22.  ip nhrp nhs 192.168.1.1 //NHS查詢器地址  
  23.  ip nhrp cache non-authoritative  
  24. ip ospf network broadcast
  25.  tunnel source FastEthernet1/0  
  26.  tunnel mode gre multipoint  
  27.  tunnel protection ipsec profile cisco  
  28. !  
  29. interface FastEthernet0/0  
  30.  no ip address  
  31.  shutdown  
  32.  duplex half  
  33. !  
  34. interface FastEthernet1/0  
  35.  ip address 202.96.129.2 255.255.255.0  
  36.  duplex auto  
  37.  speed auto  
  38. !  
  39. interface FastEthernet1/1  
  40.  no ip address  
  41.  shutdown  
  42.  duplex auto  
  43.  speed auto  
  44. !  
  45. router ospf 100  
  46.  log-adjacency-changes  
  47.  network 2.2.2.0 0.0.0.255 area 0  
  48.  network 192.168.1.0 0.0.0.255 area 0  
  49. !  
  50. ip route 0.0.0.0 0.0.0.0 202.96.129.1 

 分支R6配置如下:

 

  1. crypto isakmp policy 10  
  2.  encr 3des  
  3.  authentication pre-share  
  4. crypto isakmp key 110 address 0.0.0.0 0.0.0.0  
  5. !  
  6. crypto ipsec transform-set myset esp-3des esp-md5-hmac   
  7. !  
  8. crypto ipsec profile cisco  
  9.  set transform-set myset   
  10. !  
  11. interface Loopback0  
  12.  ip address 4.4.4.1 255.255.255.0  
  13. !  
  14. interface Tunnel0  
  15.  ip address 192.168.1.3 255.255.255.0  
  16.  no ip redirects  
  17.  ip nhrp authentication cisco  
  18.  ip nhrp map multicast 202.96.128.2  
  19.  ip nhrp map 192.168.1.1 202.96.128.2  
  20.  ip nhrp network-id 999  
  21.  ip nhrp nhs 192.168.1.1  
  22.  ip nhrp cache non-authoritative  
  23.  ip ospf network broadcast  
  24.  tunnel source FastEthernet1/0  
  25.  tunnel mode gre multipoint  
  26.  tunnel protection ipsec profile cisco  
  27. !  
  28. router ospf 100  
  29.  log-adjacency-changes  
  30.  network 4.4.4.0 0.0.0.255 area 0  
  31.  network 192.168.1.0 0.0.0.255 area 0  
  32. !  
  33. ip route 0.0.0.0 0.0.0.0 202.96.130.1 

現在看一下分支與中心的路由表

中心R1

分支R5

 

分支R6

在R5上TRCKER一下4.4.4.1(在R6上)

OK.實驗結束

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章