ciscorouterinitial-config
MDstable
NoteSnippetChecklistPlaybook
Configuration initiale routeur Cisco
Setup routeur : interfaces, SSH, DHCP serveur, IP SLA, object tracking, sauvegarde
snippetbeginner 2025-05-14 3 min read
ciscorouterinitial-configdhcpip-slatrackingiosinterface
Config de base
La séquence hostname / enable secret / SSH / VTY / NTP / syslog est identique à celle du switch.
Voir network/switching/03-switch-init pour le détail complet.
Configuration des interfaces
Interface physique
text
Variables
{{DESCRIPTION}}
{{IP}}
{{MASK}}
interface GigabitEthernet0/0description {{DESCRIPTION}}ip address {{IP}} {{MASK}}no shutdown
Sous-interface (Router-on-a-Stick / ROAS)
text
Variables
{{IP_VLAN10}}
{{MASK}}
{{IP_VLAN20}}
interface GigabitEthernet0/0no shutdowninterface GigabitEthernet0/0.10description VLAN10-DATAencapsulation dot1Q 10ip address {{IP_VLAN10}} {{MASK}}interface GigabitEthernet0/0.20description VLAN20-VOIPencapsulation dot1Q 20ip address {{IP_VLAN20}} {{MASK}}! dot1Q native VLAN (non taggué)interface GigabitEthernet0/0.1encapsulation dot1Q 1 native
Loopback
text
Variables
{{LOOPBACK_IP}}
! Stable pour management SSH et router-id OSPF/BGP — ne tombe jamaisinterface Loopback0description MANAGEMENTip address {{LOOPBACK_IP}} 255.255.255.255
Vérification interfaces
text
show interfacesshow ip interface briefshow interfaces GigabitEthernet0/0show interfaces status
DHCP Serveur
Configuration pool DHCP
text
Variables
{{RANGE_START}}
{{RANGE_END}}
{{POOL_NAME}}
{{NET}}
{{MASK}}
{{GW_IP}}
{{DNS1}}
{{DNS2}}
{{DOMAIN}}
! Exclure IPs fixes (passerelle, serveurs, imprimantes)ip dhcp excluded-address {{RANGE_START}} {{RANGE_END}}ip dhcp pool {{POOL_NAME}}network {{NET}} {{MASK}}default-router {{GW_IP}}dns-server {{DNS1}} {{DNS2}}domain-name {{DOMAIN}}lease 7
DHCP Relay (ip helper-address)
text
Variables
{{CLIENT_INTERFACE}}
{{DHCP_SERVER_IP}}
! Sur l'interface côté clients, relayer vers serveur DHCP distantinterface {{CLIENT_INTERFACE}}ip helper-address {{DHCP_SERVER_IP}}
Vérification DHCP
text
show ip dhcp bindingshow ip dhcp poolshow ip dhcp conflictshow ip dhcp statistics! Supprimer les conflitsclear ip dhcp conflict *
IP SLA + Object Tracking (dual-WAN / failover)
IP SLA — sonde de disponibilité
text
Variables
{{TARGET_IP}}
{{TARGET_URL}}
ip sla 1icmp-echo {{TARGET_IP}} source-interface GigabitEthernet0/0frequency 10ip sla schedule 1 life forever start-time now! Sonde HTTP optionnelleip sla 2http get http://{{TARGET_URL}} source-interface GigabitEthernet0/1frequency 30ip sla schedule 2 life forever start-time now
Object Tracking
text
track 1 ip sla 1 reachabilitydelay down 15 up 10
Floating static route avec tracking
text
Variables
{{GW_WAN1}}
{{GW_WAN2}}
! Route principale (WAN1) — AD 1 (défaut)ip route 0.0.0.0 0.0.0.0 {{GW_WAN1}}! Route de secours (WAN2) — AD 10, active seulement si track 1 est downip route 0.0.0.0 0.0.0.0 {{GW_WAN2}} 10 track 1
Vérification IP SLA et Tracking
text
show ip sla statisticsshow ip sla statistics 1show trackshow track 1show ip route
Sauvegarde configuration
Vers TFTP
text
Variables
{{TFTP_SERVER}}
{{HOSTNAME}}
! Sauvegarder la running-configcopy running-config tftp://{{TFTP_SERVER}}/{{HOSTNAME}}.cfg! Restaurer depuis TFTPcopy tftp://{{TFTP_SERVER}}/backup.cfg running-config
Vers FTP
text
Variables
{{FTP_USER}}
{{FTP_PASS}}
{{FTP_SERVER}}
{{HOSTNAME}}
ip ftp username {{FTP_USER}}ip ftp password {{FTP_PASS}}copy running-config ftp://{{FTP_SERVER}}/{{HOSTNAME}}.cfg
Sauvegarde locale
text
Variables
{{HOSTNAME}}
! Sauvegarder sous un nom alternatif en flashcopy running-config flash:{{HOSTNAME}}-backup.cfgdir flash:
Checklist de configuration routeur
Checklist0/11
💡 Tip —
Toujours configurer une interface Loopback0 pour le management SSH et comme router-id OSPF/BGP. Contrairement aux interfaces physiques, une Loopback ne peut pas tomber (link-down) — elle reste up tant que le routeur fonctionne, garantissant un point d'accès SSH stable même en cas de perte d'un lien physique.
OPS·BRAIN v1.027 notes · Networklocal