본문 바로가기

Ryu's Tech

Route Filtering - ACL,Prefix-list,Route-map + redistribute[재분배]


Route FIlter

R1 ---------- R2


R2는 아래 세개의 서브넷의 정보를 가지고 있다.
10.0.0.0 /8
20.20.0.0 /16
30.30.30.0 /24


*********** Filtering 1 [ ACL ]
ip access-list standard ACL1
 deny   10.0.0.0 0.255.255.255
 permit any
distribute-list ACL1 out


ACL을 이용한 필터링이다.

R1#sh ip route eigrp
     20.0.0.0/16 is subnetted, 1 subnets
D       20.20.0.0 [90/2297856] via 192.168.1.2, 00:00:00, Serial1/0
     30.0.0.0/24 is subnetted, 1 subnets
D       30.30.30.0 [90/2297856] via 192.168.1.2, 00:00:00, Serial1/0
R1#



*********** Filtering 2 [ prefix ]

ip prefix-list ACL2 seq 10 deny 20.0.0.0/8 le 16
ip prefix-list ACL2 seq 15 permit 0.0.0.0/0 le 32
distribute-list ACL2 out

R1#sh ip route eigrp
D    10.0.0.0/8 [90/2297856] via 192.168.1.2, 00:00:11, Serial1/0
     30.0.0.0/24 is subnetted, 1 subnets
D       30.30.30.0 [90/2297856] via 192.168.1.2, 00:00:11, Serial1/0
R1#



*********** Filtering 3 [route-map]

ip access-list standard ACL10
 permit 10.0.0.0 0.0.0.255
ip access-list standard ACL30
 permit 30.30.30.0 0.0.0.255
!


route-map RM deny 10
 match ip address ACL10
!
route-map RM deny 20
 match ip address ACL30
!
route-map RM permit 30
!

 distribute-list route-map RM out



     20.0.0.0/16 is subnetted, 1 subnets
D       20.20.0.0 [90/2297856] via 192.168.1.2, 00:00:16, Serial1/0
C    192.168.1.0/24 is directly connected, Serial1/0
R1#

위를 해석하면 알고보면 매우 간단하다.
ACL을 사용하여 각각의 route-map에 들어갈 IP를 설정한다.

route-map 에 어떠한 정보와 매치 시킬지를 설정한다. (여기서는 ACL10, ACL30 )
물론 prefix list를 사용하여도 가능하다.

route-map RM deny 10       // 거부한다.
 match ip address ACL10    // ACL10번과 매치하는 것을
!
route-map RM deny 20
 match ip address ACL30
!
route-map RM permit 30      // 나머지는 허용한다.
!

이렇게 되는 것입니다. ACL 규칙과 똑같이 route-map을 사용할 때도 마지막에 나머지는 허용하는 것을 넣어 주어야 합니다.
그렇지 않으면 route-map에서 언급되지 않은 20.20.0.0 /16 의 정보역시 차단 당할 것입니다.

이 문제에서는 route-map을 이용하여 distribute-list를 사용했습니다.
생각해보면 결국, 라우팅 정보를 뿌린다고 설정해놓고 막는다고 선언한것이니 좀 비효율적이죠?
다른 라우팅 프로토콜과의 재분배시에는 이를 좀 더 효율적으로 사용할 수 있습니다.
route-map을 이용하여 재분배될 경로를 선택하는 것이죠.

이전과 같은 1:1 토폴로지 구성에서
R1-R2구간은 EIGRP 100으로 구성하고
R2의 루프백 10,20,30 네트워크는 RIP로 돌려서 재분배를 하는 것을 설명드리겠습니다.


ip access-list standard ACL10
 permit 10.0.0.0 0.0.0.255
ip access-list standard ACL20
 permit 20.20.0.0 0.0.255.255
ip access-list standard ACL30
 permit 30.30.30.0 0.0.0.255

각각의 ACL리스트를 세분화 시켜서 만들어 보았습니다.
route-map RM permit 10
 match ip address ACL10
!
route-map RM deny 20
 match ip address ACL30
!
route-map RM permit 30
 match ip address ACL20
!
route-map RM permit 40
!

라우트 맵은
10 -> ACL10 -> 허용
20 -> ACL30 -> 거부
30 -> ACL20 -> 허용
나머지 -> 허용

이렇게 이루어 진 route-map이네요
위와 같이 route-map을 설정하고 재분배를 해보겠습니다.

 redistribute rip metric 1544 100 255 1 1500 route-map RM

그냥 재분배와 같지만 route-map RM 이 추가된 것을 볼 수 있네요.
그렇다면 라우팅 테이블을 확인해 볼게요

R1#sh ip route eigrp
     20.0.0.0/16 is subnetted, 1 subnets
D EX    20.20.0.0 [170/2195456] via 192.168.1.2, 00:03:32, Serial1/0
D EX 10.0.0.0/8 [170/2195456] via 192.168.1.2, 00:03:32, Serial1/0
R1#

바라던 대로 route-map을 통해서 30.30.30.1 의 주소가 거부되었네요^^
그렇다면 핑으로 확인!


R1#ping 10.0.0.1   
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 10.0.0.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 32/40/60 ms
R1#ping 20.20.0.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 20.20.0.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 32/34/40 ms
R1#ping 30.30.30.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 30.30.30.1, timeout is 2 seconds:
.....
Success rate is 0 percent (0/5)
R1#


이상입니다~~~~~~~~~~~