Ce TP a pour objectif de déployer un pare-feu ZPF (Zone-Based Policy Firewall) sur un routeur Cisco Packet Tracer. À la différence d'un pare-feu basé sur des ACL classiques, le ZPF organise les interfaces en zones de sécurité et applique des politiques de filtrage par paire de zones (zone-pair).
Principe fondamental : tout trafic entre deux zones distinctes est BLOQUÉ par défaut.
Seul le trafic explicitement autorisé dans une policy-map est permis. Le trafic intra-zone (même zone) n'est pas filtré.
inspect / drop) sur les flux identifiésCréer les zones (zone security)
Définir les class-maps pour identifier les protocoles autorisés
Créer les policy-maps avec action inspect ou drop
Créer les zone-pairs et y attacher les policy-maps
Rattacher les interfaces à leurs zones (zone-member security)
L'infrastructure est organisée autour d'un Routeur ZPF central interconnectant quatre zones :
PC0 (10.0.0.2)
Serveur HTTP (10.0.0.1)
Switch Sw-WAN (10.0.0.254)
Interface routeur : Fa0/0 — 10.0.0.254
Serveur DMZ HTTP/DNS/SMTP (192.168.50.1)
Serveur Syslog (192.168.50.2)
Interface routeur : Fa0/3 — 192.168.50.254
PC0 client DHCP
PC1 client DHCP
Interface routeur : Fa0/1 — 192.168.2.254
Serveur DHCP (192.168.1.1)
Serveur DNS (192.168.1.2)
Interface routeur : Fa0/2 — 192.168.1.254
| Interface | Zone | Adresse IP | Masque |
|---|---|---|---|
FastEthernet 0/0 | WAN | 10.0.0.254 | 255.0.0.0 |
FastEthernet 0/1 | STATIONS | 192.168.2.254 | 255.255.255.0 |
FastEthernet 0/2 | SERVEURS | 192.168.1.254 | 255.255.255.0 |
FastEthernet 0/3 | DMZ | 192.168.50.254 | 255.255.255.0 |
| Hôte | Zone | IP | Passerelle |
|---|---|---|---|
| Serveur DHCP | SERVEURS | 192.168.1.1 | 192.168.1.254 |
| Serveur DNS | SERVEURS | 192.168.1.2 | 192.168.1.254 |
| Serveur DMZ (HTTP/DNS/SMTP) | DMZ | 192.168.50.1 | 192.168.50.254 |
| Serveur Syslog | DMZ | 192.168.50.2 | 192.168.50.254 |
| PC0 & PC1 (clients DHCP) | STATIONS | Via DHCP | 192.168.2.254 |
| Serveur HTTP WAN | WAN | 10.0.0.1 | 10.0.0.254 |
Le tableau ci-dessous définit les flux autorisés. Tout flux non listé est bloqué par défaut.
| Source ╲ Dest | WAN | DMZ | STATIONS | SERVEURS |
|---|---|---|---|---|
| WAN | — | HTTP · DNS SMTP · SYSLOG (IP filtrée : .50.1) |
✗ | ✗ |
| DMZ | ✗ | — | ✗ | ✗ |
| STATIONS | HTTP · HTTPS DNS · ICMP |
HTTP · DNS SMTP · ICMP SYSLOG |
— | TCP · UDP ICMP |
| SERVEURS | HTTP · HTTPS DNS · ICMP |
HTTP · DNS SMTP · ICMP SYSLOG |
✗ | — |
Règles critiques :
• La zone DMZ ne peut PAS initier de connexion vers d'autres zones.
• L'accès WAN → DMZ est restreint à l'IP 192.168.50.1 (filtrage par ACL).
• STATIONS ne peut pas accéder à SERVEURS via HTTP/HTTPS — uniquement TCP/UDP/ICMP générique.
La première étape consiste à déclarer les quatre zones sur le routeur. Elles sont vides à ce stade — les interfaces y seront rattachées ultérieurement.
Router> enable Router# configure terminal ! Création des 4 zones de sécurité zone security WAN exit zone security DMZ exit zone security STATIONS exit zone security SERVEURS exit
Le nom des zones est case-sensitive. Il doit être recopié exactement dans les class-maps, policy-maps et zone-pairs. Un écart invisible (majuscule, espace) suffit à rompre la politique.
Les class-maps identifient les types de trafic à traiter. On utilise match-any pour autoriser dès qu'un protocole correspond (logique OR).
class-map type inspect match-any CM-STATIONS-TO-SERVEURS match protocol tcp match protocol udp match protocol icmp
class-map type inspect match-any CM-TO-DMZ match protocol http match protocol dns match protocol smtp match protocol icmp match protocol syslog
class-map type inspect match-any CM-TO-WAN match protocol http match protocol https match protocol dns match protocol icmp
class-map type inspect match-any CM-WAN-TO-DMZ match protocol http match protocol dns match protocol smtp match protocol syslog
match-any : le flux est identifié si au moins un protocole correspond (logique OR). C'est le mode utilisé ici.
match-all : le flux doit correspondre à tous les critères simultanément (logique AND). Rarement utilisé pour des protocoles différents.
La policy-map associe une class-map à une action. Le mot-clé inspect autorise le trafic avec suivi de session stateful — le trafic de retour est automatiquement autorisé.
! STATIONS → SERVEURS policy-map type inspect PM-STATIONS-TO-SERVEURS class type inspect CM-STATIONS-TO-SERVEURS inspect class class-default drop ! STATIONS → DMZ policy-map type inspect PM-STATIONS-TO-DMZ class type inspect CM-TO-DMZ inspect class class-default drop ! SERVEURS → DMZ policy-map type inspect PM-SERVEURS-TO-DMZ class type inspect CM-TO-DMZ inspect class class-default drop ! STATIONS → WAN policy-map type inspect PM-STATIONS-TO-WAN class type inspect CM-TO-WAN inspect class class-default drop ! SERVEURS → WAN policy-map type inspect PM-SERVEURS-TO-WAN class type inspect CM-TO-WAN inspect class class-default drop ! WAN → DMZ policy-map type inspect PM-WAN-TO-DMZ class type inspect CM-WAN-TO-DMZ inspect class class-default drop
inspect — autorise ET crée une entrée stateful. Le trafic retour est automatiquement géré. À utiliser pour TCP/UDP/ICMP.drop — bloque silencieusement. Aucun message ICMP de rejet n'est envoyé.pass — autorise sans suivi de session. Déconseillé pour TCP/UDP car le retour n'est pas automatique.Le bloc class class-default drop est une bonne pratique : il force le drop explicite de tout ce qui ne matche pas, rendant la politique lisible.
Le zone-pair définit le sens du trafic et y attache une policy-map. Chaque paire représente un flux unidirectionnel.
! STATIONS → SERVEURS zone-pair security ZP-STATIONS-TO-SERVEURS source STATIONS destination SERVEURS service-policy type inspect PM-STATIONS-TO-SERVEURS exit ! STATIONS → DMZ zone-pair security ZP-STATIONS-TO-DMZ source STATIONS destination DMZ service-policy type inspect PM-STATIONS-TO-DMZ exit ! STATIONS → WAN zone-pair security ZP-STATIONS-TO-WAN source STATIONS destination WAN service-policy type inspect PM-STATIONS-TO-WAN exit ! SERVEURS → DMZ zone-pair security ZP-SERVEURS-TO-DMZ source SERVEURS destination DMZ service-policy type inspect PM-SERVEURS-TO-DMZ exit ! SERVEURS → WAN zone-pair security ZP-SERVEURS-TO-WAN source SERVEURS destination WAN service-policy type inspect PM-SERVEURS-TO-WAN exit ! WAN → DMZ (filtrage IP ciblé sur 192.168.50.1) zone-pair security ZP-WAN-TO-DMZ source WAN destination DMZ service-policy type inspect PM-WAN-TO-DMZ exit
Trafic de retour : avec inspect, le retour est géré automatiquement par la table stateful. Il est inutile et incorrect de créer un zone-pair inverse uniquement pour le retour.
Ex : ZP-STATIONS-TO-WAN gère aussi le retour WAN→STATIONS pour les sessions initiées depuis STATIONS.
Chaque interface physique est rattachée à sa zone via zone-member security. Une interface ne peut appartenir qu'à une seule zone.
interface FastEthernet0/0 zone-member security WAN exit interface FastEthernet0/1 zone-member security STATIONS exit interface FastEthernet0/2 zone-member security SERVEURS exit interface FastEthernet0/3 zone-member security DMZ exit
Attention : dès qu'une interface est rattachée à une zone, tout trafic entrant/sortant est soumis au ZPF. Si aucun zone-pair ne correspond, le trafic est droppé silencieusement — même le trafic de gestion SSH/Telnet.
La politique impose que le WAN n'accède au serveur DMZ qu'avec un filtrage sur l'IP de destination (192.168.50.1). On utilise une ACL étendue en préfiltrage.
! ACL étendue — autorise uniquement le serveur DMZ 192.168.50.1 ip access-list extended ACL-WAN-TO-DMZ-SERVER permit ip any host 192.168.50.1 deny ip any any ! Class-map avec filtrage ACL (IOS réel) class-map type inspect match-all CM-WAN-TO-DMZ-FILTERED match access-group name ACL-WAN-TO-DMZ-SERVER
Note Packet Tracer : match access-group name dans une class-map de type inspect peut être partiellement supporté selon la version. Si non disponible, appliquer l'ACL directement sur l'interface WAN en entrée (ip access-group ACL-WAN-TO-DMZ-SERVER in) en complément du ZPF.
| Commande | Utilité |
|---|---|
show run | Vérifier l'ensemble de la configuration ZPF |
show zone security | Afficher les zones et leurs interfaces membres |
show zone-pair security | Afficher les zone-pairs et les policy-maps associées |
show policy-map type inspect zone-pair | Statistiques de trafic par policy (paquets matchés) |
show class-map type inspect | Lister toutes les class-maps configurées |
debug ip inspect events | Suivi des sessions ZPF en temps réel ⚠️ |
| Test | Action | Résultat | Zone-pair |
|---|---|---|---|
| STATIONS → Serveur HTTP DMZ | Ping + HTTP vers 192.168.50.1 |
✅ Autorisé | ZP-STATIONS-TO-DMZ |
| STATIONS → WAN HTTP | HTTP vers 10.0.0.1 |
✅ Autorisé | ZP-STATIONS-TO-WAN |
| STATIONS → Serveur DNS | DNS vers 192.168.1.2 |
✅ Autorisé | ZP-STATIONS-TO-SERVEURS |
| DMZ → STATIONS | Ping depuis 192.168.50.1 |
❌ Bloqué | Aucun zone-pair |
| DMZ → WAN | HTTP depuis DMZ vers WAN | ❌ Bloqué | Aucun zone-pair |
| WAN → Serveur DMZ (HTTP) | HTTP vers 192.168.50.1 |
✅ Autorisé | ZP-WAN-TO-DMZ |
| WAN → STATIONS | Ping vers 192.168.2.x |
❌ Bloqué | Aucun zone-pair |
| WAN → Serveur Syslog (DMZ) | Syslog vers 192.168.50.2 |
❌ Bloqué | Filtrage IP – .50.2 non ciblé |
Configuration consolidée à appliquer sur le Routeur ZPF — prête à copier-coller dans Packet Tracer.
enable configure terminal ! ── Zones ─────────────────────────────────────────────────── zone security WAN zone security DMZ zone security STATIONS zone security SERVEURS ! ── Class-maps ────────────────────────────────────────────── class-map type inspect match-any CM-STATIONS-TO-SERVEURS match protocol tcp match protocol udp match protocol icmp class-map type inspect match-any CM-TO-DMZ match protocol http match protocol dns match protocol smtp match protocol icmp match protocol syslog class-map type inspect match-any CM-TO-WAN match protocol http match protocol https match protocol dns match protocol icmp class-map type inspect match-any CM-WAN-TO-DMZ match protocol http match protocol dns match protocol smtp match protocol syslog ! ── Policy-maps ───────────────────────────────────────────── policy-map type inspect PM-STATIONS-TO-SERVEURS class type inspect CM-STATIONS-TO-SERVEURS inspect class class-default drop policy-map type inspect PM-STATIONS-TO-DMZ class type inspect CM-TO-DMZ inspect class class-default drop policy-map type inspect PM-SERVEURS-TO-DMZ class type inspect CM-TO-DMZ inspect class class-default drop policy-map type inspect PM-STATIONS-TO-WAN class type inspect CM-TO-WAN inspect class class-default drop policy-map type inspect PM-SERVEURS-TO-WAN class type inspect CM-TO-WAN inspect class class-default drop policy-map type inspect PM-WAN-TO-DMZ class type inspect CM-WAN-TO-DMZ inspect class class-default drop ! ── Zone-pairs ────────────────────────────────────────────── zone-pair security ZP-STATIONS-TO-SERVEURS source STATIONS destination SERVEURS service-policy type inspect PM-STATIONS-TO-SERVEURS zone-pair security ZP-STATIONS-TO-DMZ source STATIONS destination DMZ service-policy type inspect PM-STATIONS-TO-DMZ zone-pair security ZP-STATIONS-TO-WAN source STATIONS destination WAN service-policy type inspect PM-STATIONS-TO-WAN zone-pair security ZP-SERVEURS-TO-DMZ source SERVEURS destination DMZ service-policy type inspect PM-SERVEURS-TO-DMZ zone-pair security ZP-SERVEURS-TO-WAN source SERVEURS destination WAN service-policy type inspect PM-SERVEURS-TO-WAN zone-pair security ZP-WAN-TO-DMZ source WAN destination DMZ service-policy type inspect PM-WAN-TO-DMZ ! ── Interfaces ────────────────────────────────────────────── interface FastEthernet0/0 zone-member security WAN interface FastEthernet0/1 zone-member security STATIONS interface FastEthernet0/2 zone-member security SERVEURS interface FastEthernet0/3 zone-member security DMZ end write memory
Cette configuration met en œuvre un pare-feu ZPF complet sur 4 zones, conforme aux bonnes pratiques Cisco. La segmentation par zones offre plusieurs avantages :
inspect, les sessions sont suivies et le retour est automatiqueFlux autorisés — synthèse :
• STATIONS → SERVEURS : TCP, UDP, ICMP
• STATIONS & SERVEURS → DMZ : HTTP, DNS, SMTP, ICMP, SYSLOG
• STATIONS & SERVEURS → WAN : HTTP, HTTPS, DNS, ICMP
• WAN → DMZ (192.168.50.1 uniquement) : HTTP, DNS, SMTP, SYSLOG
• DMZ → toutes autres zones : BLOQUÉ