Você está na página 1de 21

Conectando no switch

Geralmente switches vem sem IP de gerenciamento ativo, isso vale para quase todos os
fabricantes, sendo assim a primeira configuração precisará ser feita via cabo serial. No
Windows a melhor maneira é usando o HyperTerminal. No Linux o Minicom é a
melhor alternativa. Em qualquer uns dos programas, configure a porta serial que será
usada para configurar usando os parâmetros abaixo:

Ligue o switch. Uma vez conectado você cairá em um prompt parecido com o abaixo.

Cisco Internetwork Operating System Software


IOS ™ C2950 Software (C2950-I6Q4L2-M), Version 12.1(22)EA4
Copyright (c) 1986-2005 by cisco Systems, Inc.
Compiled Wed 18-May-05 22:31 by jharirba

Press RETURN to get started!

Configurando

Pressione Enter para continuar. Em seguida ficará aberto o prompt abaixo:

Switch>

Switch é o nome atual do dispositivo e o sinal de maior > significa que um usuário não
privilegiado está acessando o equipamento. Com esta permissão você não conseguirá
fazer muita coisa. Para acessar o modo privilegiado digite o comando enable e o sinal
de maior dará lugar ao cerquilha #
Switch#

Mesmo neste modo você precisará digitar o comando conf t para poder executar os
comandos de configuração. Note que o comando completo neste caso é configure
terminal, mas todos os comandos podem ser abreviados desde que não haja
ambiguidade entre os mesmos. O prompt ficará assim:

Switch(config)#

A partir daqui todos os comandos de configuração pode ser executados.

Para mudar o nome do switch execute o comando hostname nome_do_switch. Todos


os comandos são validados imediatamente então o prompt mudará para:

nome_do_switch(config)#

Para poder gereciar o switch via web você deverá colocar um IP na vlan 1, para isso
execute os comandos abaixo.

Para selecionar a Vlan 1 que é a Vlan default do switch:

nome_do_switch(config)#interface vlan 1

Para configurar o IP:

nome_do_switch(config-if)#ip address 192.168.0.200 255.255.255.0


nome_do_switch(config-if)#no shutdown

Para adicionar o default gateway ou roteador da rede:

nome_do_switch(config-if)#ip default-gateway 192.168.0.1

Note que quando você começou a configurar o ip do switch, precisou selecionar a Vlan
1. Isso fez com que o prompt mudasse para nome_do_switch(config-if)#. Quando
qualquer configuração de interface terminar você deve executar o comando exit para
voltar para o prompt nome_do_switch(config)#. Outra maneira de sair do modo de
configuração é executar o comando Ctrl + Z, que voltará para o modo privilegiado
onde o prompt é assim: nome_do_switch#

Para habilitar a porta 1, considerando que a porta 1 é uma porta Fast Ethernet ou 100
mbps:

nome_do_switch(config)#int Fa 0/1
nome_do_switch(config-if)#no shutdown
nome_do_switch(config-if)#exit

Portas Fast Ethernet ou 100 mbps começam com o prefixo Fa. Portas Gigabit ou 1000
mbps começam com o prefixo Gi.

Para habilitar as portas de 1 a 10, por exemplo, execute os comandos:


nome_do_switch(config)#int range Fa 0/1-10
nome_do_switch(config-if-range)#no shutdown
nome_do_switch(config-if-range)#exit

O comando range serve para selecionar mais de uma porta. Note que o comando para
habilitar uma porta é no shutdown. Para desabilitar a porta o comando é shutdown.
Então aqui vai mais uma regra: Todo comando que você quer desfazer no Cisco basta
colocar um no na frente.

Para mostrar como estão configuradas as portas é necessário sair do modo de


configuração (dando exit ou Ctrl + Z) e executando o comando:

nome_do_switch#show int

O resultado será algo assim:

FastEthernet0/1 is up, line protocol is up (connected)


Hardware is Lance, address is 0090.2132.8301 (bia 0090.2132.8301)
BW 100000 Kbit, DLY 1000 usec,
reliability 255/255, txload 1/255, rxload 1/255
Encapsulation ARPA, loopback not set
Keepalive set (10 sec)
Full-duplex, 100Mb/s
input flow-control is off, output flow-control is off
ARP type: ARPA, ARP Timeout 04:00:00
Last input 00:00:08, output 00:00:05, output hang never
Last clearing of “show interface” counters never
Input queue: 0/75/0/0 (size/max/drops/flushes); Total output drops: 0
Queueing strategy: fifo
Output queue :0/40 (size/max)
5 minute input rate 0 bits/sec, 0 packets/sec
5 minute output rate 0 bits/sec, 0 packets/sec
956 packets input, 193351 bytes, 0 no buffer
Received 956 broadcasts, 0 runts, 0 giants, 0 throttles
0 input errors, 0 CRC, 0 frame, 0 overrun, 0 ignored, 0 abort
0 watchdog, 0 multicast, 0 pause input
0 input packets with dribble condition detected
2357 packets output, 263570 bytes, 0 underruns
–More–

Teclando barra de espaços você verá todas as portas do switch, mas se quiser ver só
uma interface, por exemplo a porta 11, basta digitar o comando:

nome_do_switch#show int Fa 0/11

Neste caso só a interface 11 será exibida.

Tudo o que foi configurado até agora foi feito na memória do sistema operacional do
switch. Se você desligá-lo, todas as alterações serão perdidas. Para salvar existem dois
comandos. Por motivos óbvios eu prefiro a segunda opção:
nome_do_switch#copy running-config startup-config

ou

nome_do_switch#write (ou digite somente wr)

Setando senha para o modo privilegiado

É altamente recomendável que você proteja o modo privilegiado com senha para evitar
que usuários que tenham acesso a console via porta serial possam efetuar alterações.
Para isso execute os seguintes comandos:

Switch>enable
Switch#conf t
Switch(config)#enable secret senha_do_enable
Switch(config)#Ctrl + Z

Setando senha para acesso via telnet

Execute os comandos abaixo para habilitar o acesso via telnet:

Switch>enable
Switch#conf t
Switch(config)#line vty 0 15
Switch(config-line)#password senha_do_telnet
Switch(config-line)#Ctrl + Z

Note que switches Cisco, por padrão, não pedem usuário, somente a senha de telnet,
diferente de equipamentos de rede de outros fabricantes.

Criando um banner de login

Caso você tenha muitos switches, criar um banner de login pode ser bem útil para
informá-lo da localização do equipamento quando for logar via telnet por exemplo.
Com o comando banner você pode configurar as informações que aparecerão. Note que
você precisará escolher um caracter que será o final do banner. Neste caso eu escolhi o
&. Quando o & for digitado, o switch entenderá que o banner está pronto. Execute os
comandos abaixo para configurar o banner:

Switch>enable
Switch#conf t
Switch(config)# banner motd &
Enter TEXT message. End with the character ‘&’
Switch core do Datacenter – fila A Bastidor 3&
Switch(config)#Ctrl + Z

Configurando a Data e Hora do switch


Parace um negócio bobo, mas ajustar o horário de switch é de fundamental importância
quando você está examinando logs a procura da causa de um eventual problema de rede.
Então, execute os comandos abaixo para configurar o horário do switch:

Switch>enable
Switch#clock set 23:59:00 30 Apr 2010
Switch#sh clock
*23:59:01.333 UTC fri apr 30 2010

Para configurar o horário será necessário digitar no formato acima utilizando as


abreviaturas dos meses  em inglês com três letras. O comando sh clock serve para exibir
o horário recém-configurado.

Dando reboot no switch

Switch>enable
Switch#reload
Proceed with reload? [confirm] Enter

Tome o cuidado de dar um wr (para salvar as alterações) antes de dar um reboot, pois
caso contrário as configurações  do switch serão perdidas.

1- Entrar no modo privilegiado.

 switch>enable

Password:*******

switch#

 2- Configurar ou alterar a senha do modo privilegiado.

 switch(config)#enable secret ****** digite a senha

switch(config)#exit
 3- Configurar um nome para o Switch.

 switch#configure terminal

Enter configuration commands, one per line.  End with CNTL/Z.

switch(config)#hostname NOME

switch(config)#exit

switch#

 4- Configurar velocidade e modo de comunicação da porta.

 Switch 2950:

switch#config t

Enter configuration commands, one per line.  End with CNTL/Z.

switch(config)#interface fastEthernet 0/1

switch(config-if)#speed 100

switch(config-if)#duplex full
 5- Configurar o endereço IP/Máscara/Gateway nos Switchs.

 switch#configure terminal

Enter configuration commands, one per line.  End with CNTL/Z.

switch(config)#interface vlan 1

switch(config-if)#ip address X.X.X.X Y.Y.Y.Y onde X é o endereço IP e Y a máscara


de rede

switch(config-if)#exit

switch(config)#ip default-gateway X.X.X.X onde  X é o endereço IP do default-


gateway

switch(config)#exit

switch#

 6- Criar VLANs nos Switchs.

switch#vlan database
switch(vlan)#vlan 2 name NAME

VLAN 2 modified:

  Name: NAME

 OU

 switch#config t

Enter configuration commands, one per line.  End with CNTL/Z.

switch(config)#vlan 2

switch(config-vlan)#name NAME

 7- Atribuir portas as VLANs.

 Portas 3, 4 e 5 – VLAN 2

 switch#config t

Enter configuration commands, one per line.  End with CNTL/Z.


switch(config)#interface fastEthernet 0/3

switch(config-if)#switchport access vlan 2

switch(config-if)#exit

switch(config)#interface fastEthernet 0/4

switch(config-if)#switchport access vlan 2

switch(config-if)#exit

switch(config)#interface fastEthernet 0/5

switch(config-if)#switchport access vlan 2

switch(config-if)#exit

switch(config)#exit

switch#

 switch#show vlan visualizar VLAN 

 8-  Configurar TRUNK.


 Switch 2950:

switch#config t

Enter configuration commands, one per line.  End with CNTL/Z.

switch(config)#interface fastEthernet 0/1

switch(config-if)#speed 100

switch(config-if)#duplex full

switch(config-if)#switchport mode trunk

switch(config-if)#exit

switch(config)#exit

switch#show run

 OU

 Switch 2900:
switch#config t

Enter configuration commands, one per line.  End with CNTL/Z.

switch(config)#interface fastEthernet 0/1

switch(config-if)#speed 100

switch(config-if)#duplex full

switch(config-if)#switchport mode trunk

switch(config-if)#switchport trunk encapsulation dot1q

switch(config-if)#exit

 9   - Configurar Espelhamento de portas para coleta de dados.

 Exempl Espelhar as portas 1, 2 e 3 para porta 24.

Switch 2950:

switch#config t

Enter configuration commands, one per line.  End with CNTL/Z.


switch(config)#monitor session 1 destination interface fastEthernet 0/24

switch(config)#monitor session 1 source interface fastEthernet 0/1

switch(config)#monitor session 1 source interface fastEthernet 0/2

switch(config)#monitor session 1 source interface fastEthernet 0/3

switch(config)#exit

 OU

 switch#config t

Enter configuration commands, one per line.  End with CNTL/Z.

switch(config)# interface fastEthernet 0/24

switch(config-if)#port monitor FastEthernet 0/1

switch(config-if)#port monitor FastEthernet 0/2

switch(config-if)#port monitor FastEthernet 0/3


switch(config-if)#exit

switch(config)#exit

 10 - Copiar arquivo de configuração.

 switch#config t

Enter configuration commands, one per line.  End with CNTL/Z.

Switch(config)#ip ftp username USUÁRIO

Switch(config)#ip ftp password SENHA

Switch(config)#end

 Switch#copy nvram: startup-config ftp:

Address or name of remote host []? X.X.X.X onde  X é o endereço IP do servidor FTP

Destination filename [switch-confg]? cisco/nomedoarquivo

Writing cisco/nomedoarquivo !

1462 bytes copied in 3.368 secs (434 bytes/sec)


 11 - Configurar relógio do switch.

 switch# clock set 12:06:00 30 may 2005

  12 – Configurar modo de exibição do log.

 switch#config t

Enter configuration commands, one per line.  End with CNTL/Z.

Switch(config)# service timestamps log datetime

13 – Configurar tamanho do log.

 switch#config t

Enter configuration commands, one per line.  End with CNTL/Z.

Switch(config)# logging buffered 8192

 14 – Configurar servidor de log.

 switch#config t
Enter configuration commands, one per line.  End with CNTL/Z.

Switch(config)# logging X.X.X.X onde  X é o endereço IP do servidor de Logs   

15 – Criptografar as senhas console e telnet (configure terminal).

 switch#config t

Enter configuration commands, one per line.  End with CNTL/Z.

Switch(config)#service password-encryption   habilita a criptografia

 16 – Configurar Lista de acesso (MAC).

 switch#config t

Enter configuration commands, one per line.  End with CNTL/Z.

Switch(config)#mac access-list extended TESTE

Switch(config-ext-macl)#permit host XXXX.XXXX.XXXX host


YYYY.YYYY.YYYY    onde  X e Y são os endereços MAC

Switch#conf t
Enter configuration commands, one per line.  End with CNTL/Z.

Switch(config)#int fas 0/5

Switch(config-if)# mac access-group TESTE in   atribuir lista a interfece

 17 – Configurar controle de storm de broadcasts

 Switch 2950:

switch#config t

Enter configuration commands, one per line.  End with CNTL/Z.

switch(config)#interface fastEthernet 0/1

switch(config-if)#storm-control broadcast level N   //N= % da banda a ser limitada//

switch(config-if)# storm-control action shutdown  //Caso atinja o limite acima  porta


ficará em shutdown//

switch(config-if)#exit
 Switch 2900:

switch#config t

Enter configuration commands, one per line.  End with CNTL/Z.

switch(config)#interface fastEthernet 0/1

switch(config-if)# port storm-control broadcast threshold rising X falling Y   //Onde


rising X  é o limite superior em pacotes/seg e falling Y é o limite inferior para a porta
retornar ao estado up//

switch(config-if)# port storm-control broadcast action shutdown //Caso atinja o


limite acima  porta ficará shutdown//

switch(config-if)#exit

 18 – Desabilitar Trunk automático no 2950

 switch#config t

Enter configuration commands, one per line.  End with CNTL/Z.

switch(config)#interface fastEthernet 0/1

switch(config-if)#switchport mode access


 19 – Recuperar senha do switch

 1-   Fazer a conexão com o switch através da porta console (9600 bps).

2-   Desconectar o cabo de alimentação do switch.

3-   Pressionar o botão Mode e mantê-lo pressionado enquanto reconecta o cabo de


alimentação do switch. Mantenha o botão Mode pressionado dois segundos após o led
da porta 1X apagar.

4-   Aparecerão as seguintes mensagens:

 The system has been interrupted prior to initializing the flash file system. The
following commands will initialize the flash file system, and finish loading the
operating system software:

 flash_init

load_helper

boot

5-   Inicializar o arquivo Flash do sistema:

 Switch: flash_init

 6-   Carregar arquivos de ajuda:


 Switch: load_helper

 7-   Visualizar o conteúdo da memória Flash:

 Switch: dir flash:

 Note que o arquivo config.text é o arquivo de configuração que contém as definições


sobre a senha.

 8-   Renomear o arquivo de configuração para config.text.old

 Switch: rename flash:config.text flash:config.text.old

 9-   “Bootar” o switch

 Switch: boot

 10- Após a inicialização do switch, aparecerá a seguinte pregunta: Deseja entra no


modo de configuração "diálogo"?

Digite no

 11- No prompt de comando entre no modo privilegiad

  switch> enable
 12- Renomear o arquivo de configuração para o seu nome original (config.text)

 Switch: rename flash:config.text.old flash:config.text

 13- Copiar o arquivo de configuração para a memória:

 Agora a senha já pode ser alterada.

 14-   Entrar no modo de configuração global:

 Switch# config terminal

 15-   Alterar a senha:

 Switch(config)# enable secret *********

 16-   Retornar ao modo privilegiado e gravar as novas configurações:

Switch(config)# exit

Switch# write

 Após estes procedimentos a nova senha já estará incluída no arquivo de configuração


inicial.

Você também pode gostar