Commandes Cisco CCNA Exploration (Revisité)
Table des matières Introduction 1 Routeu Routeurs rs et protoco protocoles les 1.1 Routag Routagee statiq statique ue . . 1.2 1.2 RIPv RIPv11 et RIPv RIPv22 . . 1.3 1.3 EIGR EIGRP P . . . . . . . 1.4 1.4 OSPF OSPF . . . . . . . . 1.4. 1.4.11 En IPV6 IPV6 . . .
3 de . . . . . . . . . .
routag routage e . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . .
. . . . .
. . . . .
. . . . .
2 Commutateu Commutateurs rs et Comm Commutatio utation n 2.1 Configuratio Configuration n de base d’un commutateu commutateurr 2.2 Agréga Agrégatio tion n de de lien lienss . . . . . . . . . . . . . 2.3 Réseau Réseaux x locaux locaux virtu virtuels els VLAN VLANss . . . . . . 2.4 VLAN Trunking runking Protocol Protocol VTP VTP . . . . . . 2.5 Spanning Spanning Tree Protocol Protocol STP STP . . . . . . . 2.6 Routag Routagee inter inter-vl -vlan an . . . . . . . . . . . . .
. . . . . . . . . . .
. . . . . . . . . . .
. . . . . . . . . . .
. . . . . . . . . . .
. . . . . . . . . . .
. . . . . . . . . . .
. . . . . . . . . . .
. . . . . . . . . . .
. . . . . . . . . . .
. . . . . . . . . . .
. . . . . . . . . . .
. . . . . . . . . . .
. . . . . . . . . . .
. . . . . . . . . . .
. . . . . . . . . . .
. . . . . . . . . . .
. . . . . . . . . . .
. . . . . . . . . . .
. . . . . . . . . . .
3 Réseau Réseaux x étendus étendus WAN WAN 3.1 Point-to-P Point-to-Point oint Protocol Protocol PPP . . . . . . . . . . . . . . . . . . . . . . . . . . 3.2 Frame rame Relay Relay . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3.3 Sécuri Sécurité té du réseau réseau . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3.3.1 Sécurisatio Sécurisation n générale générale du routeur routeur . . . . . . . . . . . . . . . . . . . . 3.3.2 Authentifi Authentification cation des protocoles protocoles de routage routage . . . . . . . . . . . . . . . 3.3.3 Cisco SDM et Simple Simple Netw Network ork Managem Management ent Protocol Protocol SNMP . . . . 3.4 Récupération Récupération après la perte de mots mots de passe passe et d’IOS d’IOS . . . . . . . . . . . . 3.4.1 Récupératio Récupération n après après la perte perte de mots mots de passe passe sur sur un routeur routeur . . . . 3.4.2 3.4 .2 Récupér Récupérati ation on d’IOS d’IOS sur sur un rout routeur eur . . . . . . . . . . . . . . . . . . . 3.4.3 Récupératio Récupération n après la la perte de mots mots de passe passe sur un commu commutateur tateur . 3.4.4 Récupératio Récupération n d’IOS d’IOS sur un commu commutateur tateur . . . . . . . . . . . . . . . 3.5 Liste de Contr Contrôle ôle d’Accès d’Accès ACL . . . . . . . . . . . . . . . . . . . . . . . . . 3.5.1 3.5 .1 ACL ACL standa standard rd . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3.5. 3.5.22 ACL éten étendu duee . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3.5.3 3.5 .3 ACL ACL dynami dynamique que . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3.5.4 3.5 .4 ACL ACL réflexi réflexive ve . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3.5.5 3.5 .5 ACL ACL basé baséee sur sur le temps temps . . . . . . . . . . . . . . . . . . . . . . . . . 3.5.6 Context Context Based Access Access Contr Control ol (CBAC (CBAC)) . . . . . . . . . . . . . . . . 3.6 Réseau Réseaux x privé privéss virtue virtuels ls VPN VPN . . . . . . . . . . . . . . . . . . . . . . . . . .
K. CLEMENT - F. Rico
15 janvier 2016
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . .
4 4 5 5 6 7
. . . . . .
7 7 9 9 11 11 11
. . . . . . . . . . . . . . . . . . .
12 12 13 13 13 15 16 16 16 17 17 17 18 18 19 19 19 20 20 20
1
3.7 Servic Services es d’ad d’adres ressag sagee IP . . . . . . . 3.7.1 3.7 .1 Protoco Protocole le DHCP DHCP . . . . . . 3.7.2 Evolutivit Evolutivitéé des des réseaux réseaux avec avec 3.8 Adres Adressag sagee IPv6 IPv6 . . . . . . . . . . .
K. CLEMENT - F. Rico
. . . . . . . . NA NAT . . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
15 janvier 2016
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
20 20 22 23
2
Introduction Cette documentation regroupe toutes les commandes utilisées sur les routeurs et commutateurs CISCO et vues dans les cours du CCNA Exploration. En introduction seront présentées les commandes permettant de configurer les bases du routeur et du commutateur tels que nom de l’équipement, mots de passe, bannière, commandes de sauvegarde, de visualisation et configuration basique d’interfaces. Par la suite, les commandes spécifiques aux routeurs et aux commutateurs seront présentées respectivement dans les prochaines sections. Convention d’écriture : italics
[X ] | X|Y] [X|Y] {X|Y} {X| Y}
indique indique indi indiqu quee indique indiqu indiquee
des arguments arguments dans lesquels l’utilisateur fournit des valeurs valeurs un élément facultatif un choi choix x facu facult ltat atif if ou obli obliga gato toir iree un choix facultatif un choix choix obliga obligatoi toire re
Commandes pour changer de mode d’exécution et de configuration : Router> Router> enable enable Router# Router# configure configure terminal terminal Router(config)# Rout Router er(c (con onfi fig) g)# # exit exit | end end | ˆC | ˆZ Router# Router# disable disable Router> Router Router# #?
Outils de diagnostic : Router# Router# ping ip-address Router# Router# tracerout traceroute e ip-address
Visualisation de l’état de l’équipement : Router# Router# Router# Router# Router# Router# Router# Router# Switch# Switch# Switch# Switch#
show version version show flash show memory show interface interfaces s show history history terminal terminal history history {size {size number }
Visualisat Visualisation ion et sauvegard sauvegardee de la configurati configuration on : Router# Router# Router# Router# Router# Router# Router# Router# Switch# Switch# Switch# Switch#
show show copy copy copy copy
running-c running-config onfig startup-c startup-config onfig running-c running-config onfig startup-c startup-config onfig running-c running-config onfig tftp: tftp: system:ru system:running nning-conf -config ig tftp:[[[// tftp:[[[//location ]/directory ]/filename ] nvram:sta nvram:startuprtup-confi config g tftp:[[[ tftp:[[[// // location ]/directory ]/filename ]
Suppressio Suppression n du fichier fichier de configurati configuration on : Router# erase nvram:startup-config nvram:startup-config Router# Router# erase startup-co startup-config nfig
K. CLEMENT - F. Rico
15 janvier 2016
3
Configuration de base d’un équipement CISCO : Router(config)# Router(co Router(config) nfig)# # Router(co Router(config) nfig)# # Router(co Router(config) nfig)# # Router(co Router(config) nfig)# #
hostname router-name enable enable password password password enable enable secret secret password banner banner motd # message # banner banner login login # message #
Configuration de la console et du terminal virtuel : Router(co Router(config) nfig)# # line console console 0 Router(config-line)# Router(config-line)# password password Router(config-line)# Router(config-line)# login Router(config-line)# Router(config-line)# logging synchronous Router Router(co (confi nfig)# g)# line line vty 0 4 Switch Switch(co (confi nfig)# g)# line line vty 0 15 Router(config-line)# Router(config-line)# password password Router(config-line)# Router(config-line)# login Router(config)# service password-encryption password-encryption
1
Rout Routeu eurs rs et et prot protoco ocole less de rou routa tage ge
Configuration des interfaces sur un routeur : type port Router(config)# interface type Router(co Router(confignfig-if)# if)# ip address address ip-address subnet-mask Router(config-if)# Router(config-if)# description description Router(co Router(confignfig-if)# if)# clock rate rate Router(co Router(confignfig-if)# if)# no shutdown shutdown Router(config-if)# Router(config-if)# exit Router Router# # show show ip interf interface ace brief brief Router Router# # show show ip interf interface ace
1.1 1.1
Rout Routag age e stat statiq ique ue
Cisco Discovery Protocol (CDP) : Router# Router# show cdp neighbors neighbors Router Router# # show show cdp neighb neighbors ors detail detail Router(co Router(config) nfig)# # no cdp run Router(co Router(confignfig-if)# if)# no cdp enable enable
Configuration de routes statiques et route statique par défaut : prefix mask {ip-address | interface-type interface-type interface-number Router(co Router(config) nfig)# # ip route prefix [ip-address ]} [distance ] [name ] [permanen [permanent] t] [tag tag ] network-address subnet-mask {ip-address | Router(co Router(config) nfig)# # ip route network-address exit-interface } Router(co Router(config) nfig)# # ip route 0.0.0.0 0.0.0.0 [ exit-interface | ip-address ]
K. CLEMENT - F. Rico
15 janvier 2016
4
Commandes de visualisation et de dépannage pour le routage, valable pour tous les protocoles de routage : Router# Router# Router# Router# Router Router# # Router Router# # Router# Router# Router Router# # Router Router# # Router# Router# Router# Router#
1.2 1.2
ping ip-address tracerout traceroute e ip-address show show ip route route show show ip interf interface ace brief brief show running-c running-config onfig show show cdp neighb neighbors ors detail detail debug debug ip routin routing g undebug undebug ip routing routing undebug undebug all
RIPv RIPv1 1 et RIPv RIPv2 2
Configuration de RIPv1 : Router(co Router(config) nfig)# # router router Router(co Router(confignfig-route router)# r)# Router(config-router)# Router(config-router)# Router(config-router)# Router(config-router)#
rip version version 1 directly-connected-classful-address dress network directly-connected-classful-ad interface-number passive-interface passive-interface interface-type interface-number
Configuration de RIPv2 : Router(co Router(config) nfig)# # router router Router(co Router(confignfig-route router)# r)# Router(config-router)# Router(config-router)# Router(config-router)# Router(config-router)# Router(config-router)# Router(config-router)#
rip version version 2 directly-connected-classful-address dress network directly-connected-classful-ad interface-number passive-interface passive-interface interface-type interface-number no auto-summary
Redistribution de route statique et propagation de la route par défaut : Router(config-router)# Router(config-router)# redistribute static Router(config-router)# Router(config-router)# default-information default-information originate
Dépannage de RIP : Router Router# # Router Router# # Router Router# # Router Router# #
show show ip route route show show ip rip databa database se show show ip protoc protocols ols debug debug ip rip
Comportement du routage par classe et sans classe : Router(co Router(confi)# nfi)# ip classless classless Router(co Router(confi)# nfi)# no ip classless classless
1.3
EIGRP
Configuration d’EIGRP : Router(co Router(config) nfig)# # router router Router(config-router)# Router(config-router)# Router(config-router)# Router(config-router)# Router(config-router)# Router(config-router)#
K. CLEMENT - F. Rico
eigrp eigrp autonomous-system network network-address [wildcard-mask ] interface-number passive-interface passive-interface interface-type interface-number no auto-summary
15 janvier 2016
5
Propagation de la route par défaut et résumé de réseaux : Router(co Router(config) nfig)# # ip route 0.0.0.0 0.0.0.0 [ exit-interface | ip-address ] Router(config-router)# Router(config-router)# redistribute static Router(config)# ip default-network network-address as-number network-address network-address subnet-mask Router(co Router(confignfig-if)# if)# ip summary-ad summary-address dress eigrp eigrp as-number
Configuration de bande passante et autres caractéristiques pour le calcul de la métrique d’EIGRP : Router(config-router)# Router(config-router)# metric weights tos k1 k2 k3 k4 k5 Router(config-if)# Router(config-if)# bandwidth bw-kbps as-number percent Router(co Router(confignfig-if)# if)# ip bandwidthbandwidth-perce percent nt eigrp as-number interface-number Router# Router# show interface interface interface-type interface-number as-number seconds Router(co Router(confignfig-if)# if)# ip hello-inte hello-interval rval eigrp as-number as-number seconds Router(co Router(confignfig-if)# if)# ip hold-time hold-time eigrp as-number
Visualisat Visualisation ion et dépannage dépannage d’EIGRP : Router Router# # Router Router# # Router Router# # Router Router# # Router# Router# Router Router# # Router Router# #
1.4
show show ip eigrp eigrp neighb neighbors ors show show ip eigrp eigrp topolo topology gy [network | all-link all-links] s] show show ip route route show show ip interf interface ace brief brief interface-number show interface interface interface-type interface-number show show ip protoc protocols ols debug debug eigrp eigrp fsm
OSPF
Configuration d’OSPF : Router(co Router(config) nfig)# # router router ospf process-id network-address wildcard-mask area area-id Router(config-router)# Router(config-router)# network network-address interface-number Router(config-router)# Router(config-router)# passive-interface passive-interface interface-type interface-number
Configuration de l’ID du routeur en configurant une interface de bouclage (Loopback) ou avec la commande router-id : Router(config-router)# Router(config-router)# router-id ip-address Router(co Router(confignfig-if)#i if)#ip p ospf priority priority { 0 – 255 } loopback number number Router(config)#interface loopback ip-address subnet-mask Router(config-if)#ip Router(config-if)#ip address ip-address Router#cl Router#clear ear ip ospf process process
Configuration de la bande passante ou du coût pour le calcul de la métrique d’OSPF : Router(config-router)# Router(config-router)# auto-cost reference-bandwidth reference-bandwidth value-mbps Router(config-if)# Router(config-if)# bandwidth bw-kbps Router(co Router(confignfig-if)# if)# ip ospf cost cost interface-number Router# Router# show interface interface interface-type interface-number Router(co Router(confignfig-if)# if)# ip ospf hello-inte hello-interval rval seconds Router(co Router(confignfig-if)# if)# ip ospf dead-inter dead-interval val seconds
Propagation de la route par défaut : Router(co Router(config) nfig)# # ip route 0.0.0.0 0.0.0.0 [ exit-interface | ip-address ] Router(config-router)# Router(config-router)# default-information default-information originate
K. CLEMENT - F. Rico
15 janvier 2016
6
Visualisat Visualisation ion et dépannage dépannage d’OSPF : Router Router# # Router Router# # Router Router# # Router Router# # Router# Router# Router Router# #
1.4. 1.4.1 1
show show show show show show show show show show show
ip route route ip interf interface ace brief brief interface-type interface-number interface-number ] ip ospf ospf [inter [interfac face e interface-type ip ospf ospf neighb neighbor or interface-number interface interface interface-type interface-number ip protoc protocols ols
En IPV6 IPV6
En IPV6 il y a quelques différences, il faut activer le routage ipv6 Router(config)# ipv6 unicast-routing
La commande de configuration est différente : num. de processus processus Router(co Router(config) nfig)# # ipv6 router router ospf num. Router(co Router(confignfig-rtr)# rtr)# !! il faut un identifian identifiant t Router(config-rtr)# Router(config-rtr)# router-id addresseIPV4 numero Router(config-rtr)# Router(config-rtr)# passive-interface passive-interface type numero
Il n’y a pas de network network ..., on déclare chaque interface dans sa configuration numero Router(config)# interface type numero Router(co Router(confignfig-if)# if)# ipv6 ospf num area numarea
2 2.1
Comm Commutate utateurs urs et Comm Commutatio utation n Configu Configurat ration ion de base base d’un d’un comm commutateu utateur r
Configuration de l’interface de gestion sur un commutateur : Switch(co Switch(config) nfig)# # interface interface vlan vlan-id Switch(co Switch(confignfig-if)# if)# ip address address ip-address subnet-mask Switch(co Switch(confignfig-if)# if)# no shutdown shutdown Switch(config-if)# Switch(config-if)# exit type port Switch(config)# interface type port - port Switch(co Switch(config) nfig)# # interface interface range range type port Switch(co Switch(confignfig-if)# if)# switchport switchport mode access access Switch(co Switch(confignfig-if)# if)# switchport switchport access access vlan vlan-id Switch(config-if)# Switch(config-if)# end Switch(config)# ip default-gateway ip-address Switch Switch# # show show ip interf interface ace brief brief Switch Switch# # show show ip interf interface ace
Configuration d’options sur un port du commutateur : Switch Switch(co (confi nfig-i g-if)# f)# duplex duplex {auto {auto | full full | half} half} Switch(co Switch(confignfig-if)# if)# speed {auto {auto | value-bps } Switch(co Switch(confignfig-if)# if)# mdix auto
Possibilité d’activer l’interface web pour la configuration du commutateur : Switch(co Switch(config) nfig)# # ip http authentica authentication tion enable enable Switch(co Switch(config) nfig)# # ip http server server
K. CLEMENT - F. Rico
15 janvier 2016
7
Gestion de la table d’adresse MAC du commutateur : Switch# Switch# show mac address-t address-table able Switch(co Switch(config) nfig)# # mac address-t address-table able static static MAC-address vlan vlan {1-4096 | ALL} ALL} interf interface ace interface-id
Configuration de la sécurité sur les commutateurs. La configuration de Secure Shell SSH est traitée dans la prochaine section. Configuration de la surveillance DHCP : Switch(co Switch(config) nfig)# # ip dhcp snooping snooping Switch(co Switch(config) nfig)# # ip dhcp snooping snooping vlan number [number ] Switch(co Switch(confignfig-if)# if)# ip dhcp snooping snooping trust trust Switch(co Switch(confignfig-if)# if)# ip dhcp snooping snooping limit limit rate value Switch Switch# # show show ip dhcp dhcp snoopi snooping ng
K. CLEMENT - F. Rico
15 janvier 2016
8
Configuration de la sécurité des ports : Switch(config-if)# Switch(config-if)# switchport port-security Switch(config-if)# Switch(config-if)# switchport port-security maximum number Switch(config-if)# Switch(config-if)# switchport port-security mac-address mac-address Switch(co Switch(confignfig-if)# if)# switchport switchport port-secu port-security rity mac-addre mac-address ss sticky sticky [ mac-address ] Switch(co Switch(confignfig-if)# if)# switchport switchport port-secu port-security rity violation violation {shutdown {shutdown | restrict restrict | protect} Switch# Switch# show port-secu port-security rity [interface [interface interface-id ] Switch# Switch# show port-secu port-security rity address address
2.2 2.2
Agré Agréga gati tion on de lien lienss
L’agrégation permet de répartir la charge sur plusieurs liens. — PAgP (prop. Cisco) : Protocol Agrégation Agrégation Port, modes compatibles desirable+desirable ou ou desirable+auto. — LACP LACP (ouvert) : Link Agregation Agregation Protocol, active+passive ou ou active+active . — Choisir Choisir la méthode de répartition répartition Switch(config)# port-channel load-balance [dst-ip|dst-mac|src-dst-ip|src-dst-mac|src-ip|src-mac]
— Configurer Configurer les ports (sur les 2 commutate commutateurs) urs) ! on peut peut faire faire une configur configuratio ation n par lot Switch(confi Switch(config)# g)# interface range fa0/1 - 4 Switch(config-if-range)# channel-group 1-6 mode (on|active|passive|desirable|a uto) Switch(config-if-range)# exit
— La commande précedante précedante crée une interfac interfacee « port-channe port-channell » qu’il faut configurer Switch(co Switch(config) nfig)# # interfac interface e port-chan port-channel nel 1 Switch(co Switch(confignfig-if)# if)# descriptio description n liaison liaison agrégée agrégée vers ... Switch(config-if)# Switch(config-if)# ...
— Vérificatio Vérification n de la configuration configuration !!! afficher afficher Switch# Switch# show !!! afficher afficher Switch# Switch# show !!! afficher afficher Switch# show
2.3
les infos de l’interfa l’interface ce virtuelle virtuelle Port-channel Port-channel interface interface Port-chan Port-channel nel les interfaces interfaces physiques physiques utilisant utilisant etherchann etherchannel el interface interfaces s ethercha etherchannel nnel des informatio informations ns sur etherchan etherchannel nel etherchannel [summary|port-channel] [summary|port-channel]
Résea Réseaux ux locau locaux x virtu virtuel elss VLAN VLANss
Configuration de VLANs : Switch(config)# vlan vlan-id Switch(config-vlan)# Switch(config-vlan)# name vlan-name Switch Switch# # show show vlan vlan [brief [brief | id vlan-id | name name vlan-name | summary] summary] Switch Switch# # show show interf interface aces s [ interface-id | vlan vlan vlan-id ] | switch switchpor port t Switch# Switch# delete delete flash:vla flash:vlan.dat n.dat
Configuration de base de VLANs avec VLAN VoIP :
K. CLEMENT - F. Rico
15 janvier 2016
9
type port Switch(config)# interface type Switch(co Switch(confignfig-if)# if)# switchport switchport mode access access Switch(co Switch(confignfig-if)# if)# switchport switchport access access vlan vlan-id Switch(co Switch(confignfig-if)# if)# mls qos trust cos Switch(co Switch(confignfig-if)# if)# switchport switchport voice voice vlan voice-vlan-id
Configuration l’agrégation de VLANs (Trunk) : type port Switch(config)# interface type Switch(co Switch(confignfig-if)# if)# switchport switchport mode trunk Switch(co Switch(confignfig-if)# if)# switchport switchport trunk trunk native native vlan vlan-id Switch(co Switch(confignfig-if)# if)# switchport switchport trunk trunk allowed allowed vlan vlan-id [,vlan-id ,vlan-id ...] Switch(co Switch(confignfig-if)# if)# switchport switchport trunk trunk allowed allowed vlan add vlan-id Switch# Switch# show interface interfaces s id-interface switchport Switch# Switch# show interface interfaces s trunk
Dynamic Trunking Protocol DTP : type port Switch(config)# interface type Switch(co Switch(confignfig-if)# if)# switchport switchport mode access access Switch(co Switch(confignfig-if)# if)# switchport switchport mode trunk Switch(co Switch(confignfig-if)# if)# switchport switchport mode dynamic dynamic auto Switch(co Switch(confignfig-if)# if)# switchport switchport mode dynamic dynamic desirable desirable Switch(config-if)# Switch(config-if)# switchport nonegociate port Switch# Switch# show dtp interface interface type port
K. CLEMENT - F. Rico
15 janvier 2016
10
2.4
VLAN VLAN Trun Trunkin king g Protoc Protocol ol VTP VTP
Configuration de VTP : Switch Switch(co (confi nfig)# g)# vtp mode mode {serve {server r | client client | transp transpare arent nt } Switch(co Switch(config) nfig)# # vtp domain domain domain-name Switch(co Switch(config) nfig)# # vtp password password password Switch Switch(co (confi nfig)# g)# vtp versio version n {1 | 2} Switch(co Switch(config) nfig)# # vtp pruning pruning Switch Switch# # show show vtp status status Switch Switch# # show show vtp counte counters rs Switch# Switch# show interface interfaces s trunk
2.5
Spanni Spanning ng Tree Tree Protoco Protocoll STP STP
Configuration de la sélection du pont racine et des ports racines, désignés et non-désignés : Switch(config)# spanning-tree vlan vlan-id root primary primary Switch(config)# spanning-tree vlan vlan-id root secondary secondary Switch(config)# spanning-tree vlan vlan-id priority value Switch(config-if)# Switch(config-if)# spanning-tree cost value Switch(config-if)# Switch(config-if)# spanning-tree port-priority value Switch# Switch# show spanning-tree spanning-tree [detail | active] active]
Configuration de quelques paramètres de SPT : Switch(config)# spanning-tree vlan vlan-id root primary primary diameter diameter value Switch(config-if)# Switch(config-if)# spanning-tree portfast
Configuration de Rapid-PVST+ : Switch(co Switch(config) nfig)# # spanning-t spanning-tree ree mode rapid-pvst rapid-pvst type port Switch(config)# interface type Switch(config-if)# Switch(config-if)# spanning-tree link-type point-to-point Switch(config-if)# Switch(config-if)# end Switch# Switch# clear spanning-t spanning-tree ree detecteddetected-proto protocols cols
2.6
Routag Routage e inter inter-vl -vlan an
Configuration de sous-interfaces sur un Router-on-a-stick : interface-number Router(config)# interface type interface-number Router(co Router(confignfig-if)# if)# no shutdown shutdown interface-number.subinterface-number -number Router(config-if)# Router(config-if)# interface type interface-number.subinterface Router(config-subif)# Router(config-subif)# encapsulation dot1q vlan-id ip-address subnet-mask Router(co Router(confignfig-subif subif)# )# ip address address ip-address
K. CLEMENT - F. Rico
15 janvier 2016
11
3 3.1
Rése Réseau aux x éte étend ndus us WAN Point-t oint-to-P o-Poin ointt Protoco Protocoll PPP PPP
Activation du protocole hdlc sur une interface série : Router(config-if)# Router(config-if)# encapsulation hdlc
Activation du protocole ppp sur une interface série : Router(config-if)# Router(config-if)# encapsulation ppp Router(co Router(confignfig-if)# if)# compress compress [predicto [predictor r | stac] stac] Router(co Router(confignfig-if)# if)# ppp quality quality percentage
Fonctio onction n de rappel rappel PPP (A quoi quoi cela sert-il sert-il ? ? ?) : # ppp callba callback ck [accep [accept t | reques request] t]
Protocole d’authentification du mot de pass PAP et CHAP : Router Router(co (confi nfig-i g-if)# f)# ppp authen authentic ticati ation on {chap {chap | chap chap pap | pap chap chap | pap} pap} [if-neede [if-needed] d] [list-nam [list-name e | default] default] [callin] [callin] Router(config)# username name password password Router(co Router(confignfig-if)# if)# ppp pap sent-usern sent-username ame name password password
Exemple de configuration de PAP entre deux routeurs R1 et R2 : R1(config)# username User2 password User2-password R1(config R1(config-if)# -if)# encapsula encapsulation tion ppp R1(config R1(config-if)# -if)# ppp authentica authentication tion pap R1(config R1(config-if)# -if)# ppp pap sent-user sent-username name User1 password User1-password R2(config)# username User1 password User1-password R2(config R2(config-if)# -if)# encapsula encapsulation tion ppp R2(config R2(config-if)# -if)# ppp authentica authentication tion pap R2(config R2(config-if)# -if)# ppp pap sent-user sent-username name User2 password User2-password
Même exemple mais en utilisant CHAP : R1(config)# username User2 password User2-password R1(config R1(config-if)# -if)# encapsula encapsulation tion ppp R1(config R1(config-if)# -if)# ppp authentica authentication tion chap R1(config R1(config-if)# -if)# ppp chap hostname hostname User1 R1(config R1(config-if)# -if)# ppp chap password password User1-password R2(config)# username User1 password User1-password R2(config R2(config-if)# -if)# encapsula encapsulation tion ppp R2(config R2(config-if)# -if)# ppp authentica authentication tion chap R2(config R2(config-if)# -if)# ppp chap hostname hostname User2 R2(config R2(config-if)# -if)# ppp chap password password User2-password
Visualisation et dépannage d’une interface série : Router# Router# show interface interfaces s serial serial interface-number Router# Router# show controlle controllers rs Router Router# # debug debug ppp {packe {packet t | negoti negotiati ation on | error error | authen authentif tifica icatio tion n | compre compressi ssion on | cbcp}
K. CLEMENT - F. Rico
15 janvier 2016
12
3.2 3.2
Frame rame Rela Relay y
Configuration de Frame Relay avec mappage statique : Router(co Router(confignfig-if)# if)# encapsulat encapsulation ion frame-rel frame-relay ay [cisco [cisco | ietf] ietf] Router(config-if)# Router(config-if)# bandwidth bw-kbps Router(co Router(confignfig-if)# if)# no frame-rela frame-relay y inverseinverse-arp arp protocol protocolprotocol-addre address ss dlci [broadcast] Router(config-if)# Router(config-if)# frame-relay map protocol [ietf] [ietf] [cisco] [cisco] Router# Router# show frame-rel frame-relay ay map
Interface de supervision locale LMI : Router# Router# show frame-rel frame-relay ay lmi Router Router# # frameframe-rel relay ay lmi-ty lmi-type pe [cisco [cisco | ansi ansi | q933a] q933a]
Configuration de sous-interfaces Frame Relay : Router(co Router(config) nfig)# # interface interface serial serial interface Router(config-if)# Router(config-if)# encapsulation frame-relay Router(config-if)# Router(config-if)# interface serial subinterface_number [multipoint [multipoint | point-to-point] ip-address subnet-mask Router(co Router(confignfig-subif subif)# )# ip address address ip-address Router(config-subif)# Router(config-subif)# frame-relay interface-dlci dlci-number Router(co Router(confignfig-if)# if)# no shutdown shutdown
Visualisation et dépannage de Frame Relay : Router# Router# show interface interfaces s Router# Router# show frame-rel frame-relay ay lmi Router# Router# show frame-rel frame-relay ay pvc [interfac [interface e interface ] [dlci] [dlci] Router Router # clear clear counte counters rs Router Router # show show frameframe-rel relay ay map Router Router # clear clear frame-rel frame-relay-in ay-inarp arp Router Router # debug debug frameframe-rel relay ay lmi
3.3 3.3
Sécu Sécuri rité té du rése réseau au
3.3.1 3.3.1
Sécuri Sécurisati sation on génér générale ale du route routeur ur
Configuration de mots de passe sécurisés et authentification AAA : Router(co Router(config) nfig)# # aaa new-model new-model Router(co Router(config) nfig)# # aaa authentic authentication ation login LOCAL_AUT LOCAL_AUTH H local local Router(co Router(config) nfig)# # line console console 0 Router(config-line)# Router(config-line)# login authentication LOCAL_AUTH Router(co Router(confignfig-line) line)# # line vty 0 4 Router(config-line)# Router(config-line)# login authentication LOCAL_AUTH Router# Router# username username username password password Router# Router# username username username secret password Router(config)# service password-encryption password-encryption Router(co Router(config) nfig)# # security security passwords passwords min-length min-length number
K. CLEMENT - F. Rico
15 janvier 2016
13
Exemple de chiffrement de mots de passe : R1(config R1(config)# )# username username Student Student password password cisco123 cisco123 R1(con R1(config fig)# )# do show show run | includ include e userna username me username username Student Student password password 0 cisco123 cisco123 R1(config)# R1(config)# service password-encryption password-encryption R1(con R1(config fig)# )# do show show run | includ include e userna username me username username Student Student password password 7 030752180 03075218050061 50061 R1(config)# R1(config R1(config)# )# username username Student Student secret secret cisco cisco R1(con R1(config fig)# )# do show show run | includ include e userna username me username username Student Student secret secret 5 $1$z245$l $1$z245$lVSTJz VSTJzuYgdQ uYgdQDJiac DJiacwP2Tv wP2Tv/ / R1(config)#
Désactivation de la ligne auxiliaire : Router(co Router(config) nfig)# # line Router(co Router(confignfig-line) line)# # Router(config-line)# Router(config-line)# Router(config-line)# Router(config-line)#
aux 0 no password password login exit
Configuration des lignes de terminaux virtuels VTY pour Telnet et SSH : Router Router(co (confi nfig)# g)# line line vty 0 4 Router(co Router(confignfig-line) line)# # no transport transport input input Router(co Router(confignfig-line) line)# # transport transport input input telnet telnet ssh Router(config-line)# Router(config-line)# exit Router(co Router(config) nfig)# # login block-for block-for seconds attempt tries within seconds Router(co Router(config) nfig)# # security security authentic authentication ation failure failure rate threshold-rate log
Configuration des lignes de terminaux virtuels VTY uniquement pour SSH : Router Router(co (confi nfig)# g)# line line vty 0 4 Router(co Router(confignfig-line) line)# # no transport transport input input Router(co Router(confignfig-line) line)# # transport transport input input ssh Router(config-line)# Router(config-line)# exec-timeout number Router(config)# service tcp-keepalives-in tcp-keepalives-in
Configuration de SSH : Router Router(co (confi nfig)# g)# ip ssh versio version n 2 Router(config)# hostname hostname Router(co Router(config) nfig)# # ip domain-nam domain-name e domain-name Router(co Router(config) nfig)# # crypto crypto key {generate {generate | zeroise} zeroise} rsa Router(config)# username username secret password Router Router(co (confi nfig)# g)# line line vty 0 4 Router(co Router(confignfig-line) line)# # transport transport input input ssh Router(co Router(confignfig-line) line)# # login local Router(co Router(config) nfig)# # ip ssh time-out time-out seconds Router(config)# authentification-retries authentification-retries number Router Router# # show show ip ssh Router Router# # show show ssh
K. CLEMENT - F. Rico
15 janvier 2016
14
Désactivation des services non utilisés : Router# Router# show running-c running-config onfig Router(co Router(config) nfig)# # no service service tcp-smalltcp-small-serve servers rs Router(co Router(config) nfig)# # no service service udp-smalludp-small-serve servers rs Router(co Router(config) nfig)# # no ip bootp server Router(co Router(config) nfig)# # no service service finger finger Router(co Router(config) nfig)# # no ip http server Router(co Router(config) nfig)# # no snmp-serve snmp-server r Router(co Router(config) nfig)# # no cdp run Router(co Router(config) nfig)# # no service service config config Router(co Router(config) nfig)# # no ip source-rou source-route te Router(co Router(config) nfig)# # no ip classless classless Router(config-if)# Router(config-if)# shutdown Router(co Router(confignfig-if)# if)# no ip directeddirected-broa broadcas dcast t Router(co Router(confignfig-if)# if)# no ip proxy-arp proxy-arp
3.3.2
Authentifi Authentificatio cation n des protocoles protocoles de routage routage
Configuration de RIPv2 avec authentification du protocole de routage : Router(co Router(config) nfig)# # router router rip Router(config-router)# Router(config-router)# passive-interface passive-interface default interface-number Router(config-router)# Router(config-router)# no passive-interface passive-interface interface-type interface-number Router(co Router(config) nfig)# # key chain chain RIP_KEY RIP_KEY Router(co Router(confignfig-keych keychain)# ain)# key 1 Router(config-keychain-key)# Router(config-keychain-key)# key-string string type port Router(config)# interface type Router(co Router(confignfig-if)# if)# ip rip authentif authentificati ication on mode md5 Router(co Router(confignfig-if)# if)# ip rip authentif authentificati ication on key-chain key-chain RIP_KEY RIP_KEY Rout Router er # show show ip rout route e
Configuration d’EIGRP avec authentification du protocole de routage : Router(co Router(config) nfig)# # key chain chain EIGRP_KEY EIGRP_KEY Router(co Router(confignfig-keych keychain)# ain)# key 1 Router(config-keychain-key)# Router(config-keychain-key)# key-string string type port Router(config)# interface type Router(co Router(confignfig-if)# if)# ip authentifi authentificatio cation n mode eigrp eigrp as md5 Router(co Router(confignfig-if)# if)# ip authentifi authentificatio cation n key-chai key-chain n eigrp eigrp as EIGRP_KEY Rout Router er # show show ip rout route e
Configuration d’OSPF avec authentification simple du protocole de routage : Router(co Router(config) nfig)# # router router ospf process-id Router(config-router)# Router(config-router)# area area-id authentification type port Router(config)# interface type Router(co Router(confignfig-if)# if)# ip ospf authentica authentication tion Router(co Router(confignfig-if)# if)# ip ospf authentica authenticationtion-key key string Router Router# # show show ip route route
K. CLEMENT - F. Rico
15 janvier 2016
15
Configuration d’OSPF avec authentification md5 du protocole de routage : type port Router(config)# interface type Router(co Router(confignfig-if)# if)# ip ospf message-di message-digestgest-key key 1 md5 string Router(co Router(confignfig-if)# if)# ip ospf authentica authentication tion message-di message-digest gest Router(co Router(config) nfig)# # router router ospf process-id Router(config-router)# Router(config-router)# area area-id authentication message-digest Router Router# # show show ip route route
3.3.3
Cisco SDM SDM et Simple Netw Network ork Manageme Management nt Protocol Protocol SNMP SNMP
Processus de sécurisation automatique du routeur : Router# Router# auto secure
Configuration du routeur pour la prise en charge de SDM : Router# Router# configure configure terminal terminal Router(co Router(config) nfig)# # ip http server server Router(co Router(config) nfig)# # ip http secure-ser secure-server ver Router(co Router(config) nfig)# # ip http authentica authentication tion local local Router(config)# username name privilege privilege 15 secret secret password Router Router(co (confi nfig)# g)# line line vty 0 4 Router(co Router(confignfig-line) line)# # privilege privilege level level 15 Router(co Router(confignfig-line) line)# # login local Router(co Router(confignfig-line) line)# # transport transport input input telnet telnet ssh Router(config-line)# Router(config-line)# exit
Configuration de la consignation via le protocole SNMP vers le serveur Syslog : Router(config)# logging syslog-server-ip-address Router Router(co (confi nfig)# g)# loggin logging g trap trap {emerg {emergenc encies ies | alerts alerts | critic critical al | errors errors | warnin warnings gs | notificat notifications ions | informati informational onal | debuggin debugging} g}
3.4
Récupé Récupérat ration ion après après la la perte de mots mots de passe passe et d’IOS d’IOS
Sauvegarde et mise à niveau de l’image logicielle IOS : Router# Router# ping tftp-server-ip-address Router# Router# show flash: Router# Router# copy flash:old-ios tftp: Router Router# # copy copy tftp: tftp: flash: flash:new-ios Router(co Router(config) nfig)# # boot system system flash flash new-ios.bin Router# Router# copy running-c running-config onfig startup-c startup-config onfig Router# Router# reload reload
3.4.1 3.4.1
Récupéra Récupératio tion n après la perte perte de mots de passe passe sur un routeur routeur
1. Notez la valeur valeur du registre registre avec avec la commande commande suivante suivante : Router> Router> show version version
2. Redémarrez Redémarrez le routeur. Lors du démarrage démarrage du routeur, il faut appuyer appuyer sur les touches touches Ctrl + Pause pour passer en mode ROM ROM Monitor Monitor. 3. Entrez les commandes suivantes suivantes afin de ne pas charger le ficher de configuration au démarrage démarrage du routeur.
K. CLEMENT - F. Rico
15 janvier 2016
16
rommon> rommon> confreg confreg 0x2142 0x2142 rommon> rommon> reset reset
4. Entrez les commandes suivantes suivantes pour réinitialiser un nouveau mot de passe et la valeur initiale du registre. Router> Router> enable enable Router# Router# copy startup-c startup-config onfig running-c running-confi onfig g Router# Router# configure configure terminal terminal Router(co Router(config) nfig)# # enable enable secret secret password Router(config)# Router(config)# config-register config-register 0x2102 Router(config)# Router(config)# end Router# Router# copy running-c running-config onfig startup-c startup-confi onfig g Router# Router# reload reload
3.4.2 3.4.2
Récupéra Récupératio tion n d’IOS d’IOS sur sur un route routeur ur
Lors du démarrage du routeur, il faut appuyer sur les touches Ctrl + Pause pour Pause pour passer en mode rommon. rommon> rommon> rommon> rommon> rommon> rommon> rommon> rommon> rommon> rommon>
3.4.3 3.4.3
IP_ADDRESS=ip-address IP_SUBNET_MASK= mask DEFAULT_GATEWAY=ip-address TFTP_SERVER= ip_address TFTP_FILE TFTP_FILE= =file_name tftpdnld tftpdnld reset
Récupéra Récupératio tion n après la perte de mots mots de passe passe sur un commu commutat tateur eur
Pour récupérer le mot de passe sur un commutateur Cisco 2960, procédez comme suit : 1. Connectez Connectez un terminal terminal ou un PC au port de la console console du commutateur commutateur (9 600 bauds). 2. Redémarrez le commutateur, commutateur, puis appuyez sur le bouton Mode p endant les 15 secondes. Relâchez Relâchez ensuite le bouton Mode. 3. Entrez Entrez les commandes commandes suivante suivantess : switch: switch: switch: switch: switch:
flash_init load_helper rename flash:config.text flash:config.text flash:config.text.old flash:config.text.old boot
4. Entrez Entrez les commandes commandes suivante suivantess : Switch> Switch> enable enable Switch# rename flash:config.text.old flash:config.text.old flash:config.text Switch# copy flash:config.text flash:config.text system:running-config system:running-config Switch# Switch# configure configure terminal terminal Switch(co Switch(config) nfig)# # enable enable secret secret password Switch# Switch# copy running-c running-config onfig startup-c startup-confi onfig g Switch# Switch# reload reload
3.4.4 3.4.4
Récupéra Récupératio tion n d’IOS sur sur un commutat commutateur eur
1. Connectez un pc au port p ort console du commutateur, utilisez un logiciel tel que HyperTerminal ou TeraT TeraTerm. erm. 2. Entrez Entrez les commandes commandes suivante suivantess :
K. CLEMENT - F. Rico
15 janvier 2016
17
switch: switch switch: : set BAUD BAUD 115200 115200 switch: switch: copy xmodem: xmodem: flash:/ flash:/ios.bin ou switch switch: : xmodem xmodem [-cyr] [-cyr] [ios.bin ]
3. Configurez Configurez le logiciel logiciel pour une vitesse de ligne de 115200 bauds. 4. Le commutateur commutateur se met en attente attente ; il est prêt à recevoir recevoir l’IOS par xmodem. xmodem. 5. Cherchez Cherchez le fichier fichier avec le menu menu du logiciel et envoy envoyez-le ez-le par Xmodem. 6. Redémarrez Redémarrez : switch: switch: reset reset
7. Après redémarra redémarrage, ge, reconfigurez reconfigurez la vitesse de la ligne de console en 9600 bauds : Switch(co Switch(config) nfig)# # line console console 0 Switch(co Switch(confignfig-line) line)# # speed speed 9600
3.5
Liste Liste de Cont Contrôl rôle e d’Acc d’Accès ès ACL ACL
3.5. 3.5.1 1
ACL stan standar dard d
Configuration d’une ACL standard : Router(config)# access-list access-list-number {permit {permit | deny deny | remark remark remark } source [source-wildcard ] [log] [log] Router(co Router(config) nfig)# # no access-lis access-list t acces-list-number Router(co Router(confignfig-if)# if)# ip access-gro access-group up { access-list-number | access-list-name } {in | out} Router# Router# show access-lists access-lists [acces-list-number | NAME ]
Configuration d’une ACL standard nommée : Router(co Router(config) nfig)# # ip access-lis access-list t standard standard NAME Router(config-std-nacl)# sequence-number [permit|deny|remark] source [source-wildcard ] [log] [log] Router(config-if)# Router(config-if)# ip access-group access-list-name {in | out} out} Router# Router# show access-lists access-lists [NAME ]
Utilisation d’une ACL pour contrôler l’accès aux lignes virtuelles VTY : Router(config)# access-list access-list-number {deny {deny | permit permit} } source [source-wildcard ] Router Router(co (confi nfig)# g)# line line vty 0 4 Router(config-line)# Router(config-line)# access-class access-list-number in [vrf-a [vrf-also lso] ] | out
K. CLEMENT - F. Rico
15 janvier 2016
18
3.5. 3.5.2 2
ACL éten étendue due
Configuration d’une ACL étendue : Router(config)# access-list access-list-number {permit {permit | deny deny | remark remark} } protocol protocol source source [source-wildcard ] [operator port-number ber or name ] [operator operand ] [port [port port-num destination [destination-wildcard [operator operand ] [port port-number ber or name ] [port port-num [established] protocol ol source source Router(config)# access-list access-list-number {permi {permit t | deny} deny} protoc source-wildcard destination destination-wildcard destination-wildcard {eq | neq | gt | lt | range} protocol-number [established] Router(co Router(confignfig-if)# if)# ip access-gro access-group up { access-list-number | access-list-name } {in | out} Router# Router# show access-lists access-lists [acces-list-number | NAME ]
Configuratio Configuration n d’une ACL étendue étendue nommée nommée : Router(co Router(config) nfig)# # ip access-lis access-list t extended extended NAME protocol ol source source Router(config-ext-nacl)# sequence-number [permit [permit | deny deny | remark remark] ] protoc [source-wildcard ] destination [destination-wildcard ] {eq | neq | gt | lt | range} protocol-number [established] Router(config-if)# Router(config-if)# ip access-group access-list-name {in | out} out} Router# Router# show access-lists access-lists [NAME ]
3.5.3 3.5.3
ACL AC L dynami dynamique que
Permet de lancer une ACL (par exemple pour ouvrir un port) suite à un accès telnet au routeur. Exemple de configuration d’une ACL dynamique : Router(config)# username name password password Router(config)# access-list access-list-number dynamic dynamic-name [timeout minutes ] permit source-wildcard dcard destinatio destination n destinati destination-wi on-wildcar ldcard d permit telnet telnet source source-wil Router(config-if)# Router(config-if)# ip access-group access-list-number in Router Router(co (confi nfig)# g)# line line vty 0 4 Router(co Router(confignfig-line) line)# # autocomma autocommand nd access-en access-enable able host timeout timeout minutes
3.5.4 3.5.4
ACL AC L réflexi réflexive ve
Exemple de configuration d’une ACL réflexive : Router(co Router(config) nfig)# # ip access-lis access-list t extended extended OUT-NAME protocol source source source-wil source-wildcard dcard destinatio destination n Router(config-ext-nacl)# Router(config-ext-nacl)# permit protocol destination-wildcard reflect reflect-NAME Router(co Router(config) nfig)# # ip access-lis access-list t extended extended IN-NAME Router(config-ext-nacl)# Router(config-ext-nacl)# evaluate reflect-NAME Router(config-if)# Router(config-if)# ip access-group IN-NAME in Router(config-if)# Router(config-if)# ip access-group OUT-NAME out
K. CLEMENT - F. Rico
15 janvier 2016
19
3.5. 3.5.5 5
ACL bas basée ée sur sur le le temp tempss
ACL qui s’applique (ou pas en fonction de l’heure). Exemple de configuration d’une ACL basée sur le temps : Router(config)# time-range NAME Router(config-time-range)# Router(config-time-range)# periodic DAYS hh:mm to hh:mm hh:mm protocol source source source-wi source-wildca ldcard rd Router(config)# access-list ACL-number permit protocol destination destination-wildcard destination-wildcard {eq | neq | gt | lt | range} protocol-number time-range NAME Router(config-if)# Router(config-if)# ip access-group ACL-number {in | out} out}
3.5.6
Context Context Based Access Access Cont Control rol (CBA (CBAC) C)
Associée à une ACL étendu, cela permet de tracer les sessions (tcp, udp, telnet...) qui demanderont un retour et de leur ouvrir l’accès. Très utile pour configurer un pare-feu ou tout peut sortir mais rien rentrer. Router(co Router(config) nfig)# # ip inspect inspect name nom {tcp|udp|icmp|...} Router(co Router(config) nfig)# # ip access-lis access-list t extended extended 100 Router(co Router(confignfig-ext-a ext-acl)# cl)# !! uniquemen uniquement t avec une ACL étendue étendue Router(co Router(confignfig-ext-a ext-acl)# cl)# deny ip any any Router(co Router(config) nfig)# # interface interface Seriel Seriel 0/0/0 0/0/0 Router(co Router(confignfig-in)# in)# ip access-gro access-group up 100 in Router(co Router(confignfig-in)# in)# ip inspect inspect nom
Il est
possible d’inspecter plusieurs protocoles et de placer l’inspection sur une autre interface. Par contre, comme le CBAC modifie la règle d’ACL pour ajouter une permission sur les paquets correspodant avec protocole, ip source, ip destination, port source et port destination, cela n’ouvre que les ACL étendues.
3.6
Résea Réseaux ux priv privés és virt virtuel uelss VPN VPN
Configuration d’un VPN entre deux sites distants, à configurer sur les routeurs de chaque site : Router(co Router(config) nfig)# # interface interface tunnel tunnel 0 Router(co Router(confignfig-if)# if)# ip unnumbered unnumbered local-interface Router(co Router(confignfig-if)# if)# tunnel tunnel source source wan-source-interface Router(config-if)# Router(config-if)# tunnel destination wan-destination-interface ip-address mask tunnel Router(co Router(config) nfig)# # ip route ip-address tunnel 0
Configuration d’un VPN entre un site et un client : Router(config)# username name password password Router(co Router(config) nfig)# # vpdn enable enable Router(config-vpdn)# Router(config-vpdn)# accept-dialin Router(config-vpdn-acc-in)# Router(config-vpdn-acc-in)# protocol pptp Router(config-vpdn-acc-in)# Router(config-vpdn-acc-in)# virtual-template 1 Router(config-vpdn-acc-in)# Router(config-vpdn-acc-in)# interface virtual-template virtual-template 1 Router(co Router(confignfig-if)# if)# ip unnumbered unnumbered local-interface Router(co Router(confignfig-if)# if)# peer default default ip address address pool POOL_NAME Router(co Router(confignfig-if)# if)# ppp authentic authentication ation {ms-chap {ms-chap | chap | pap} POOL_NAME low-addres low-address s high-addr high-address ess Router(co Router(config) nfig)# # ip local pool POOL_NAME
3.7 3.7.1 3.7.1
Servic Services es d’adre d’adressa ssage ge IP Protoco Protocole le DHCP DHCP
Configuration d’un serveur DHCP :
K. CLEMENT - F. Rico
15 janvier 2016
20
Router(co Router(config) nfig)# # service service dhcp Router(co Router(config) nfig)# # ip dhcp excluded-a excluded-addre ddress ss low-address [high-address ] Router(co Router(config) nfig)# # ip dhcp pool pool-name Router(dhcp-config)# Router(dhcp-config)# network network-number [mask | /prefix-length ] Router(dhcp-config)# Router(dhcp-config)# default-router address [address2 ...address8 ] Router(dhcp-config)# Router(dhcp-config)# dns-server address [address2 ...address8 ] Router(dhcp-config)# Router(dhcp-config)# domain-name domain Router(dh Router(dhcp-co cp-config) nfig)# # lease { days [hours ] [minutes ] | infinite } Router(dhcp-config)# Router(dhcp-config)# netbios-name-server netbios-name-server address [address2 ...address8 ]
Configuration d’un relais DHCP : Router(config-if)# Router(config-if)# ip helper-address server-address
K. CLEMENT - F. Rico
15 janvier 2016
21
Visualisation et dépannage de DHCP : Router Router# # Router Router# # Router Router# # Router Router# # Router Router# #
3.7.2
show show ip dhcp dhcp bindin binding g show show ip dhcp dhcp server server statis statistic tics s show show ip dhcp dhcp server server pool pool show show ip dhcp dhcp confli conflict ct debug debug ip dhcp dhcp server server events events
Evolutivi Evolutivité té des des réseaux réseaux avec avec NAT NAT
Configuration de la NAT statique : local-ip global-ip global-ip Router(co Router(config) nfig)# # ip nat inside inside source source static static local-ip number Router(config)# interface type number Router(co Router(confignfig-if)# if)# ip nat inside inside number Router(config)# interface type number Router(co Router(confignfig-if)# if)# ip nat outside outside
Configuration de la redirection de port : protoco ocol l locallocal-ip ip port port global global-ip -ip port port Router(co Router(config) nfig)# # ip nat inside inside source source static static prot
Configuration de la NAT dynamique : start-ip end-ip end-ip {netmask netmask | prefix-le Router(co Router(config) nfig)# # ip nat pool NAME start-ip prefix-length ngth prefix-length } Router(config)# access-list access-list-number permit source [source-wildcard ] Router(co Router(config) nfig)# # ip nat inside inside source source list access-list-number pool NAME number Router(config)# interface type number Router(co Router(confignfig-if)# if)# ip nat inside inside number Router(config)# interface type number Router(co Router(confignfig-if)# if)# ip nat outside outside
Configuration de la surcharge NAT – première configuration possible : Router(config)# access-list access-list-number permit source [source-wildcard ] Router(co Router(config) nfig)# # ip nat inside inside source source list access-list-number interface interface overload number Router(config)# interface type number Router(co Router(confignfig-if)# if)# ip nat inside inside number Router(config)# interface type number Router(co Router(confignfig-if)# if)# ip nat outside outside
Configuration de la surcharge NAT – deuxième configuration possible : Router(config)# access-list access-list-number permit source [source-wildcard ] start-ip end-ip end-ip {netmask netmask | prefix-le Router(co Router(config) nfig)# # ip nat pool NAME start-ip prefix-length ngth prefix-length } Router(co Router(config) nfig)# # ip nat inside inside source source list access-list-number pool NAME overload number Router(config)# interface type number Router(co Router(confignfig-if)# if)# ip nat inside inside number Router(config)# interface type number Router(co Router(confignfig-if)# if)# ip nat outside outside
K. CLEMENT - F. Rico
15 janvier 2016
22
Visualisation et dépannage de NAT : Router# Router# show ip nat translati translations ons [verbose] [verbose] Router Router# # show show ip nat statis statistic tics s Router(co Router(config) nfig)# # ip nat translati translation on timeout timeout timeout-seconds Router Router# # clear clear ip nat transl translati ation on * global-ip local-ip local-ip [outside local-ip Router Router# # clear clear ip nat transl translati ation on inside inside global-ip global-ip ] global-ip global-po global-port rt local-ip local-ip Router Router# # clear clear ip nat transl translati ation on protoc protocol ol inside inside global-ip local-port [outside local-ip local-ip local-po local-port rt global-ip global-ip global-po global-port rt ] Router Router# # debug debug ip nat [detai [detailed led] ]
3.8 3.8
Adres dressa sage ge IPv6 IPv6
Configuration de IPv6 : RouterX(config)# ipv6 unicast-routing RouterX(c RouterX(config onfig-if)# -if)# ipv6 address address ipv6-address /prefix-length [eui-64] RouterX(c RouterX(config onfig)# )# ipv6 host name [port ] ipv6addr [ipv6addr ...] RouterX(c RouterX(config onfig)# )# ip name-serv name-server er address
Configuration de RIPng : RouterX(config)# ipv6 unicast-routing RouterX(c RouterX(config onfig)# )# ipv6 router router rip name RouterX(c RouterX(config onfig-if)# -if)# ipv6 rip name enable
Visualisat Visualisation ion et dépannage dépannage d’IPv6 : RouterX# RouterX# RouterX# RouterX# RouterX# RouterX# RouterX# RouterX# Router RouterX# X# Router RouterX# X# Router RouterX# X# RouterX# RouterX# RouterX# RouterX# RouterX# RouterX# Router RouterX# X# RouterX# RouterX# Router RouterX# X# Router RouterX# X# RouterX# RouterX# RouterX# RouterX# Router RouterX# X# RouterX# RouterX#
show ipv6 interface interface show ipv6 interface interface brief show ipv6 neighbors neighbors show ipv6 protocols protocols show show ipv6 ipv6 rip show show ipv6 ipv6 route route show show ipv6 ipv6 route route summar summary y show ipv6 routers routers show ipv6 static show ipv6 static static interface interface interface show show ipv6 ipv6 static static detail detail show ipv6 traffic traffic clear clear ipv6 ipv6 rip clear clear ipv6 ipv6 route route * clear ipv6 traffic traffic debug ipv6 packet packet debug debug ipv6 ipv6 rip debug ipv6 routing routing
K. CLEMENT - F. Rico
15 janvier 2016
23