# Commandes de base

##### Passer en mode privilégié 

Par défaut, on entre en privilège 1 qui donne accès à des commandes très basiques.

```
switch>show privilege
Current privilege level is 1
switch>
```

Passer en privilège maximum 15 :

```
switch>
switch>enable
switch#sh pri
Current privilege level is 15
switch#
```

##### Passer en mode de configuration et le quitter

```
switch#
switch#configure terminal
switch(config)#
switch(config)#exit
switch#
```

##### Sauvegarder la configuration

```
switch#copy running-config startup-config
```

<p class="callout info">La startup-config se trouve dans la nvram alors que la running-config se trouve dans la ram. En copiant la configuration de la running-config dans la startup-config, on écrit la conf dans la mémoire non volatile.</p>

ou

```
switch#write memory
```

##### Afficher la configuration

```
switch#show running-config
```

##### Redémarrer le switch

```
switch#reload
```

##### Renommer le switch

```
switch#
switch#conf t
switch(config)#hostname Maquette
Maquette(config)#
```

##### Attribuer une adresse IP

```
switch#
switch#conf t
switch(config)#interface vlan1
switch(config-if)#ip address 192.168.1.100 255.255.255.0
switch(config-if)#exit
switch(config)#exit
switch#
```

##### Passerelle par défaut

```
switch(config)#ip default-gateway 192.168.1.1
```

##### Serveur DNS

```
switch(config)#ip name-server 192.168.1.1
```

##### Supprimer la configuration

```
switch#erase startup-config
```

##### Pour compléter automatiquement une commande, utiliser la touche TAB

```
switch(config)#inter
switch(config)#interface
switch(config)#interface gig
switch(config)#interface GigabitEthernet0/0
```

##### Désactiver le DNS lookup pour ne pas attendre lors d'une mauvaise commande

```
switch(config)#no ip domain-lookup
```

##### Supprimer une ligne ou un paramètre

```
switch(config)#no vlan
switch(config)#no ntp server 194.2.0.28
switch(config)#no ip address
```

Ajouter "no" devant la ligne pour l'effacer de la configuration

##### Pour afficher l'aide, utiliser le ? après une commande

```
3750#?
Exec commands:
  access-enable    Create a temporary Access-List entry
  access-template  Create a temporary Access-List entry
  archive          manage archive files
  cd               Change current directory
  clear            Reset functions
  clock            Manage the system clock
  cns              CNS agents
  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
  dot1x            IEEE 802.1X Exec Commands
  enable           Turn on privileged commands
  eou              EAPoUDP
  erase            Erase a filesystem
  ethernet         Ethernet parameters
  exit             Exit from the EXEC
 --More--
```

##### Afficher l'état des interfaces

```
3750#sh ip int brief
Interface              IP-Address      OK? Method Status                Protocol
Vlan1                  172.16.3.200    YES NVRAM  up                    up
FastEthernet1/0/1      unassigned      YES unset  up                    up
FastEthernet1/0/2      unassigned      YES unset  down                  down
FastEthernet1/0/3      unassigned      YES unset  down                  down
FastEthernet1/0/4      unassigned      YES unset  down                  down
FastEthernet1/0/5      unassigned      YES unset  down                  down
FastEthernet1/0/6      unassigned      YES unset  down                  down
FastEthernet1/0/7      unassigned      YES unset  down                  down
FastEthernet1/0/8      unassigned      YES unset  down                  down
FastEthernet1/0/9      unassigned      YES unset  down                  down
FastEthernet1/0/10     unassigned      YES unset  down                  down
FastEthernet1/0/11     unassigned      YES unset  down                  down
FastEthernet1/0/12     unassigned      YES unset  down                  down
FastEthernet1/0/13     unassigned      YES unset  down                  down
FastEthernet1/0/14     unassigned      YES unset  down                  down
FastEthernet1/0/15     unassigned      YES unset  down                  down
FastEthernet1/0/16     unassigned      YES unset  down                  down
FastEthernet1/0/17     unassigned      YES unset  down                  down
FastEthernet1/0/18     unassigned      YES unset  down                  down
FastEthernet1/0/19     unassigned      YES unset  down                  down
FastEthernet1/0/20     unassigned      YES unset  down                  down
FastEthernet1/0/21     unassigned      YES unset  down                  down
FastEthernet1/0/22     unassigned      YES unset  down                  down
FastEthernet1/0/23     unassigned      YES unset  up                    up
FastEthernet1/0/24     unassigned      YES unset  up                    up
GigabitEthernet1/0/1   unassigned      YES unset  down                  down
GigabitEthernet1/0/2   unassigned      YES unset  down                  down
GigabitEthernet1/1/1   unassigned      YES unset  down                  down
GigabitEthernet1/1/2   unassigned      YES unset  down                  down
3750#
```

##### Inventaire

```
Switch#show inventory
NAME: "1", DESCR: "ME-C3750-24TE"
PID: ME-C3750-24TE-M   , VID: V07, SN: FDO1521Y24L

NAME: "GigabitEthernet1/1/1", DESCR: "1000BaseSX SFP"
PID:                     , VID:     , SN: OP10G53E1584

NAME: "GigabitEthernet1/1/2", DESCR: "1000BaseSX SFP"
PID:                     , VID:     , SN: H11S478
```