---
title: "Configuration initiale switch Cisco"
domain: network
subdomain: switching
type: snippet
tags: [cisco, switch, initial-config, ssh, hardening, ntp, snmp, vty, ios]
difficulty: beginner
status: stable
updated: "2025-05-14"
---
## Séquence de configuration initiale

### Identité et sécurité de base

```text
! -- Identité
hostname {{HOSTNAME}}
enable secret {{ENABLE_SECRET}}
service password-encryption
no ip domain-lookup

! -- Compte local admin avec privilege 15
username admin privilege 15 secret {{ADMIN_SECRET}}
```

### SSH

```text
ip domain-name {{DOMAIN_NAME}}
crypto key generate rsa modulus 2048
ip ssh version 2
ip ssh time-out 60
ip ssh authentication-retries 3
```

### VTY (lignes distantes)

```text
line vty 0 15
 transport input ssh
 login local
 exec-timeout 5 0
 logging synchronous
```

### Console

```text
line con 0
 exec-timeout 5 0
 logging synchronous
```

### Banner

```text
banner motd ^
*******************************************************************************
  ACCES AUTORISE UNIQUEMENT AUX PERSONNES HABILITEES
  Toute connexion non autorisee sera poursuivie.
*******************************************************************************
^
```

### NTP

```text
clock timezone CET 1
ntp server {{NTP_SERVER}}
ntp update-calendar
```

### Syslog

```text
logging host {{SYSLOG_SERVER}}
logging trap informational
logging source-interface vlan {{MGMT_VLAN}}
```

### SNMP

```text
snmp-server community {{COMMUNITY}} RO
snmp-server location {{LOCATION}}
snmp-server contact {{CONTACT_EMAIL}}
```

### VLAN de management et passerelle

```text
interface vlan {{MGMT_VLAN}}
 description MANAGEMENT
 ip address {{MGMT_IP}} {{MASK}}
 no shutdown

ip default-gateway {{GW_IP}}
```

### Sauvegarde

```text
write memory
! ou équivalent :
copy running-config startup-config
```

---

## Checklist de configuration initiale

<Checklist
  storageKey="net-switch-init"
  items={[
    "Hostname configuré",
    "Enable secret configuré",
    "SSH configuré (domaine + clé RSA 2048 + version 2)",
    "VTY restreint à SSH uniquement (transport input ssh)",
    "Console avec exec-timeout",
    "Banner MOTD en place",
    "NTP synchronisé",
    "SNMP configuré",
    "Syslog vers serveur centralisé",
    "VLAN de management avec IP",
    "Default-gateway configuré",
    "write memory effectué"
  ]}
/>

<Tip>
Toujours faire `write memory` avant de couper l'alimentation — la running-config est stockée en RAM et est volatile. Sans sauvegarde, toute la configuration est perdue au redémarrage.
</Tip>
