Simple Cisco switch commands, tips and tricks

From Notes_Wiki
Revision as of 01:50, 28 March 2022 by Saurabh (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Home > Switch configuration notes > Simple Cisco switch commands, tips and tricks

To see all ip addresses of switch

To see all ip addresses of switch use command `show ip aliases'. This can be very useful in case switch is going to get IP from DHCP server.


To get switch log messages when connected through telnet (vty)

When we are connected to a switch using telnet we do not get the messages that we get when we are connected to switch through console. If you want to get the messages like port up, line protocol up, etc. even on telnet (vty) connections then use

config t
    line vty 0
        monitor
        end

Here we have assumed that you are the only user connected to switch using telnet. Else use command `show users' and see on which vty you are connected to switch and configure that vty line to `monitor' mode.

Note: This configuration is temporary even if you type 'wr'. It will be show when you type 'show running-config' but it will not get applied when you re-connect to switch even on same vty. After re-connecting if you type 'show running-config' you wont see monitor setting for your vty line in configuration.



To avoid logging messages from disturbing you while typing

Many times when we are connected to switch through console, the switch messages come after we have typed only a portion of command. In such situation it is very hard to type the command properly as backspace does not erases switch's printed log message. To make sure that switch does not logs messages while we are in middle of typing a command. Use

config t
    line console 0
        logging synchronous
        exit
    line vty 0 15
        logging synchronous
        end
wr


To disable auto-negotiation of trunk / access mode

We can configure modern switch in three modes

  • access
  • trunk
  • dynamic desirable

In case of dynamic desirable switch will automatically try to negotiate link type. To avoid this communication we can either set 'switchport mode' to 'trunk' or 'access' or we can configure

switchport nonegotiate


To disable CDP (Cisco Discovery Protocol) on particular switch port

To disable CDP on particular switch port we can use

no cdp enable

command on that port.


To disable STP (Spanning Tree Protocol) on particular port

It is NOT possible to disable STP on particular port. We can however disable STP for particular VLAN. To do it we can use

no spanning-tree vlan <vlan_number>

Note that STP for the VLAN must be disabled in all the switches were this VLAN is forwarded (either trunked or access). Just disabling it on one switch will not solve problem and can have undesirable side-effects. After we disable STP for particular VLAN we have to be very careful in making connections of that VLAN, so that we do not create any loops. It is best to have at least storm control enabled on ports where we forward VLAN whose STP is disabled.


Home > Switch configuration notes > Simple Cisco switch commands, tips and tricks