2016年10月23日 星期日

EIGRP RIP Distribution-list

這個distribute-list是一個工具,所有的ACL相關的元件都是一個工具,distribute-list做為一個比較高級的工具,它是無法直接使用的。當然我們在說使用之前,先要了解他是工作在什麼地方。


我們知道ACL主要是工作在數據層面及控制層面,而這個distribute-list是直接工作在控制層面,就是讓網路管理者可以有一個工具來達到控制路由條目。
主要控制一台路由器二個大方向
  1. 做路由更新時能包含那些路由條目,發送給neighbor(控制在out的方向)
  2. 接收到一個路由更新的時候,能接收其中的那些路由條自(控制在in的方向)
OSPF將只能使用在in的方向,請參考後續OSPF Distribution-list
簡單來說就是做為控制層面的路由過濾。

本編以DV協議作說明,既然我們要控制路由,於DV協議中,因為路由更新主要是傳送路由條目,所以distribution-list可以利用ACL來抓出我們需要加以控制的路由條目,並運用策略。

下面還是以LAB來加以說明:這裡DV協議我就使用EIGRP來演示
架構如下:EIGRP己提前配置完成,我們主要說明如用使用distribution-list























先確認一下路由都正常。
R1#sh ip route eigrp
      22.0.0.0/24 is subnetted, 1 subnets
D        22.1.1.0 [90/156160] via 12.1.1.2, 00:00:45, FastEthernet0/0
      33.0.0.0/24 is subnetted, 1 subnets
D        33.1.1.0 [90/156160] via 13.1.1.3, 00:00:23, FastEthernet1/0
      44.0.0.0/24 is subnetted, 1 subnets
D        44.1.1.0 [90/156160] via 14.1.1.4, 00:00:03, FastEthernet1/1
------------------------------------------------------------------------------------
R2#sh ip route eigrp
      11.0.0.0/24 is subnetted, 1 subnets
D        11.1.1.0 [90/156160] via 12.1.1.1, 00:02:47, FastEthernet0/0
      13.0.0.0/24 is subnetted, 1 subnets
D        13.1.1.0 [90/30720] via 12.1.1.1, 00:02:47, FastEthernet0/0
      14.0.0.0/24 is subnetted, 1 subnets
D        14.1.1.0 [90/30720] via 12.1.1.1, 00:02:47, FastEthernet0/0
      33.0.0.0/24 is subnetted, 1 subnets
D        33.1.1.0 [90/158720] via 12.1.1.1, 00:02:21, FastEthernet0/0
      44.0.0.0/24 is subnetted, 1 subnets
D        44.1.1.0 [90/158720] via 12.1.1.1, 00:02:02, FastEthernet0/0
------------------------------------------------------------------------------------

R3#sh ip route eigrp 
      11.0.0.0/24 is subnetted, 1 subnets
D        11.1.1.0 [90/156160] via 13.1.1.1, 00:04:09, FastEthernet1/0
      12.0.0.0/24 is subnetted, 1 subnets
D        12.1.1.0 [90/30720] via 13.1.1.1, 00:04:09, FastEthernet1/0
      14.0.0.0/24 is subnetted, 1 subnets
D        14.1.1.0 [90/30720] via 13.1.1.1, 00:04:09, FastEthernet1/0
      22.0.0.0/24 is subnetted, 1 subnets
D        22.1.1.0 [90/158720] via 13.1.1.1, 00:04:09, FastEthernet1/0
      44.0.0.0/24 is subnetted, 1 subnets
D        44.1.1.0 [90/158720] via 13.1.1.1, 00:03:48, FastEthernet1/0
------------------------------------------------------------------------------------
 R4#sh ip route eigrp 
      11.0.0.0/24 is subnetted, 1 subnets
D        11.1.1.0 [90/156160] via 14.1.1.1, 00:04:25, FastEthernet1/1
      12.0.0.0/24 is subnetted, 1 subnets
D        12.1.1.0 [90/30720] via 14.1.1.1, 00:04:25, FastEthernet1/1
      13.0.0.0/24 is subnetted, 1 subnets
D        13.1.1.0 [90/30720] via 14.1.1.1, 00:04:25, FastEthernet1/1
      22.0.0.0/24 is subnetted, 1 subnets
D        22.1.1.0 [90/158720] via 14.1.1.1, 00:04:25, FastEthernet1/1
      33.0.0.0/24 is subnetted, 1 subnets
D        33.1.1.0 [90/158720] via 14.1.1.1, 00:04:25, FastEthernet1/1

目前看來路由都是正常。
那我們目前需求,希望R3不要收到R2的Lo0的路由條目22.1.1.0/24。
這個需求以上面說明的,我們可以在R3的in及R1的out方向來配置,這裡使用R1的out方向,在做路由控制,盡可能的靠近來源來有效節省鏈路資源。
R1#config t
R1(config)#access-list 10 deny 22.1.1.0
R1(config)#access-list 10 permit any 
R1(config)#router eigrp 90
R1(config-router)#distribute-list 10 out fastEthernet 1/0
查看一下ACL的匹配狀況
R1#sh ip access
Standard IP access list 10
    10 deny   22.1.1.0 (3 matches)
    20 permit any (12 matches)
配置完成後我們來查看一下效果,如下效果己經出來了
R3#sh ip route eigrp 
      11.0.0.0/24 is subnetted, 1 subnets
D        11.1.1.0 [90/156160] via 13.1.1.1, 00:13:20, FastEthernet1/0
      12.0.0.0/24 is subnetted, 1 subnets
D        12.1.1.0 [90/30720] via 13.1.1.1, 00:13:20, FastEthernet1/0
      14.0.0.0/24 is subnetted, 1 subnets
D        14.1.1.0 [90/30720] via 13.1.1.1, 00:13:20, FastEthernet1/0
      44.0.0.0/24 is subnetted, 1 subnets
D        44.1.1.0 [90/158720] via 13.1.1.1, 00:12:59, FastEthernet1/0

另一個需求是R2不能收到R4的Lo0的路由條目44.1.1.0/24,而這次我們選擇測試一下in的方向
R2#config t
R2(config)#access-list 10 deny 44.1.1.0
R2(config)#access-list 10 permit any
R2(config)#router eigrp 90
R2(config-router)#distribute-list 10 in fastEthernet 0/0
查看一下ACL的匹配狀況
R2#sh ip access
Standard IP access list 10
    10 deny   44.1.1.0 (3 matches)
    20 permit any (4 matches)
配置完成後我們來查看一下效果,如下效果己經出來了
R2#sh ip route eigrp 
      11.0.0.0/24 is subnetted, 1 subnets
D        11.1.1.0 [90/156160] via 12.1.1.1, 00:18:31, FastEthernet0/0
      13.0.0.0/24 is subnetted, 1 subnets
D        13.1.1.0 [90/30720] via 12.1.1.1, 00:18:31, FastEthernet0/0
      14.0.0.0/24 is subnetted, 1 subnets
D        14.1.1.0 [90/30720] via 12.1.1.1, 00:18:31, FastEthernet0/0
      33.0.0.0/24 is subnetted, 1 subnets
D        33.1.1.0 [90/158720] via 12.1.1.1, 00:18:05, FastEthernet0/0


所以這裡可以得出結論,Distribute-list在DV協議中,不管in及out的方向都可以正常工作。

沒有留言:

張貼留言