设为首页收藏本站language 语言切换
查看: 2355|回复: 9
收起左侧

[求助] 关于重分发时调用route-map的问题?

[复制链接]
发表于 2016-5-4 09:04:36 | 显示全部楼层 |阅读模式
15鸿鹄币
这张拓扑图。
我将R1和R2相连链路的两个接口宣告进了EIGRP,R1的环回口没有宣告进EIGRP。
现在我在R1上做了将直连路由(环回口)重分发进EIGRP的操作。在做了这个操作之后,写了两条ACL
access-list 10 deny 1.1.1.0 0.0.0.255
accesss-list 10 permit any
将ACL调用到Route-map里面:
route-map king deny 10
match ip add
route-map king permit 20
在执行完上述操作之后,我在R2上查看路由表:
发现1.1.1.0的路由却出现了,可是不合逻辑啊。
Gateway of last resort is not set

      1.0.0.0/24 is subnetted, 1 subnets
D EX     1.1.1.0 [170/2560512256] via 192.168.1.1, 00:28:21, Serial2/0
      192.168.1.0/24 is variably subnetted, 2 subnets, 2 masks
C        192.168.1.0/24 is directly connected, Serial2/0
L        192.168.1.2/32 is directly connected, Serial2/0
R2#

我们都知道如果在ACL当中加了permit any的话,这条ACL调用到Route-map当中会起作用,但是route-map里面调用这条ACL的是deny 10,应该被拒绝,尽管ACL后面还有一个permit any,但是是调用到route-map king deny 10里面的,所以也被拒绝。route map后面还有一个允许所有的permit 20,但是所有重分发的已经被全部拒绝,在R2上怎么会出现1.1.1.0的路由呢?
这个是相关配置信息:
Building configuration...

Current configuration : 1721 bytes
!
! Last configuration change at 23:22:17 UTC Tue May 3 2016
!
version 15.2
service timestamps debug datetime msec
service timestamps log datetime msec
!
hostname R1
!
boot-start-marker
boot-end-marker
!
!
!
no aaa new-model
no ip icmp rate-limit unreachable
!
!
!
!
!
!         
no ip domain lookup
ip cef
ipv6 multicast rpf use-bgp
no ipv6 cef
!
!
multilink bundle-name authenticated
!
!
!
!
!
!
!
!
!
!
!
!
ip tcp synwait-time 5
!
!
!         
!
!
!
!
!
!
interface Loopback1
ip address 1.1.1.1 255.255.255.0
!
interface Loopback2
ip address 2.2.2.2 255.255.255.0
!
interface Loopback3
ip address 3.3.3.3 255.255.255.0
!
interface Loopback4
ip address 4.4.4.4 255.255.255.0
!
interface FastEthernet0/0
no ip address
shutdown
duplex full
!         
interface FastEthernet1/0
no ip address
shutdown
speed auto
duplex auto
!
interface FastEthernet1/1
no ip address
shutdown
speed auto
duplex auto
!
interface Serial2/0
ip address 192.168.1.1 255.255.255.0
serial restart-delay 0
!
interface Serial2/1
no ip address
shutdown
serial restart-delay 0
!
interface Serial2/2
no ip address
shutdown
serial restart-delay 0
!
interface Serial2/3
no ip address
shutdown
serial restart-delay 0
!
!
router eigrp 90
network 192.168.1.1 0.0.0.0
redistribute connected metric 1 1 1 1 1500 route-map king
!
ip forward-protocol nd
!
!
no ip http server
no ip http secure-server
!
access-list 10 deny   1.1.1.0 0.0.0.255
access-list 10 permit any
!
route-map king deny 10
match ip address 10
!
route-map king permit 20
!
!
!
control-plane
!
!
line con 0
exec-timeout 0 0
privilege level 15
logging synchronous
stopbits 1
line aux 0
exec-timeout 0 0
privilege level 15
logging synchronous
stopbits 1
line vty 0 4
login
!
!         
end

R1#

R2# show ip inter brief
Interface              IP-Address      OK? Method Status                Protocol
FastEthernet0/0        unassigned      YES unset  administratively down down   
FastEthernet1/0        unassigned      YES unset  administratively down down   
FastEthernet1/1        unassigned      YES unset  administratively down down   
Serial2/0              192.168.1.2     YES manual up                    up      
Serial2/1              unassigned      YES unset  administratively down down   
Serial2/2              unassigned      YES unset  administratively down down   
Serial2/3              unassigned      YES unset  administratively down down   
R2#show runn
Building configuration...

Current configuration : 1299 bytes
!
! Last configuration change at 20:21:35 UTC Tue May 3 2016
!
version 15.2
service timestamps debug datetime msec
service timestamps log datetime msec
!
hostname R2
!
boot-start-marker
boot-end-marker
!
!
!
no aaa new-model
no ip icmp rate-limit unreachable
!
!
!
!
!
!         
no ip domain lookup
ip cef
ipv6 multicast rpf use-bgp
no ipv6 cef
!
!
multilink bundle-name authenticated
!
!
!
!
!
!
!
!
!
!
!
!
ip tcp synwait-time 5
!
!
!         
!
!
!
!
!
!
interface FastEthernet0/0
no ip address
shutdown
duplex full
!
interface FastEthernet1/0
no ip address
shutdown
speed auto
duplex auto
!
interface FastEthernet1/1
no ip address
shutdown
speed auto
duplex auto
!         
interface Serial2/0
ip address 192.168.1.2 255.255.255.0
serial restart-delay 0
!
interface Serial2/1
no ip address
shutdown
serial restart-delay 0
!
interface Serial2/2
no ip address
shutdown
serial restart-delay 0
!
interface Serial2/3
no ip address
shutdown
serial restart-delay 0
!
!
router eigrp 90
network 192.168.1.2 0.0.0.0
!         
ip forward-protocol nd
!
!
no ip http server
no ip http secure-server
!
!
!
!
control-plane
!
!
line con 0
exec-timeout 0 0
privilege level 15
logging synchronous
stopbits 1
line aux 0
exec-timeout 0 0
privilege level 15
logging synchronous
stopbits 1
line vty 0 4
login
!
!
end

R2#  

捕获.PNG

最佳答案

查看完整内容

哥们你理解有误,ACL在route-map中只是起到匹配作用,真正起作用的是route-map里面的deny命令,所以你的理解错误,所以如果说你想让1.1.1.1 不要充分发进eigrp进程的话应该是route-map 123 permit 10 match ip add 10 就行了
发表于 2016-5-4 09:04:37 | 显示全部楼层
哥们你理解有误,ACL在route-map中只是起到匹配作用,真正起作用的是route-map里面的deny命令,所以你的理解错误,所以如果说你想让1.1.1.1 不要充分发进eigrp进程的话应该是route-map 123 permit 10
match ip add 10   就行了

点评

正解!  发表于 2016-5-8 18:42

评分

参与人数 1好评度 +2 收起 理由
wushuaiwen + 2 很给力!

查看全部评分

沙发 2016-5-4 09:04:37 回复 收起回复
回复

使用道具 举报

 楼主| 发表于 2016-5-4 11:01:36 | 显示全部楼层
ziansong 发表于 2016-5-4 10:10
哥们你理解有误,ACL在route-map中只是起到匹配作用,真正起作用的是route-map里面的deny命令,所以你的理 ...

这么跟你解释吧:首先第一个实验:
access-list 10 deny 1.1.1.0
access-list 10 permit any
route-map king deny 10
match ip add 10
如果将这个route-map给调用到重分发,那么R2就什么路由都没有了。
因为ACL当中,如果有deny,就必须配合Permit any使用,否则不生效,我们的acl当中已经有了permit may,所以应该在route-map当中生效。
既然生效,决定是permit还是deny的应该是route-map当中的deny10 ,那就被拒绝,以为你ACL当中还有个permit any,既然都被match ip add,那就其他2、3、4都是被route-map deny 10给拒绝掉的。
上面一个实验好理解。
然后呢下面的:
access-list 10 deny 1.1.1.0
access-list 10 permit any
rotue-map king deny 10
match ip add 10
route-map king permit 20
其实下面的和上面的只差了一个route-map king permti 20,加上这个之后,在R2上就会出现1.1.1.0的路由了,这是怎么回事?
1.1.1.0路由是被谁给放进来的?(问题是这个)
板凳 2016-5-4 11:01:36 回复 收起回复
回复

使用道具 举报

发表于 2016-5-4 11:06:56 | 显示全部楼层
ccnafasttrack 发表于 2016-5-4 03:01
这么跟你解释吧:首先第一个实验:
access-list 10 deny 1.1.1.0
access-list 10 permit any

理解有误,route-map最后面也有个deny的动作,你第一个实验route-map deny掉所有的了,第二个最有有个permit所以会吧1.1.1.1放进来
地板 2016-5-4 11:06:56 回复 收起回复
回复

使用道具 举报

 楼主| 发表于 2016-5-4 12:32:35 | 显示全部楼层
ziansong 发表于 2016-5-4 11:06
理解有误,route-map最后面也有个deny的动作,你第一个实验route-map deny掉所有的了,第二个最有有个per ...

但是在第二个实验当中,route-map deny 10 match ip add 10已经匹配了1.1.1.0,所以1.1.1.0已经被拒绝了呀!route-map permit 20 是在允许其他路由,但是所有的都在被前面的deny10给拒绝了
5# 2016-5-4 12:32:35 回复 收起回复
回复

使用道具 举报

发表于 2016-5-4 22:39:11 | 显示全部楼层
楼主可以考虑将access-list 10 permit any删去,这是多余的,因为在下面的route-map中的route-map king permit 20会将除1.1.1.0网络之外的都分发进该eigrp中,再有access-list只用于匹配网络,route-map才是用于做策略
6# 2016-5-4 22:39:11 回复 收起回复
回复

使用道具 举报

发表于 2016-5-5 14:27:00 | 显示全部楼层
ccnafasttrack 发表于 2016-5-4 13:32
但是在第二个实验当中,route-map deny 10 match ip add 10已经匹配了1.1.1.0,所以1.1.1.0已经被拒绝了 ...

否定的否定,就是正。所以,你的acl deny 1.1.1.1加route-map的deny,就成了permit 1.1.1.1了。你的permit any加route-map的deny,就成了deny any了。route-map也是从小号到大号比较的,有了匹配,往后的就会被忽略。
7# 2016-5-5 14:27:00 回复 收起回复
回复

使用道具 举报

发表于 2016-5-8 22:34:36 | 显示全部楼层
acl和route-map的组合原理是这样的:
access-list 10 deny 1.1.1.0 0.0.0.255 / 表示将1.1.1.0排除在外/
accesss-list 10 permit any  /表示将其他所有的路由条目抱在怀里/

route-map king deny 10  /表示将抱在怀里的路由条目执行deny策略/
match ip add 10  /表示匹配住抱在怀里的那些路由条目/
route-map king permit 20 /表示其他路由条目放过/
这样,就导致了你所说的问题
8# 2016-5-8 22:34:36 回复 收起回复
回复

使用道具 举报

发表于 2016-5-8 22:35:12 | 显示全部楼层
acl和route-map的组合原理是这样的:
access-list 10 deny 1.1.1.0 0.0.0.255 / 表示将1.1.1.0排除在外/
accesss-list 10 permit any  /表示将其他所有的路由条目抱在怀里/

route-map king deny 10  /表示将抱在怀里的路由条目执行deny策略/
match ip add 10  /表示匹配住抱在怀里的那些路由条目/
route-map king permit 20 /表示其他路由条目放过/
这样,就导致了你所说的问题
9# 2016-5-8 22:35:12 回复 收起回复
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 论坛注册

本版积分规则

QQ|Archiver|手机版|小黑屋|sitemap|鸿鹄论坛 ( 京ICP备14027439号 )  

GMT+8, 2025-4-26 15:05 , Processed in 0.120106 second(s), 32 queries , Redis On.  

  Powered by Discuz!

  © 2001-2025 HH010.COM

快速回复 返回顶部 返回列表