MDstable
NoteSnippetChecklistPlaybook

Configuration initiale switch Cisco

Setup complet : hostname, SSH, VTY, enable secret, NTP, SNMP, syslog, hardening

snippetbeginner 2025-05-14 2 min read
ciscoswitchinitial-configsshhardeningntpsnmpvtyios

Séquence de configuration initiale

Identité et sécurité de base

text
Variables
{{HOSTNAME}}
{{ENABLE_SECRET}}
{{ADMIN_SECRET}}
! -- 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
Variables
{{DOMAIN_NAME}}
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
Variables
{{NTP_SERVER}}
clock timezone CET 1
ntp server {{NTP_SERVER}}
ntp update-calendar

Syslog

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

SNMP

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

VLAN de management et passerelle

text
Variables
{{MGMT_VLAN}}
{{MGMT_IP}}
{{MASK}}
{{GW_IP}}
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

Checklist0/12
💡 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.

OPS·BRAIN v1.027 notes · Networklocal