Commandes initiales pour configurer un switch cisco ou le manager
I Première connexion
Pour connaitre les commandes ou sous commandes/paramètres il faut utiliser le « ? ». Exemple à la première connexion sur un switch :
Switch>?
Exec commands:
connect Open a terminal connection
disable Turn off privileged commands
disconnect Disconnect an existing network connection
enable Turn on privileged commands
exit Exit from the EXEC
logout Exit from the EXEC
ping Send echo messages
resume Resume an active network connection
show Show running system information
telnet Open a telnet connection
terminal Set terminal line parameters
traceroute Trace route to destination
Ainsi pour connaitre les possibilités de la commande show :
Switch>show ?
arp Arp table
cdp CDP information
clock Display the system clock
crypto Encryption module
dtp DTP information
etherchannel EtherChannel information
flash: display information about flash: file system
history Display the session command history
interfaces Interface status and configuration
ip IP information
lldp LLDP information
mac MAC configuration
mac-address-table MAC forwarding table
...
Et ainsi de suite : show vlan …
Switch>show vlan ?
brief VTP all VLAN status in brief
id VTP VLAN status by VLAN id
name VTP VLAN status by VLAN name
<cr>
Ce qui donne au passage :
Switch>show vlan brief
VLAN Name Status Ports
---- -------------------------------- --------- -------------------------------
1 default active Fa0/1, Fa0/2, Fa0/3, Fa0/4
Fa0/5, Fa0/6, Fa0/7, Fa0/8
Fa0/9, Fa0/10, Fa0/11, Fa0/12
Fa0/13, Fa0/14, Fa0/15, Fa0/16
Fa0/17, Fa0/18, Fa0/19, Fa0/20
Fa0/21, Fa0/22, Fa0/23, Fa0/24
Gig0/1, Gig0/2
1002 fddi-default active
1003 token-ring-default active
1004 fddinet-default active
1005 trnet-default active
II Première modification d’un switch : changement du nom du switch
Au démarrage, les commandes disponibles ne permettent pas de modifier les caractéristiques du switch. Pour cela il faut passer dans un mode qui donne plus de privilèges. Ainsi il faut utiliser la commande « enable » :
Switch>enable
Switch#?
Exec commands:
clear Reset functions
clock Manage the system clock
configure Enter configuration mode
connect Open a terminal connection
copy Copy from one file to another
debug Debugging functions (see also 'undebug')
delete Delete a file
dir List files on a filesystem
disable Turn off privileged commands
disconnect Disconnect an existing network connection
enable Turn on privileged commands
erase Erase a filesystem
exit Exit from the EXEC
logout Exit from the EXEC
more Display the contents of a file
no Disable debugging informations
ping Send echo messages
reload Halt and perform a cold restart
resume Resume an active network connection
setup Run the SETUP command facility
show Show running system information
--More--
Un « # » s’est ajouté au nom du swicth. Cela indique que les commandes « à privilèges » sont disponibles.
Nous allons maintenant modifier le nom du Switch. Pour cela il faut entrer dans le mode « config terminal » : configure terminal
Switch#configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
Switch(config)#
Il est possible d’utiliser un raccourci : conf t
Switch#conf t
Enter configuration commands, one per line. End with CNTL/Z.
Switch(config)#
Et dans ce mode, pour connaitre les commandes disponibles il faut toujours utiliser « ? » :
Switch(config)#?
Configure commands:
access-list Add an access list entry
banner Define a login banner
boot Boot Commands
cdp Global CDP configuration subcommands
clock Configure time-of-day clock
crypto Encryption module
default Set a command to its defaults
do To run exec commands in config mode
enable Modify enable password parameters
end Exit from configure mode
exit Exit from configure mode
hostname Set system's network name
interface Select an interface to configure
ip Global IP configuration subcommands
line Configure a terminal line
lldp Global LLDP configuration subcommands
logging Modify message logging facilities
mac MAC configuration
mac-address-table Configure the MAC address table
mls mls global commands
monitor SPAN information and configuration
--More--
Dans notre cas nous allons utiliser la commande hostname :
Switch(config)#hostname ?
WORD This system's network name
Switch(config)#hostname Mon_Switch0
Mon_Switch0(config)#
On remarque que le nom du switch « Switch » a bien changé en « Mon_Switch0 ».
Pour sortir du mode « config » il faut taper « end » ou « exit » :
Mon_Switch0(config)#end
Mon_Switch0#
%SYS-5-CONFIG_I: Configured from console by console
Mon_Switch0#
A ce stade nous sommes revenus au mode principal.
III Sauvegarde et redémarrage
Mais attention car le switch est bien configuré mais pas sauvegardé. Au prochain démarrage les modification seront donc perdues. Nous allons donc sauvegarder la configuration par la commande « write » ou « w » :
Mon_Switch0#write
Building configuration...
[OK]
Mon_Switch0#
Pour tester on va redémarrer le switch : « reload »
Mon_Switch0#reload
Proceed with reload? [confirm]
C2960 Boot Loader (C2960-HBOOT-M) Version 12.2(25r)FX, RELEASE SOFTWARE (fc4)
Cisco WS-C2960-24TT (RC32300) processor (revision C0) with 21039K bytes of memory.
2960-24TT starting...
Base ethernet MAC Address: 00D0.BCA9.8493
Xmodem file system is available.
Initializing Flash...
flashfs[0]: 2 files, 0 directories
flashfs[0]: 0 orphaned files, 0 orphaned directories
flashfs[0]: Total bytes: 64016384
flashfs[0]: Bytes used: 4416006
flashfs[0]: Bytes available: 59600378
flashfs[0]: flashfs fsck took 1 seconds.
...done Initializing Flash.
Boot Sector Filesystem (bs:) installed, fsid: 3
Parameter Block Filesystem (pb:) installed, fsid: 4
Loading "flash:/c2960-lanbase-mz.122-25.FX.bin"...
###########################################
Ainsi au redémarrage nous voyons bien que nos modifications sont bien présentes :
Press RETURN to get started!
Mon_Switch0>
IV Réinitialiser la configuration du switch
En mode privilège, il faut utiliser la commande « erase » :
Mon_Switch0#erase startup-config
Erasing the nvram filesystem will remove all configuration files! Continue? [confirm]
[OK]
Erase of nvram: complete
%SYS-7-NV_BLOCK_INIT: Initialized the geometry of nvram
Mon_Switch0#
Ensuite, on redémarre le switch :
Mon_Switch0#reload
Proceed with reload? [confirm]
C2960 Boot Loader (C2960-HBOOT-M) Version 12.2(25r)FX, RELEASE SOFTWARE (fc4)
Cisco WS-C2960-24TT (RC32300) processor (revision C0) with 21039K bytes of memory.
2960-24TT starting...
Base ethernet MAC Address: 00D0.BCA9.8493
Xmodem file system is available.
Initializing Flash...
flashfs[0]: 2 files, 0 directories
flashfs[0]: 0 orphaned files, 0 orphaned directories
flashfs[0]: Total bytes: 64016384
flashfs[0]: Bytes used: 4415537
flashfs[0]: Bytes available: 59600847
flashfs[0]: flashfs fsck took 1 seconds.
...done Initializing Flash.
Boot Sector Filesystem (bs:) installed, fsid: 3
Parameter Block Filesystem (pb:) installed, fsid: 4
Loading "flash:/c2960-lanbase-mz.122-25.FX.bin"...
########################################################################## [OK]
Ainsi à l’invite :
Press RETURN to get started!
Switch>
Le nom du switch a repris sa valeur par défaut dans notre cas. Il restera néanmoins la définition des vlan (fichier vlan.dat) qui reste. Il faudra l’effacer manuellement.