Switch Commands2 Flashcards
How to setup ip address on router or switch interface?
interface FastEthernet0/0
#ip address 192.168.0.1 255.255.255.0l
#no shutdown
#interface FastEthernet0/1
#ip address 192.168.1.1 255.255.255.0
#no shutdown
Vlan configuration on switch
Switch (config) # interface vlan 1
Switch (config-if)# ip address 192.168.0.10 255.255.255.0
Switch (config-if) # no shutdown
Switch (config-if)# exit
Switch (config) # ip default-gateway 192.168. 0.1
Change host name on router on switch
• A descriptive hostname makes it easier to identify the device.
• Eg. NY-F1-SW1
Switch (config) # hostname SWl
SW1 (config) #
Interface description on Switch
SW1 (config)# interface FastEthernet 0/1
SW1 (config-if) # description Link to R1
The commands you entered are used to configure an interface on a switch and provide a description for it.
Explanation:
1. SW1(config)# interface FastEthernet 0/1
• This command enters the configuration mode for the FastEthernet 0/1 interface on the switch SW1.
• Any settings applied now will only affect this specific interface.
2. SW1(config-if)# description Link to R1
• This sets a description for the FastEthernet 0/1 interface.
• The description is purely informational and does not affect the functionality of the interface.
• Network engineers use descriptions to document what the interface is connected to (e.g., another switch, router, or device).
Example Use Case:
If FastEthernet 0/1 is connected to a router named R1, adding a description helps network administrators quickly understand the interface’s purpose.
Verification Command:
To check the interface description, use:
SW1# show interfaces FastEthernet 0/1 description
This will display something like:
Interface Status Description
Fa0/1 up Link to R1
Switch management is address
• A Layer 2 Switch is not IP routing aware.
• It does however support a single IP address for management.
• The IP address and subnet mask is configured on the Switched Virtual
Interface (SVI) for the default VLAN 1
• A default gateway also needs to be configured to allow connectivity to other subnets
Interface speed and duplex
• Interface speed and duplex is set to ‘auto’ by default
• Both sides of a link should auto-negotiate to full duplex and the fastest available speed
• Best practice is to manually set the speed and duplex on ports which are connected to another network infrastructure device or server
• It is very important to set matching speed and duplex settings on both sides of the link
Speed and duplex commands on switch
SW1 (config) # interface FastEthernet 0/1
SW1 (config-if) # duplex full
SW1 (config-if) # speed 100
Verification commands on switch
SW1# show running-config
SW1# show ip interface brief
SW1# show run interface vlan 1
SW1# show interface vlan 1
SW1# show version
- show running-config
• Displays the current active configuration of the switch, including interface settings, VLANs, security settings, and other running parameters.
• This is different from the startup configuration, which is stored in NVRAM and used after a reboot.- show ip interface brief
• Provides a summarized view of all interfaces on the switch, showing:
• Interface name (e.g., VLAN1, FastEthernet0/1, GigabitEthernet1/0/1, etc.)
• IP addresses (if assigned)
• Operational status (up/down)
• Line protocol status (up/down)
• Useful for quickly checking interface connectivity and IP assignments. - show run interface vlan 1
• Displays the configuration of VLAN 1 specifically from the running configuration.
• VLAN 1 is typically the default management VLAN on Cisco switches, and this command helps verify its settings (e.g., IP address, shutdown state, etc.). - show interface vlan 1
• Displays detailed statistics about VLAN 1, including:
• IP address and subnet mask
• MTU (Maximum Transmission Unit)
• Input/output traffic statistics
• Line and protocol status
• Helps diagnose network and connectivity issues. - show version
• Displays system information such as:
• Cisco IOS software version
• Uptime of the device
• Hardware model and processor details
• Number of interfaces
• License information
• Configuration register settings (used for boot and recovery options)
• Useful for troubleshooting, upgrading, or verifying hardware capabilities.
- show ip interface brief
What is CDP Cisco Discovery Protocol?
CDP Cisco Discovery Protocol
• Cisco Discovery Protocol (CDP) is a Cisco proprietary Layer 2 proto
• It is used to share information with other directly connected Cisco equipment, such as the operating system version and IP address.
• This aids in troubleshooting by allowing administrators to map out
Cisco devices are connected to each other.
• It is enabled by default on most Cisco equipment.
• It works at Layer 2 so it is not necessary for the device to have an IP address.
CDP Cisco Discovery Protocol commands
Switch (config) # cdp run
Switch (config) # no cap run
Switch (config-if)# no cdp enable
Switch# show cdp
Switch# show cdp neighbors
Switch# show cdp neighbors details
These are Cisco IOS commands related to CDP (Cisco Discovery Protocol), which is a Layer 2 protocol used by Cisco devices to discover and share information about directly connected Cisco devices.
Explanation of Each Command:
1. cdp run
• This command enables CDP globally on the switch.
• CDP is enabled by default on Cisco devices.
2. no cdp run
• This command disables CDP globally on the switch.
• After running this, CDP will no longer send or receive advertisements.
3. no cdp enable (in interface configuration mode)
• This command disables CDP on a specific interface but does not affect other interfaces.
• Used when you want to disable CDP on certain ports while keeping it enabled on others.
4. show cdp
• Displays the CDP status on the device, showing whether CDP is running and its timers.
5. show cdp neighbors
• Lists directly connected Cisco devices that are discovered via CDP.
• Displays device ID, local interface, hold time, capability, platform, and port ID.
6. show cdp neighbors detail
• Provides detailed information about discovered neighbors.
• Includes IP addresses, software versions, and other details about the connected devices.
Example Scenario:
• If you enable cdp run, the switch starts discovering connected Cisco devices.
• If you disable CDP on a specific interface (no cdp enable), that port stops sending and receiving CDP advertisements.
• If you disable CDP globally (no cdp run), all CDP functions stop.
• Using show cdp neighbors gives a brief overview, while show cdp neighbors detail provides more in-depth information.
What is LLDP Link Layer Discovery Protocol
LLDP Link Layer Discovery Protocol
• LLDP (Link Layer Discovery Protocol) is an open standard protocol which provides similar information to CDP.
Differences with CDP:
• Depending on the switch and version it may be disabled by default
• It is only supported on physical interfaces
• It can only discover up to one device per port
• It can discover Linux servers
LLDP Link Layer Discovery Protocol commands
Switch (config) # lldp run
Switch (config)# no 1ldp run
Switch (config-if)# no lldp transmit
Switch (config-if)# no lldp receive
Switch# show 11dp
Switch# show 1ldp neighbors
Switch# show lldp neighbors details
The commands you provided relate to LLDP (Link Layer Discovery Protocol) on a network switch. LLDP is a vendor-neutral protocol used to advertise device information to directly connected neighbors. Let’s break them down:
Configuration Commands:
1. Switch(config)# lldp run
• This enables LLDP globally on the switch.
2. Switch(config)# no lldp run
• This disables LLDP globally on the switch.
3. Switch(config-if)# no lldp transmit
• This prevents the interface from sending LLDP advertisements.
4. Switch(config-if)# no lldp receive
• This prevents the interface from receiving LLDP advertisements.
Show Commands (Verification):
5. Switch# show lldp
• This is an incorrect command (typo). The correct command is show lldp ? to check available LLDP commands.
6. Switch# show lldp neighbors
• Displays a list of directly connected LLDP-enabled devices.
7. Switch# show lldp neighbors details
• Displays detailed LLDP information about connected neighbors, including system name, capabilities, and port ID.
Errors in Commands:
• no 1ldp run → Likely a typo; should be no lldp run
• show 11dp → Typo; should be show lldp
• show 1ldp neighbors → Typo; should be show lldp neighbors
Layer 1 Troubleshooting Commands
Switch# show ip interface brief
• ‘administratively down’ - Issue ‘no shutdown’
• ‘down/down’ - This indicates a Layer 1 issue. Check the interface is cabled at both ends and the device on the other side is powered on
• up/down - This indicates a Layer 2 issue or speed mismatch. Check the interface configuration matches on both sides of the link
Show interface commands
Switch# show interface
• If the interface is reporting an excessive amount of errors it could be either a Layer 1 or Layer 2 problem
• Check the integrity of the cable
• Check the configuration matches on both sides of the link
• Both sides of a link must be set the same, as either auto or manually configured
• Cisco devices default to auto
• If one side is set to auto, and the other is manually configured, this will often result in a mismatch
• Best practice is to manually configure ports attached to other network infrastructure devices or servers
• Remember to manually configure both sides of the link!
• If a device has issues with auto negotiating speed or duplex, manually configuring both sides will normally solve the problem
Speed and Duplex Mismatches problems
• A possible error is speed and/or duplex mismatches
• Incorrect speed settings can cause the interface to operate below its maximum speed
• Speed mismatches will typically bring the interface down
• The interface will typically stay up with duplex mismatches but performance will be terrible because of collisions
• The show interface command will report an excessively high number of errors in this case
• CDP should detect a duplex mismatch
%CDP-4-DUPLEX_MISMATCH: duplex mismatch discovered on
FastEthernet0/0 (not half duplex)