Is it possible to extract from the switch configuration with basic cisco IOS commands which switch port has the trunk configured. The idea is that the return data from the given command will be the port number containing the switch port mode trunk in its config. I have tried to do this using show and pipe commands but have not been able to get anything meaningful.
The best you can to is use PIPE nexted to get information. But, if one interface were configured different from the other, chances are you can not get the config. For example.
sh run | i int|trunk|allow|nativ|mode
Thank you for your reply . The given command will return the lines containing the "trunk" in the configuration . What I want is to get the port number which has trunk mode in the configuration. I have an active 48 port switch, some ports are configured as access and some as trunk. I would like to use a command to simplify which of these 48 ports are configured as trunk with a specific port number, so that I do not have to search manually in sh run through the port configuration. For example, the command sh run | c trunk will give me the number of ports configured as trunk, but not the number of interfaces which are configured as trunk.
Yes, it is possible to use the "show" command with the "include" or "section" options, along with the "pipe" command to search for specific information in the running configuration of a Cisco IOS switch.
To find which switch ports have trunk configuration, you can use the following command:
show running-config | include interface|switchport mode trunk
This command will search the running configuration for lines containing the keywords "interface" and "switchport mode trunk", and display only those lines. This will give you a list of all the interfaces that have trunk configuration.
Alternatively, you can use
show interface status | include trunk
This command will display the status of all interfaces on a switch, and to filter the output to show only the interfaces that are configured as trunks.
**Remember to support with a like to keep the community active***