例如,我有一个MAC地址,我知道它是其中一个接口上的MAC地址。然而,当我搜索MAC地址属于哪个接口时,它并没有告诉我它属于哪个接口,因为这是在一条单独的线路上。
当使用grep通过路由器配置时,我可以使用grep-5 MAC地址显示5行以上和5行以下的搜索字符串。为什么MAC地址不在运行的配置中,所以这有可能吗?
我现在使用的一种解决方法是使用sh interaces _ MAC地址
如果我知道下面的接口,我就知道MAC地址属于哪个接口。
那么,是否有相当于grep -5的MAC地址呢?
发布于 2016-12-19 13:16:24
我从另一个论坛上得到了这个人:
我想明白了,但是你需要一个有IOS.sh的IOS版本:
term shell
sh ru | grep -u H.H.H | tail 10-u标志将显示您正在搜索的mac地址上方的所有行,然后,tail命令将只显示输出的最后十行。你可以用任何你想要的行来代替"10“。
思科
的先决条件
·Cisco IOS发布15.1(4)M,15.1(2)S,随后发布。
·思科IOS.sh必须配置并启用,以便在您的路由器上使用思科IOS.sh功能和功能。
http://www.cisco.com/c/en/us/td/docs/ios/netmgmt/configuration/guide/Convert/IOS_壳/纳米_ios_shell.pdf
发布于 2016-12-14 18:13:36
根据以下Cisco文档,没有类似的grep-5命令。管道命令确实支持正则表达式以帮助筛选输出。
下面的命令可以使输出更具可读性。(交替)
show interfaces | include Gig|0000.0000.0000
Switch#show interfaces | in Gig|000c.5e48.0801
GigabitEthernet0/0 is up, line protocol is up (connected)
GigabitEthernet0/1 is up, line protocol is up (connected)
Hardware is iGbE, address is 000c.5e48.0801 (bia 000c.5e48.0801)
GigabitEthernet0/2 is up, line protocol is up (connected)
GigabitEthernet0/3 is up, line protocol is up (connected)
GigabitEthernet1/0 is up, line protocol is up (connected)
GigabitEthernet1/1 is up, line protocol is up (connected)
GigabitEthernet1/2 is up, line protocol is up (connected)
GigabitEthernet1/3 is up, line protocol is up (connected) 一些切换IOS代码将列出其接口的MAC地址,如下所示。
show mac address-table或
show mac-address-tablehttps://networkengineering.stackexchange.com/questions/37315
复制相似问题