Answers:
我不认为有任何事情比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
对于每个接口,依此类推。
此命令在思科交换机和路由器上均有效。请参阅下面的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
show ip interface | include line protocol|access list is [^ ]+$
我不确定是否有理由我们需要额外的RegEx匹配在“访问列表”之后。
如果您有show run | <some regex>
喜欢的命令来显示所需的信息,则始终可以使用别名。
使用此命令的示例:
alias exec shacls sh ip int | inc line protocol|access list is [^ ]+$
。
然后,您可以使用alias-name
(在本例中为shacls),它将与show run | <some regex>
注意:您需要在每个IOS设备上执行此操作。ASA略有不同。
编辑:我不能相信sh ip int | inc line protocol|access list is [^ ]+$
这是因为PacketLife IOS Tips。
show ip interface | include line protocol|access list
For NX-OS,show ip access-list summary