segunda-feira, novembro 15, 2010

Configurações e Comandos Cisco

Comandos para diagnóstico geral
Switch# show running-config
Switch# show startup-config
Switch# show version
Switch# dir flash:
Switch# show flash

Comandos para diagnóstico de interface

Switch# show interface fastethernet 0/4

Comandos para diagnóstico de VLANs

Switch# show interface vlan 1
Switch# show ip interface vlan 1
Switch# show vlan
Switch# show vlan id 2
Switch# show vlan name VLAN2

Comandos para diagnóstico de tabela CAM (mac-address)

Switch# show mac-address-table

Comandos para diagnóstico de características da interface

Switch# show port-security

Comandos para diagnóstico de STP

Switch# show spanning-tree brief

Comandos para configurações gerais de um switch

Switch# copy running-config startup-config
Switch# hostname Meu-Cisco
Switch# clear mac-address-table dynamic

Tarefa - Excluir todas as configurações de um switch e colocá-lo nos padrões de fábrica

Switch# erase startup-config
Switch# delete flash:vlan.dat
Switch# reload

Tarefa - Configurar Usuário e Senha na Console e para Acesso Telnet

Switch(config)# line console 0
Switch(config-line)# password cisco
Switch(config-line)# login

Switch(config)# line vty 0 15
Switch(config-line)# password cisco
Switch(config-line)# login

Tarefa - Configurar senhas para acesso ao modo privilegiado

Switch(config)# enable password cisco
Switch(config)# enable secret cisco

Tarefa - Configurar parâmetros de uma porta ethernet de swich

Switch(config)# interface gigabitethernet 0/5
Switch(config-if)# speed 100
Switch(config-if)# duplex full

Tarefa - Configurar Acesso Camada 3 do Switch através da VLAN 1

Switch(config)# interface vlan 1
Switch(config-if)# ip address 192.168.1.2 255.255.255.0
Switch(config-if)# no shutdown
Switch(config-if)# exit
Switch(config)# ip default-gateway 192.168.1.1

Tarefa - Configurar um endereço MAC estático

Switch(config)# mac-address-table static 00e0.2917.1884 vlan 1 interface fastethernet 0/4

Tarefa - Configurar aprendizagem fixa de endereços MAC (sticky)

Switch# configure terminal
Switch(config)# interface fastethernet 0/4
Switch(config-if)# switchport mode access
Switch(config-if)# switchport port-security
Switch(config-if)# switchport port-security mac-address sticky
Switch(config-if)# switchport port-security maximum 1
Switch(config-if)# switchport port-security violation shutdown
Switch(config-if)# exit

Tarefa - Criar vlans em um Switch

Switch# vlan database
Switch(vlan)# vlan 2 name VLAN2
Switch(vlan)# vlan 3 name VLAN3
Switch(vlan)# exit

Tarefa - Excluir VLANs configuradas em um switch

Switch# vlan database
Switch(vlan)# no vlan 2
Switch(vlan)# exit

Atenção: a VLAN 1 (default) não pode ser excluída.

Tarefa - Alocar portas de um switch em uma determinada VLAN

Switch# configure terminal
Switch(config)# interface fastethernet 0/2
Switch(config-if)# switchport mode access
Switch(config-if)# switchport access vlan 2
Switch(config-if)# end

Tarefa - Configurar um enlace trunk entre dois switches 2960 (encapsulamento 802.1Q padrão)

Switch_A# configure terminal
Switch_A(config)# interface fastethernet 0/1
Switch_A(config-if)# switchport mode trunk
Switch_A(config-if)# exit

Switch_B# configure terminal
Switch_B(config)# interface fastethernet 0/1
Switch_B(config-if)# switchport mode trunk
Switch_B(config-if)# exit

Caso seja necessário configurar o tipo de encapsulamento utilizar o comando:

Switch(config-if)# switchport trunk encapsulation dot1q

Tarefa - Configurar um switch no modo VTP SERVER

Switch# vlan database
Switch(vlan)# vtp server
Switch(vlan)# vtp domain group1
Switch(vlan)# exit

Tarefa - Configurar um switch no modo VTP CLIENT

Switch# vlan database
Switch(vlan)# vtp client
Switch(vlan)# vtp domain group1
Switch(vlan)# exit

Tarefa - Redefinindo o root bridge

Switch# configure terminal
Switch(config)# spanning-tree priority 1
ou
Switch(config)# spanning-tree vlan 1 priority 4096