对于Cisco路由器和交换机,是否有show命令或类似命令显示将在ACL上实现哪些物理和逻辑接口以及将其应用到什么方向?比show run | <some regex>更简单。

#1 楼

不幸的是,我不相信有比show interfaces | <some regex>更简单的东西。

编辑:
show ip interface | include line protocol|access list


到目前为止,我的测试表明其结果与下面的较长RegEx相同。应用了ACL:

show ip interface | include is up|is administratively|is down|Outgoing|Inbound


这将为您提供每个接口,无论状态如何,出站和入站ACL都是什么。例如:每个接口的

LAB-4510-A#show ip interface | include is up|is administratively|is down|Outgoing|Inbound 
Vlan1 is administratively down, line protocol is down
Vlan110 is up, line protocol is up
  Outgoing access list is not set
  Inbound  access list is VENDOR->INTERNET
Vlan140 is administratively down, line protocol is down
  Outgoing access list is not set
  Inbound  access list is not set
Vlan150 is down, line protocol is down
  Outgoing access list is not set
  Inbound  access list is VENDOR->INTERNET
Vlan210 is up, line protocol is up
  Outgoing access list is not set
  Inbound  access list is not set
FastEthernet1 is administratively down, line protocol is down
  Outgoing access list is not set
  Inbound  access list is not set
GigabitEthernet1/1 is up, line protocol is up
  Outgoing access list is not set
  Inbound  access list is not set
GigabitEthernet1/2 is down, line protocol is down
  Inbound  access list is not set
  Outgoing access list is not set

等等。


此命令在Cisco交换机和路由器上均有效。请参阅下面的7200路由器的示例输出:

LAB-7204-A#show ip interface | include is up|is administratively|is down|Outgoing|Inbound
GigabitEthernet0/1 is up, line protocol is up
  Outgoing access list is not set
  Inbound  access list is not set
FastEthernet0/2 is administratively down, line protocol is down
GigabitEthernet0/2 is up, line protocol is up
  Outgoing access list is not set
  Inbound  access list is not set
GigabitEthernet0/3 is administratively down, line protocol is down
SSLVPN-VIF0 is up, line protocol is up
  Outgoing access list is not set
  Inbound  access list is not set
Loopback0 is up, line protocol is up
  Outgoing access list is not set
  Inbound  access list is not set
Loopback1 is up, line protocol is up
  Outgoing access list is not set
  Inbound  access list is not set


评论


您可能会缩短显示ip接口|包含线路协议|访问列表对于NX-OS,请显示ip访问列表摘要

– Santino
13年7月28日在17:59



@Santino,是的!我将相应地编辑答案。另外,在进行进一步的研究时,我还发现,PacketLife的Jeremy Stretch over已经有了另一条较短的RegEx(但不如您的短): include line protocol |访问列表是[^] + $我不确定是否有原因我们需要在“访问列表”之后进行额外的RegEx匹配。

–布雷特·莱金斯(Brett Lykins)
13年7月28日在18:04



Stretch的正则表达式将过滤掉未设置的访问列表行。他的正则表达式的末尾匹配一个单词,该单词将匹配ACL,因为它们不能有空格。好发现。

– Santino
13年7月28日在18:21



@Santino,这很有道理!感谢您的解释。回到Stretch的页面后,我也看到了解释……::阅读失败::就我而言:)

–布雷特·莱金斯(Brett Lykins)
13年7月28日在18:43

#2 楼

如果您有一个喜欢的show run | <some regex>命令,它会显示所需的信息,则您始终可以使用别名。

使用此命令的示例:
alias exec shacls sh ip int | inc line protocol|access list is [^ ]+$

然后,您可以仅使用alias-name(在本例中为shacls),它将与show run | <some regex>相同。 ASA略有不同。

编辑:我不能赞扬sh ip int | inc line protocol|access list is [^ ]+$,因为它来自PacketLife IOS提示。

#3 楼

我之前对此很困惑,发现了一个相当简单的正则表达式,可以为您提供所需的东西。

sho ip int | inc ^ [A-Z] |访问列表

该列表是忽略访问冲突行所必需的。

#4 楼

我以这种方式记得它。对我来说,最容易记住和最短的记录。

sh ip int | i line|list


评论


简洁明了

–杰夫·赖特(Jeff Wright)
16年1月28日在19:03

#5 楼

show ip interface应该可以解决问题。

#6 楼

sh run |在^ inter | access-gr

中给出running-config的输出

评论


您可以编辑问题以解释该命令如何工作吗?

– jwbensley
2014年2月7日在9:30



#7 楼

在Nexus设备上,您可以发布
显示访问列表摘要

显示ip访问列表摘要