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/0
description {{DESCRIPTION}}
ip address {{IP}} {{MASK}}
no shutdown

Sous-interface (Router-on-a-Stick / ROAS)

text
Variables
{{IP_VLAN10}}
{{MASK}}
{{IP_VLAN20}}
interface GigabitEthernet0/0
no shutdown
interface GigabitEthernet0/0.10
description VLAN10-DATA
encapsulation dot1Q 10
ip address {{IP_VLAN10}} {{MASK}}
interface GigabitEthernet0/0.20
description VLAN20-VOIP
encapsulation dot1Q 20
ip address {{IP_VLAN20}} {{MASK}}
! dot1Q native VLAN (non taggué)
interface GigabitEthernet0/0.1
encapsulation dot1Q 1 native

Loopback

text
Variables
{{LOOPBACK_IP}}
! Stable pour management SSH et router-id OSPF/BGP — ne tombe jamais
interface Loopback0
description MANAGEMENT
ip address {{LOOPBACK_IP}} 255.255.255.255

Vérification interfaces

text
show interfaces
show ip interface brief
show interfaces GigabitEthernet0/0
show 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 distant
interface {{CLIENT_INTERFACE}}
ip helper-address {{DHCP_SERVER_IP}}

Vérification DHCP

text
show ip dhcp binding
show ip dhcp pool
show ip dhcp conflict
show ip dhcp statistics
! Supprimer les conflits
clear ip dhcp conflict *

IP SLA + Object Tracking (dual-WAN / failover)

IP SLA — sonde de disponibilité

text
Variables
{{TARGET_IP}}
{{TARGET_URL}}
ip sla 1
icmp-echo {{TARGET_IP}} source-interface GigabitEthernet0/0
frequency 10
ip sla schedule 1 life forever start-time now
! Sonde HTTP optionnelle
ip sla 2
http get http://{{TARGET_URL}} source-interface GigabitEthernet0/1
frequency 30
ip sla schedule 2 life forever start-time now

Object Tracking

text
track 1 ip sla 1 reachability
delay 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 down
ip route 0.0.0.0 0.0.0.0 {{GW_WAN2}} 10 track 1

Vérification IP SLA et Tracking

text
show ip sla statistics
show ip sla statistics 1
show track
show track 1
show ip route

Sauvegarde configuration

Vers TFTP

text
Variables
{{TFTP_SERVER}}
{{HOSTNAME}}
! Sauvegarder la running-config
copy running-config tftp://{{TFTP_SERVER}}/{{HOSTNAME}}.cfg
! Restaurer depuis TFTP
copy 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 flash
copy running-config flash:{{HOSTNAME}}-backup.cfg
dir 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