<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE article PUBLIC "-//OASIS//DTD DocBook XML V5.0//EN" "/usr/share/xml/docbook/schema/dtd/5.0/docbook.dtd" [
<!ENTITY author SYSTEM "author.xml">
<!ENTITY legal SYSTEM "legal.xml">
<!ENTITY topologie SYSTEM "files/topologie.txt">
<!-- external urls --><!ENTITY % rfc_urls SYSTEM "rfc.urls.xml">
<!ENTITY url.rfc791 '<link xmlns="http://docbook.org/ns/docbook" xlink:href="http://www.faqs.org/rfcs/rfc791.html">
  RFC791 <citetitle>Internet Protocol</citetitle></link>'>
<!ENTITY url.rfc792 '<link xmlns="http://docbook.org/ns/docbook" xlink:href="http://www.faqs.org/rfcs/rfc792.html">
  RFC792 <citetitle>Internet Control Message Protocol</citetitle></link>'>
<!ENTITY url.rfc793 '<link xmlns="http://docbook.org/ns/docbook" xlink:href="http://www.faqs.org/rfcs/rfc793.html">
  RFC793 <citetitle>Transmission Control Protocol</citetitle></link>'>
<!ENTITY url.rfc826 '<link xmlns="http://docbook.org/ns/docbook" xlink:href="http://www.faqs.org/rfcs/rfc826.html">
  RFC826 <citetitle>Ethernet Address Resolution Protocol</citetitle></link>'>
<!ENTITY url.rfc894 '<link xmlns="http://docbook.org/ns/docbook" xlink:href="http://www.faqs.org/rfcs/rfc894.html">
  RFC894 <citetitle>Standard for the transmission of IP datagrams over Ethernet networks</citetitle></link>'>
<!ENTITY url.rfc950 '<link xmlns="http://docbook.org/ns/docbook" xlink:href="http://www.faqs.org/rfcs/rfc950.html">
  RFC950 <citetitle>Internet Standard Subnetting Procedure</citetitle></link>'>
<!ENTITY url.rfc1042 '<link xmlns="http://docbook.org/ns/docbook" xlink:href="http://www.faqs.org/rfcs/rfc1042.html">
  RFC1042 <citetitle>Standard for the transmission of IP datagrams over IEEE 802 networks</citetitle></link>'>
<!ENTITY url.rfc1119 '<link xmlns="http://docbook.org/ns/docbook" xlink:href="http://www.faqs.org/rfcs/rfc1119.html">
  RFC1119 <citetitle>Network Time Protocol (version 2) specification and implementation</citetitle></link>'>
<!ENTITY url.rfc1157 '<link xmlns="http://docbook.org/ns/docbook" xlink:href="http://www.faqs.org/rfcs/rfc1157.html">
  RFC1157 <citetitle>Simple Network Management Protocol (SNMP)</citetitle></link>'>
<!ENTITY url.rfc1191 '<link xmlns="http://docbook.org/ns/docbook" xlink:href="http://www.faqs.org/rfcs/rfc1191.html">
  RFC1191 <citetitle>Path MTU discovery</citetitle></link>'>
<!ENTITY url.rfc1350 '<link xmlns="http://docbook.org/ns/docbook" xlink:href="http://www.faqs.org/rfcs/rfc1350.html">
  RFC1350 <citetitle>The TFTP Protocol (Revision 2)</citetitle></link>'>
<!ENTITY url.rfc1517 '<link xmlns="http://docbook.org/ns/docbook" xlink:href="http://www.faqs.org/rfcs/rfc1517.html">
  RFC1517 <citetitle>Applicability Statement for the Implementation of Classless Inter-Domain Routing (CIDR)</citetitle></link>'>
<!ENTITY url.rfc1518 '<link xmlns="http://docbook.org/ns/docbook" xlink:href="http://www.faqs.org/rfcs/rfc1518.html">
  RFC1518 <citetitle>An Architecture for IP Address Allocation with CIDR</citetitle></link>'>
<!ENTITY url.rfc1519 '<link xmlns="http://docbook.org/ns/docbook" xlink:href="http://www.faqs.org/rfcs/rfc1519.html">
  RFC1519 <citetitle>Classless Inter-Domain Routing (CIDR): an Address Assignment and Aggregation Strategy</citetitle></link>'>
<!ENTITY url.rfc1520 '<link xmlns="http://docbook.org/ns/docbook" xlink:href="http://www.faqs.org/rfcs/rfc1520.html">
  RFC1520 <citetitle>Exchanging Routing Information Across Provider Boundaries in the CIDR Environment</citetitle></link>'>
<!ENTITY url.rfc1631 '<link xmlns="http://docbook.org/ns/docbook" xlink:href="http://www.faqs.org/rfcs/rfc1631.html">
  RFC1631 <citetitle>The IP Network Address Translator (NAT)</citetitle></link>'>
<!ENTITY url.rfc1633 '<link xmlns="http://docbook.org/ns/docbook" xlink:href="http://www.faqs.org/rfcs/rfc1633.html">
  RFC1633 <citetitle>Integrated Services in the Internet Architecture: an Overview</citetitle></link>'>
<!ENTITY url.rfc1661 '<link xmlns="http://docbook.org/ns/docbook" xlink:href="http://www.faqs.org/rfcs/rfc1661.html">
  RFC1661 <citetitle>The Point-to-Point Protocol (PPP)</citetitle></link>'>
<!ENTITY url.rfc1717 '<link xmlns="http://docbook.org/ns/docbook" xlink:href="http://www.faqs.org/rfcs/rfc1717.html">
  RFC1717 <citetitle>The PPP Multilink Protocol (MP)</citetitle></link>'>
<!ENTITY url.rfc1878 '<link xmlns="http://docbook.org/ns/docbook" xlink:href="http://www.faqs.org/rfcs/rfc1878.html">
  RFC1878 <citetitle>Variable Length Subnet Table For IPv4</citetitle></link>'>
<!ENTITY url.rfc1918 '<link xmlns="http://docbook.org/ns/docbook" xlink:href="http://www.faqs.org/rfcs/rfc1918.html">
  RFC1918 <citetitle>Address Allocation for Private Internets</citetitle></link>'>
<!ENTITY url.rfc1977 '<link xmlns="http://docbook.org/ns/docbook" xlink:href="http://www.faqs.org/rfcs/rfc1977.html">
  RFC1977 <citetitle>PPP BSD Compression Protocol</citetitle></link>'>
<!ENTITY url.rfc1990 '<link xmlns="http://docbook.org/ns/docbook" xlink:href="http://www.faqs.org/rfcs/rfc1990.html">
  RFC1990 <citetitle>The PPP Multilink Protocol (MP)</citetitle></link>'>
<!ENTITY url.rfc2205 '<link xmlns="http://docbook.org/ns/docbook" xlink:href="http://www.faqs.org/rfcs/rfc2205.html">
  RFC2205 <citetitle>Resource ReSerVation Protocol (RSVP) -- Version 1 Functional Specification</citetitle></link>'>
<!ENTITY url.rfc2328 '<link xmlns="http://docbook.org/ns/docbook" xlink:href="http://www.faqs.org/rfcs/rfc2328.html">
  RFC2328 <citetitle>OSPF Version 2</citetitle></link>'>
<!ENTITY url.rfc2474 '<link xmlns="http://docbook.org/ns/docbook" xlink:href="http://www.faqs.org/rfcs/rfc2474.html">
  RFC2474 <citetitle>Definition of the Differentiated Services Field (DS Field) in the IPv4 and IPv6 Headers</citetitle></link>'>
<!ENTITY url.rfc2475 '<link xmlns="http://docbook.org/ns/docbook" xlink:href="http://www.faqs.org/rfcs/rfc2475.html">
  RFC2475 <citetitle>An Architecture for Differentiated Service</citetitle></link>'>
<!ENTITY url.rfc3164 '<link xmlns="http://docbook.org/ns/docbook" xlink:href="http://www.faqs.org/rfcs/rfc3164.html">
  RFC3164 <citetitle>The BSD Syslog Protocol</citetitle></link>'>
<!ENTITY url.rfc3198 '<link xmlns="http://docbook.org/ns/docbook" xlink:href="http://www.faqs.org/rfcs/rfc3198.html">
  RFC3198 <citetitle>Terminology for Policy-Based Management</citetitle></link>'>
<!ENTITY % inetdoc_urls SYSTEM "inetdoc.urls.xml">
<!--###################################################
                   Articles
    ################################################### --><!ENTITY url.modelisations '<link xmlns="http://docbook.org/ns/docbook" xlink:href="http://www.inetdoc.net/articles/modelisation/"><citetitle>Modélisations réseau</citetitle></link>'>
<!ENTITY url.modelisations.encapsulation '<link xmlns="http://docbook.org/ns/docbook" xlink:href="http://www.inetdoc.net/articles/modelisation/modelisations.concept.html#modelisations.concept.encapsulation"><citetitle>Encapsulation</citetitle></link>'>
<!ENTITY url.wireshark-as-user '<link xmlns="http://docbook.org/ns/docbook" xlink:href="http://www.inetdoc.net/articles/wireshark-as-user/"><citetitle>Capturer le trafic réseau au niveau utilisateur avec Wireshark</citetitle></link>'>
<!ENTITY url.rnis '<link xmlns="http://docbook.org/ns/docbook" xlink:href="http://www.inetdoc.net/articles/rnis/"><citetitle>Technologie RNIS</citetitle></link>'>
<!ENTITY url.ethernet '<link xmlns="http://docbook.org/ns/docbook" xlink:href="http://www.inetdoc.net/articles/ethernet/"><citetitle>Technologie Ethernet</citetitle></link>'>
<!ENTITY url.pppoe '<link xmlns="http://docbook.org/ns/docbook" xlink:href="http://www.inetdoc.net/articles/pppoe/"><citetitle>Modélisation d&#39;un lien WAN avec PPPoE</citetitle></link>'>
<!ENTITY url.adressage.ipv4 '<link xmlns="http://docbook.org/ns/docbook" xlink:href="http://www.inetdoc.net/articles/adressage.ipv4/"><citetitle>Adressage IPv4</citetitle></link>'>
<!ENTITY url.lan-segmentation '<link xmlns="http://docbook.org/ns/docbook" xlink:href="http://www.inetdoc.net/articles/lan-segmentation/"><citetitle>Segmentation des réseaux locaux</citetitle></link>'>
<!ENTITY url.inter-vlan-routing '<link xmlns="http://docbook.org/ns/docbook" xlink:href="http://www.inetdoc.net/articles/inter-vlan-routing/"><citetitle>Routage Inter-VLAN</citetitle></link>'>
<!ENTITY url.reseau.libre '<link xmlns="http://docbook.org/ns/docbook" xlink:href="http://www.inetdoc.net/articles/reseau.libre/">
  <citetitle>Logiciel Libre &amp; Technologies Réseaux</citetitle></link>'>
<!--###################################################
                   Pas encore migré
    ################################################### --><!ENTITY url.explore '<link xmlns="http://docbook.org/ns/docbook" xlink:href="http://www.inetdoc.net/cours/explore.gnulinux/">
  <citetitle>Exploration GNU/Linux</citetitle></link>'>
<!ENTITY url.explore.seance.4 '<link xmlns="http://docbook.org/ns/docbook" xlink:href="http://www.inetdoc.net/cours/explore.gnulinux/seance.4/">
  <citetitle>Exploration GNU/Linux - Séance 4</citetitle></link>'>
<!ENTITY url.explore.seance.5 '<link xmlns="http://docbook.org/ns/docbook" xlink:href="http://www.inetdoc.net/cours/explore.gnulinux/seance.5/">
  <citetitle>Exploration GNU/Linux - Séance 5</citetitle></link>'>
<!ENTITY url.explore.seance.6 '<link xmlns="http://docbook.org/ns/docbook" xlink:href="http://www.inetdoc.net/cours/explore.gnulinux/seance.6/">
  <citetitle>Exploration GNU/Linux - Séance 6</citetitle></link>'>
<!ENTITY url.config.interface.wlan '<link xmlns="http://docbook.org/ns/docbook" xlink:href="http://www.inetdoc.net/cours/config.interface.wlan/">
  <citetitle>Configuration d&#39;une interface de réseau sans fil IEEE 802.11</citetitle></link>'>
<!ENTITY url.admin.reseau.fs '<link xmlns="http://docbook.org/ns/docbook" xlink:href="http://www.inetdoc.net/cours/admin.reseau.fs/">
  <citetitle>Systèmes de fichiers réseau</citetitle></link>'>
<!ENTITY url.admin.reseau.iscsi '<link xmlns="http://docbook.org/ns/docbook" xlink:href="http://www.inetdoc.net/cours/admin.reseau.iscsi/">
  <citetitle>Introduction au réseau de stockage iSCSI</citetitle></link>'>
<!ENTITY url.admin.reseau.nfs.abstract '<link xmlns="http://docbook.org/ns/docbook" xlink:href="http://www.inetdoc.net/cours/index.html#admin.reseau.nfs">
  <citetitle>Introduction au système de fichiers réseau NFS</citetitle></link>'>
<!ENTITY url.admin.reseau.nfs '<link xmlns="http://docbook.org/ns/docbook" xlink:href="http://www.inetdoc.net/cours/admin.reseau.nfs/">
  <citetitle>Introduction au système de fichiers réseau NFS</citetitle></link>'>
<!ENTITY url.admin.reseau.nfs.synthese '<link xmlns="http://docbook.org/ns/docbook" xlink:href="http://www.inetdoc.net/cours/admin.reseau.nfs.synthese/">
  <citetitle>Introduction au système de fichiers réseau NFS</citetitle></link>'>
<!ENTITY url.admin.reseau.ldap.abstract '<link xmlns="http://docbook.org/ns/docbook" xlink:href="http://www.inetdoc.net/cours/index.html#admin.reseau.ldap">
  <citetitle>Introduction au service LDAP</citetitle></link>'>
<!ENTITY url.admin.reseau.ldap '<link xmlns="http://docbook.org/ns/docbook" xlink:href="http://www.inetdoc.net/cours/admin.reseau.ldap/">
  <citetitle>Introduction au service LDAP</citetitle></link>'>
<!ENTITY url.admin.reseau.ldap.synthese '<link xmlns="http://docbook.org/ns/docbook" xlink:href="http://www.inetdoc.net/cours/admin.reseau.ldap.synthese/">
  <citetitle>Introduction au service LDAP</citetitle></link>'>
<!ENTITY url.admin.reseau.nfs4-ldap.abstract '<link xmlns="http://docbook.org/ns/docbook" xlink:href="http://www.inetdoc.net/cours/index.html#admin.reseau.nfs4-ldap">
  <citetitle>NFSv4 + LDAP + autofs</citetitle></link>'>
<!ENTITY url.admin.reseau.nfs4-ldap '<link xmlns="http://docbook.org/ns/docbook" xlink:href="http://www.inetdoc.net/cours/admin.reseau.nfs4-ldap/">
  <citetitle>NFSv4 + LDAP + autofs</citetitle></link>'>
<!ENTITY url.admin.reseau.nfs4-ldap.synthese '<link xmlns="http://docbook.org/ns/docbook" xlink:href="http://www.inetdoc.net/cours/admin.reseau.nfs4-ldap.synthese/">
  <citetitle>NFSv4 + LDAP + autofs</citetitle></link>'>
<!ENTITY url.admin.reseau.nis '<link xmlns="http://docbook.org/ns/docbook" xlink:href="http://www.inetdoc.net/cours/admin.reseau.nis/">
  <citetitle>Introduction au service NIS</citetitle></link>'>
<!ENTITY url.admin.reseau.synthese-nfs3-nis '<link xmlns="http://docbook.org/ns/docbook" xlink:href="http://www.inetdoc.net/cours/admin.reseau.synthese-nfs3-nis/">
  <citetitle>Administration système en réseau : synthèse NFS v3 &amp; NIS</citetitle></link>'>
<!ENTITY url.admin.reseau.dns-dhcp '<link xmlns="http://docbook.org/ns/docbook" xlink:href="http://www.inetdoc.net/cours/admin.reseau.dns-dhcp/">
  <citetitle>Présentation services DNS &amp; DHCP</citetitle></link>'>
<!ENTITY url.admin.reseau.dns '<link xmlns="http://docbook.org/ns/docbook" xlink:href="http://www.inetdoc.net/cours/admin.reseau.dns/">
  <citetitle>Introduction au service DNS</citetitle></link>'>
<!--###################################################
                   Guides
    ################################################### --><!ENTITY url.lartc.fr '<link xmlns="http://docbook.org/ns/docbook" xlink:href="http://www.inetdoc.net/guides/lartc/"><citetitle>HOWTO du routage avancé et du contrôle de trafic sous Linux</citetitle></link>'>
<!ENTITY url.lartc.fr.rpdb '<link xmlns="http://docbook.org/ns/docbook" xlink:href="http://www.inetdoc.net/guides/lartc/lartc.rpdb.html"><citetitle>LARTC : bases de données des politiques de routage</citetitle></link>'>
<!ENTITY url.lartc.fr.netfilter '<link xmlns="http://docbook.org/ns/docbook" xlink:href="http://www.inetdoc.net/guides/lartc/lartc.netfilter.html"><citetitle>LARTC : Netfilter et iproute - marquage de paquets</citetitle></link>'>
<!ENTITY url.lartc.fr.tunnel.ip-ip '<link xmlns="http://docbook.org/ns/docbook" xlink:href="http://www.inetdoc.net/guides/lartc/lartc.tunnel.ip-ip.html"><citetitle>LARTC : IP dans un tunnel IP</citetitle></link>'>
<!ENTITY url.lartc.fr.tunnel.gre '<link xmlns="http://docbook.org/ns/docbook" xlink:href="http://www.inetdoc.net/guides/lartc/lartc.tunnel.gre.html"><citetitle>LARTC : Le tunnel GRE</citetitle></link>'>
<!ENTITY url.iptables-tutorial.fr '<link xmlns="http://docbook.org/ns/docbook" xlink:href="http://www.inetdoc.net/guides/iptables-tutorial/"><citetitle>Tutoriel iptables</citetitle></link>'>
<!ENTITY url.zebra.static '<link xmlns="http://docbook.org/ns/docbook" xlink:href="http://www.inetdoc.net/guides/zebra.statique/"><citetitle>Initiation au routage, 1ère partie</citetitle></link>'>
<!ENTITY url.zebra.rip '<link xmlns="http://docbook.org/ns/docbook" xlink:href="http://www.inetdoc.net/guides/zebra.rip/"><citetitle>Initiation au routage, 2ème partie</citetitle></link>'>
<!ENTITY url.zebra.ospf '<link xmlns="http://docbook.org/ns/docbook" xlink:href="http://www.inetdoc.net/guides/zebra.ospf/"><citetitle>Initiation au routage, 3ème partie</citetitle></link>'>
<!ENTITY url.vm '<link xmlns="http://docbook.org/ns/docbook" xlink:href="http://www.inetdoc.net/guides/vm/"><citetitle>Virtualisation système et enseignement</citetitle></link>'>
<!ENTITY url.vm.startup.sh '<link xmlns="http://docbook.org/ns/docbook" xlink:href="http://www.inetdoc.net/guides/vm/vm.appendix.html#vm.appendix.startup.sh">code du script <function>startup.sh</function> de lancement d&#39;une machine virtuelle</link>'>
<!ENTITY url.linux.networking '<link xmlns="http://docbook.org/ns/docbook" xlink:href="http://www.inetdoc.net/guides/linux.networking/"><citetitle>Fonctions réseau du noyau Linux</citetitle></link>'>
<!ENTITY url.policyrouting '<link xmlns="http://docbook.org/ns/docbook" xlink:href="http://www.inetdoc.net/pdf/Policy_Routing_in_Linux_ENG.pdf"><citetitle>Policy Routing in Linux</citetitle></link>'>
<!ENTITY url.proxy '<link xmlns="http://docbook.org/ns/docbook" xlink:href="http://www.inetdoc.net/guides/squid-guard/"><citetitle>Proxy Squid &amp; SquidGuard</citetitle></link>'>
<!--###################################################
                   Présentations
    ################################################### --><!ENTITY url.sysadm-base-1 '<link xmlns="http://docbook.org/ns/docbook" xlink:href="http://www.inetdoc.net/presentations/sysadm-base-1/">
  <citetitle>Introduction aux systèmes GNU/Linux - Séance 1</citetitle></link>'>
<!ENTITY url.sysadm-base-2 '<link xmlns="http://docbook.org/ns/docbook" xlink:href="http://www.inetdoc.net/presentations/sysadm-base-2/">
  <citetitle>Introduction aux systèmes GNU/Linux - Séance 2</citetitle></link>'>
<!ENTITY url.sysadm-base-3 '<link xmlns="http://docbook.org/ns/docbook" xlink:href="http://www.inetdoc.net/presentations/sysadm-base-3/">
  <citetitle>Introduction aux systèmes GNU/Linux - Séance 3</citetitle></link>'>
<!ENTITY url.storage '<link xmlns="http://docbook.org/ns/docbook" xlink:href="http://www.inetdoc.net/presentations/stockage/"><citetitle>Stockage Réseau</citetitle></link>'>
<!--###################################################
                   Travaux pratiques
    ################################################### --><!ENTITY url.infra.tp '<link xmlns="http://docbook.org/ns/docbook" xlink:href="http://www.inetdoc.net/travaux_pratiques/infra.tp/"><citetitle>Architecture réseau des travaux pratiques</citetitle></link>'>
<!ENTITY url.infra.tp.cabling '<link xmlns="http://docbook.org/ns/docbook" xlink:href="http://www.inetdoc.net/travaux_pratiques/infra.tp/infra.tp.interco.html#infra.tp.interco.cabling"><citetitle>Disposition des équipements dans l&#39;armoire de brassage</citetitle></link>'>
<!ENTITY url.config.interface.lan '<link xmlns="http://docbook.org/ns/docbook" xlink:href="http://www.inetdoc.net/travaux_pratiques/config.interface.lan/"><citetitle>Configuration d&#39;une interface de réseau local</citetitle></link>'>
<!ENTITY url.config.interface.lan.proc '<link xmlns="http://docbook.org/ns/docbook" xlink:href="http://www.inetdoc.net/travaux_pratiques/config.interface.lan/config.interface.lan.procfs.html#change_proc"><citetitle>Configuration d&#39;une interface de réseau local : activation du routage</citetitle></link>'>
<!ENTITY url.intro.analyse '<link xmlns="http://docbook.org/ns/docbook" xlink:href="http://www.inetdoc.net/travaux_pratiques/intro.analyse/"><citetitle>Introduction à l&#39;analyse réseau avec Wireshark</citetitle></link>'>
<!ENTITY url.interco '<link xmlns="http://docbook.org/ns/docbook" xlink:href="http://www.inetdoc.net/formations/m1/"><citetitle>Interconnexion de réseaux locaux et étendus</citetitle></link>'>
<!ENTITY url.interco.kernel '<link xmlns="http://docbook.org/ns/docbook" xlink:href="http://www.inetdoc.net/travaux_pratiques/interco.kernel.q/"><citetitle>Configuration des fonctions réseau &amp; compilation du noyau Linux</citetitle></link>'>
<!ENTITY url.interco.kernel.answers "http://www.inetdoc.net/travaux_pratiques/interco.kernel.qa/">
<!ENTITY url.interco.rawip '<link xmlns="http://docbook.org/ns/docbook" xlink:href="http://www.inetdoc.net/travaux_pratiques/interco.rawip.q/"><citetitle>Configuration d&#39;une interface RNIS en mode rawip</citetitle></link>'>
<!ENTITY url.interco.rawip.answers "http://www.inetdoc.net/travaux_pratiques/interco.rawip.qa/">
<!ENTITY url.interco.ppp '<link xmlns="http://docbook.org/ns/docbook" xlink:href="http://www.inetdoc.net/travaux_pratiques/interco.ppp.q/"><citetitle>Topologie Hub &amp; Spoke avec le protocole PPP</citetitle></link>'>
<!ENTITY url.interco.ppp.answers "http://www.inetdoc.net/travaux_pratiques/interco.ppp.qa/">
<!ENTITY url.interco.netfilter '<link xmlns="http://docbook.org/ns/docbook" xlink:href="http://www.inetdoc.net/travaux_pratiques/interco.netfilter.q/"><citetitle>Filtrage réseau avec netfilter/iptables</citetitle></link>'>
<!ENTITY url.interco.netfilter.answers "http://www.inetdoc.net/travaux_pratiques/interco.netfilter.qa/">
<!ENTITY url.interco.inter-vlan '<link xmlns="http://docbook.org/ns/docbook" xlink:href="http://www.inetdoc.net/travaux_pratiques/interco.inter-vlan.qa/"><citetitle>Routage inter-VLAN</citetitle></link>'>
<!ENTITY url.interco.ospf '<link xmlns="http://docbook.org/ns/docbook" xlink:href="http://www.inetdoc.net/travaux_pratiques/interco.ospf.q/"><citetitle>Routage dynamique avec OSPF</citetitle></link>'>
<!ENTITY url.interco.ospf.answers "http://www.inetdoc.net/travaux_pratiques/interco.ospf.qa/">
<!ENTITY url.interco.ospf.default "http://www.inetdoc.net/travaux_pratiques/interco.ospf.qa/interco.ospf.default-information.html">
<!ENTITY url.interco.cs '<link xmlns="http://docbook.org/ns/docbook" xlink:href="http://www.inetdoc.net/travaux_pratiques/interco.cs/"><citetitle>Étude de cas de synthèse sur l&#39;interconnexion LAN/WAN</citetitle></link>'>
<!--###################################################
                   Dev
    ################################################### --><!ENTITY url.socket-c '<link xmlns="http://docbook.org/ns/docbook" xlink:href="http://www.inetdoc.net/dev/socket-c/"><citetitle>Initiation au développement C sur les sockets</citetitle></link>'>
<!ENTITY url.socket-c.udp-client '<link xmlns="http://docbook.org/ns/docbook" xlink:href="http://www.inetdoc.net/dev/socket-c/socket-c.udp.client.html#socket-c.udp.client.source"><citetitle>Code du programme udp-client.c</citetitle></link>'>
<!--###################################################
                   Externes
    ################################################### --><!ENTITY url.802.3 '<link xmlns="http://docbook.org/ns/docbook" xlink:href="http://standards.ieee.org/about/get/802/802.3.html"><citetitle>IEEE 802.3™: ETHERNET</citetitle></link>'>
<!ENTITY url.ethernet.types '<link xmlns="http://docbook.org/ns/docbook" xlink:href="http://www.iana.org/assignments/ethernet-numbers"><citetitle>ETHER TYPES</citetitle></link>'>
<!ENTITY url.ieee.macaddr '<link xmlns="http://docbook.org/ns/docbook" xlink:href="http://standards.ieee.org/develop/regauth/tut/macgrp.pdf"><citetitle>Standard Group MAC Addresses: A Tutorial Guide</citetitle></link>'>
<!ENTITY url.ieee.eui64 '<link xmlns="http://docbook.org/ns/docbook" xlink:href="http://standards.ieee.org/develop/regauth/tut/eui64.pdf"><citetitle>Guidelines for 64-bit Global Identifier (EUI-64™) Registration Authority</citetitle></link>'>
<!ENTITY url.nat-howto '<link xmlns="http://docbook.org/ns/docbook" xlink:href="http://www.netfilter.org/documentation/HOWTO/fr/NAT-HOWTO.html"><citetitle>Guide Pratique du NAT</citetitle></link>'>
<!ENTITY url.packet.filtering.howto '<link xmlns="http://docbook.org/ns/docbook" xlink:href="http://www.netfilter.org/documentation/HOWTO/fr/packet-filtering-HOWTO.html"><citetitle>Guide Pratique du Filtrage de Paquets</citetitle></link>'>
<!ENTITY url.debian-reference '<link xmlns="http://docbook.org/ns/docbook" xlink:href="http://www.debian.org/doc/manuals/debian-reference/"><citetitle>Manuel de référence Debian</citetitle></link>'>
<!ENTITY url.debian-reference.kernel '<link xmlns="http://docbook.org/ns/docbook" xlink:href="http://www.debian.org/doc/manuals/debian-reference/ch09.fr.html#_the_kernel"><citetitle>Manuel de référence Debian : le noyau</citetitle></link>'>
<!ENTITY url.debian-reference.networking '<link xmlns="http://docbook.org/ns/docbook" xlink:href="http://www.debian.org/doc/manuals/debian-reference/ch05.fr.html"><citetitle>Manuel de référence Debian : configuration du réseau</citetitle></link>'>
<!-- IANA --><!ENTITY url.icmp-types '<link xmlns="http://docbook.org/ns/docbook" xlink:href="http://www.iana.org/assignments/icmp-parameters">
   <citetitle>ICMP parameters</citetitle></link>'>
<!-- Kernel --><!ENTITY url.packetflow '<link xmlns="http://docbook.org/ns/docbook" xlink:href="http://ebtables.sourceforge.net/br_fw_ia/PacketFlow.png">
   <citetitle>Linux kernel packet flow</citetitle></link>'>
]>
<article xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xml:id="interco.netfilter.qa" xml:lang="fr">

<info>
  <title xmlns:xlink="http://www.w3.org/1999/xlink">Filtrage réseau avec netfilter/iptables</title>

  <authorgroup xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<author xmlns:xlink="http://www.w3.org/1999/xlink">
  <personname xmlns:xlink="http://www.w3.org/1999/xlink">
    <firstname xmlns:xlink="http://www.w3.org/1999/xlink">Philippe</firstname><surname xmlns:xlink="http://www.w3.org/1999/xlink">Latu</surname>
  </personname>
  <affiliation xmlns:xlink="http://www.w3.org/1999/xlink">
    <shortaffil xmlns:xlink="http://www.w3.org/1999/xlink">inetdoc.net</shortaffil>
    <jobtitle xmlns:xlink="http://www.w3.org/1999/xlink">Enseignant - Chargé de mission Systèmes &amp; Réseaux</jobtitle>
    <orgname xmlns:xlink="http://www.w3.org/1999/xlink">IUT - Université Toulouse III - Paul Sabatier</orgname>
    <address xmlns:xlink="http://www.w3.org/1999/xlink"><email xmlns:xlink="http://www.w3.org/1999/xlink">philippe.latu(at)inetdoc.net</email></address>
  </affiliation>
</author>
</authorgroup>

  <abstract xmlns:xlink="http://www.w3.org/1999/xlink">
    <para xmlns:xlink="http://www.w3.org/1999/xlink">Étude du filtrage réseau dans le contexte d'un routeur central
    (<wordasword xmlns:xlink="http://www.w3.org/1999/xlink">hub</wordasword>) connecté à un routeur d'agence
    (<wordasword xmlns:xlink="http://www.w3.org/1999/xlink">spoke</wordasword>) via un lien <acronym xmlns:xlink="http://www.w3.org/1999/xlink">WAN</acronym>. Comme
    dans les autres supports de travaux pratiques de cette série, on assimile
    ces configurations types à des interconnexions entre réseaux locaux et
    réseaux étendus. Les questions de ce support sont présentées comme une
    introduction pas à pas au filtrage réseau. On débute avec les outils, on
    poursuit avec les fonctions de suivi de communication (<wordasword xmlns:xlink="http://www.w3.org/1999/xlink">stateful
    inspection</wordasword>) sur une interface, puis on ajoute à ce filtrage
    les fonctions de traduction d'adresse (<acronym xmlns:xlink="http://www.w3.org/1999/xlink">NAT</acronym>).</para>
  </abstract>

  <keywordset xmlns:xlink="http://www.w3.org/1999/xlink">
    <keyword xmlns:xlink="http://www.w3.org/1999/xlink">icmp</keyword>
    <keyword xmlns:xlink="http://www.w3.org/1999/xlink">ifconfig</keyword>
    <keyword xmlns:xlink="http://www.w3.org/1999/xlink">interface</keyword>
    <keyword xmlns:xlink="http://www.w3.org/1999/xlink">iptables</keyword>
    <keyword xmlns:xlink="http://www.w3.org/1999/xlink">iptables-save</keyword>
    <keyword xmlns:xlink="http://www.w3.org/1999/xlink">iptables-restore</keyword>
    <keyword xmlns:xlink="http://www.w3.org/1999/xlink">iptstate</keyword>
    <keyword xmlns:xlink="http://www.w3.org/1999/xlink">netfilter</keyword>
    <keyword xmlns:xlink="http://www.w3.org/1999/xlink">recent</keyword>
  </keywordset>
</info>

<sect1 xmlns:xlink="http://www.w3.org/1999/xlink" xml:id="interco.netfilter.qa.legal.meta">
  <title xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">Copyright et Licence</title>

<literallayout xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" class="monospaced">Copyright (c) 2000,2012 Philippe Latu.
Permission is granted to copy, distribute and/or modify this document under the
terms of the GNU Free Documentation License, Version 1.3 or any later version
published by the Free Software Foundation; with no Invariant Sections, no
Front-Cover Texts, and no Back-Cover Texts. A copy of the license is included
in the section entitled "GNU Free Documentation License".</literallayout>

<literallayout xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" class="monospaced">Copyright (c) 2000,2012 Philippe Latu.
Permission est accordée de copier, distribuer et/ou modifier ce document selon
les termes de la Licence de Documentation Libre GNU (GNU Free Documentation
License), version 1.3 ou toute version ultérieure publiée par la Free Software
Foundation ; sans Sections Invariables ; sans Texte de Première de Couverture,
et sans Texte de Quatrième de Couverture. Une copie de la présente Licence est
incluse dans la section intitulée « Licence de Documentation Libre GNU ».</literallayout>


  <sect2 xmlns:xlink="http://www.w3.org/1999/xlink" xml:id="interco.netfilter.qa.meta">
    <title xmlns:xlink="http://www.w3.org/1999/xlink">Méta-information</title>
    
  <para xmlns:xlink="http://www.w3.org/1999/xlink">Cet article est écrit avec <link xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="http://www.docbook.org"><citetitle xmlns:xlink="http://www.w3.org/1999/xlink">DocBook</citetitle></link> XML
  sur un système <link xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="http://www.debian.org"><citetitle xmlns:xlink="http://www.w3.org/1999/xlink">Debian
  GNU/Linux</citetitle></link>. Il est disponible en version imprimable au
  format PDF : <link xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="http://www.inetdoc.net/pdf/interco.netfilter.qa.pdf"><literal xmlns:xlink="http://www.w3.org/1999/xlink">interco.netfilter.qa.pdf</literal></link>.</para>

  <para xmlns:xlink="http://www.w3.org/1999/xlink">Toutes les commandes utilisées dans ce document ne sont pas spécifiques
  à une version particulière des systèmes UNIX ou GNU/Linux. C'est la
  distribution <citetitle xmlns:xlink="http://www.w3.org/1999/xlink">Debian GNU/Linux</citetitle> qui est utilisée
  pour les tests présentés. Voici une liste des paquets contenant les
  commandes :</para>
  <itemizedlist xmlns:xlink="http://www.w3.org/1999/xlink">
    <listitem xmlns:xlink="http://www.w3.org/1999/xlink">
    <para xmlns:xlink="http://www.w3.org/1999/xlink"><application xmlns:xlink="http://www.w3.org/1999/xlink">procps</application> - The /proc file system
    utilities</para>
    </listitem>
    <listitem xmlns:xlink="http://www.w3.org/1999/xlink">
    <para xmlns:xlink="http://www.w3.org/1999/xlink"><application xmlns:xlink="http://www.w3.org/1999/xlink">net-tools</application> - The NET-3 networking
    toolkit</para>
    </listitem>
    <listitem xmlns:xlink="http://www.w3.org/1999/xlink">
    <para xmlns:xlink="http://www.w3.org/1999/xlink"><application xmlns:xlink="http://www.w3.org/1999/xlink">ifupdown</application> - High level tools to configure
    network interfaces</para>
    </listitem>
    <listitem xmlns:xlink="http://www.w3.org/1999/xlink">
    <para xmlns:xlink="http://www.w3.org/1999/xlink"><application xmlns:xlink="http://www.w3.org/1999/xlink">iputils-ping</application> - Tools to test the
    reachability of network hosts</para>
    </listitem>
    <listitem xmlns:xlink="http://www.w3.org/1999/xlink">
    <para xmlns:xlink="http://www.w3.org/1999/xlink"><application xmlns:xlink="http://www.w3.org/1999/xlink">hping3</application> - Active Network Smashing
    Tool</para>
    </listitem>
    <listitem xmlns:xlink="http://www.w3.org/1999/xlink">
    <para xmlns:xlink="http://www.w3.org/1999/xlink"><application xmlns:xlink="http://www.w3.org/1999/xlink">iptables</application> - Administration tools for packet
    filtering and NAT</para>
    </listitem>
    <listitem xmlns:xlink="http://www.w3.org/1999/xlink">
    <para xmlns:xlink="http://www.w3.org/1999/xlink"><application xmlns:xlink="http://www.w3.org/1999/xlink">iptstate</application> - Top-like state for netfilter/iptables</para>
    </listitem>
  </itemizedlist>
  </sect2>

  <sect2 xmlns:xlink="http://www.w3.org/1999/xlink" xml:id="interco.netfilter.qa.convtypo">
    <title xmlns:xlink="http://www.w3.org/1999/xlink">Conventions typographiques</title>

  <para xmlns:xlink="http://www.w3.org/1999/xlink">Tous les exemples d'exécution des commandes sont précédés d'une invite
  utilisateur ou <wordasword xmlns:xlink="http://www.w3.org/1999/xlink">prompt</wordasword> spécifique au niveau des
  droits utilisateurs nécessaires sur le système.</para>

  <itemizedlist xmlns:xlink="http://www.w3.org/1999/xlink">
    <listitem xmlns:xlink="http://www.w3.org/1999/xlink">
    <para xmlns:xlink="http://www.w3.org/1999/xlink">Toute commande précédée de l'invite <prompt xmlns:xlink="http://www.w3.org/1999/xlink">$</prompt> ne nécessite
    aucun privilège particulier et peut être utilisée au niveau utilisateur
    simple.</para>
    </listitem>
    <listitem xmlns:xlink="http://www.w3.org/1999/xlink">
    <para xmlns:xlink="http://www.w3.org/1999/xlink">Toute commande précédée de l'invite <prompt xmlns:xlink="http://www.w3.org/1999/xlink">#</prompt> nécessite les
    privilèges du super utilisateur.</para>
    </listitem>
  </itemizedlist>
  </sect2>
</sect1>

<?custom-pagebreak?>
<sect1 xmlns:xlink="http://www.w3.org/1999/xlink" xml:id="interco.netfilter.qa.archi">
  <title xmlns:xlink="http://www.w3.org/1999/xlink">Architecture réseau étudiée</title>

  <para xmlns:xlink="http://www.w3.org/1999/xlink">Les manipulations sur le système de filtrage réseau présentées ici
  s'appuient sur une maquette type qui illustre une «branche» de la topologie
  <citetitle xmlns:xlink="http://www.w3.org/1999/xlink">Hub and Spoke</citetitle>. Dans cette topologie en étoile, le
  <link xmlns:xlink="http://www.w3.org/1999/xlink" linkend="interco.netfilter.qa.topologie.hub">routeur
  central</link> joue le rôle d'un concentrateur qui fournit les accès réseau à
  tous les <link xmlns:xlink="http://www.w3.org/1999/xlink" linkend="interco.netfilter.qa.topologie.spoke">routeurs
  d'agence</link>.</para>

  <sect2 xmlns:xlink="http://www.w3.org/1999/xlink" xml:id="interco.netfilter.qa.archi.topologie">
    <title xmlns:xlink="http://www.w3.org/1999/xlink">Topologie type</title>

  <para xmlns:xlink="http://www.w3.org/1999/xlink">La topologie étudiée associe deux postes de travaux pratiques avec deux
  rôles distincts.</para>
 
  <variablelist xmlns:xlink="http://www.w3.org/1999/xlink">
    <varlistentry xmlns:xlink="http://www.w3.org/1999/xlink" xml:id="interco.netfilter.qa.topologie.hub">
    <term xmlns:xlink="http://www.w3.org/1999/xlink">Routeur central</term>
    <term xmlns:xlink="http://www.w3.org/1999/xlink"><wordasword xmlns:xlink="http://www.w3.org/1999/xlink">hub</wordasword></term>
    <term xmlns:xlink="http://www.w3.org/1999/xlink"><wordasword xmlns:xlink="http://www.w3.org/1999/xlink">Remote Access Server</wordasword></term>
    <term xmlns:xlink="http://www.w3.org/1999/xlink"><acronym xmlns:xlink="http://www.w3.org/1999/xlink">RAS</acronym></term>
    <listitem xmlns:xlink="http://www.w3.org/1999/xlink">
    <para xmlns:xlink="http://www.w3.org/1999/xlink">Ce poste réalise une interconnexion <acronym xmlns:xlink="http://www.w3.org/1999/xlink">LAN/WAN</acronym>. Il
    fournit un accès Internet au routeur d'agence client via son interface
    <acronym xmlns:xlink="http://www.w3.org/1999/xlink">WAN</acronym>. Il dispose de son propre accès Internet via son
    interface <acronym xmlns:xlink="http://www.w3.org/1999/xlink">LAN</acronym> Ethernet.</para>
    </listitem>
    </varlistentry>
    <varlistentry xmlns:xlink="http://www.w3.org/1999/xlink" xml:id="interco.netfilter.qa.topologie.spoke">
    <term xmlns:xlink="http://www.w3.org/1999/xlink">Routeur d'agence</term>
    <term xmlns:xlink="http://www.w3.org/1999/xlink"><wordasword xmlns:xlink="http://www.w3.org/1999/xlink">spoke</wordasword></term>
    <term xmlns:xlink="http://www.w3.org/1999/xlink"><wordasword xmlns:xlink="http://www.w3.org/1999/xlink">Customer Premises Equipment</wordasword></term>
    <term xmlns:xlink="http://www.w3.org/1999/xlink"><acronym xmlns:xlink="http://www.w3.org/1999/xlink">CPE</acronym></term>
    <listitem xmlns:xlink="http://www.w3.org/1999/xlink">
    <para xmlns:xlink="http://www.w3.org/1999/xlink">Ce poste réalise aussi une interconnexion <acronym xmlns:xlink="http://www.w3.org/1999/xlink">LAN/WAN</acronym>.
    À la différence du routeur central, il obtient l'accès Internet sur son
    interface <acronym xmlns:xlink="http://www.w3.org/1999/xlink">WAN</acronym> et il met cet accès à disposition d'un
    réseau local d'extrémité via une interface <acronym xmlns:xlink="http://www.w3.org/1999/xlink">LAN</acronym> Ethernet
    (et|ou) une autre «pseudo» interface réseau.</para>
    </listitem>
    </varlistentry>
  </variablelist>

<screen xmlns:xlink="http://www.w3.org/1999/xlink" width="80">        __    cooper.infra.stri   
    ___/  \_        .___.
  _/        \__     |   |    Switch1 - sw1.infra.stri
 /             \eth1| ==|eth0   ___________ / /______
| Internet      |___| ==|_     |_=_=_=_=_=_/ /_=_=_=_|
\_           __/    |  -| \ fa0/1|        / /          V
  \__     __/       |   |  \____/                      |
     \___/          |   |                              O
                   -------      ___________ / /______  |
                               |_=_=_=_=_=_/ /_=_=_=_| |
                                 |                 \___| 
                             eth0|.....
    ..................          .---PC-,~
                                | _|____'
                                \(_______)
                                 |Routeur|
        Rôle «HUB»               (_______)
    ..................            / ippp0
                                 /__
                                    /
                                   /
                             ippp0|..... 
    ..................           .---PC-,~
                                 | _|____'
                                 \(_______)
                           _______|Routeur|
       Rôle «SPOKE»        eth0   (_______)
    ..................     _________/
                           dummy0
</screen>

  <para xmlns:xlink="http://www.w3.org/1999/xlink">Pour les besoins des questions de travaux pratiques ci-après, on se
  limite à un scénario simple d'utilisation des fonctions de filtrage
  réseau.</para>

  <para xmlns:xlink="http://www.w3.org/1999/xlink">Le <link xmlns:xlink="http://www.w3.org/1999/xlink" linkend="interco.netfilter.qa.topologie.hub">routeur
  central</link> doit s'assurer que le trafic réseau qu'il route vers
  l'Internet provient bien de son <link xmlns:xlink="http://www.w3.org/1999/xlink" linkend="interco.netfilter.qa.topologie.spoke">routeur d'agence</link>
  auquel il a attribué une adresse <acronym xmlns:xlink="http://www.w3.org/1999/xlink">IP</acronym> via
  <acronym xmlns:xlink="http://www.w3.org/1999/xlink">PPP</acronym>. Ce routeur central doit limiter le volume de trafic
  <acronym xmlns:xlink="http://www.w3.org/1999/xlink">ICMP</acronym> pour éviter les éventuels dénis de services relatifs
  à ce protocole. Il peut aussi intercepter toutes les requêtes
  <acronym xmlns:xlink="http://www.w3.org/1999/xlink">DNS</acronym> du routeur d'agence en exploitant un service de type
  <wordasword xmlns:xlink="http://www.w3.org/1999/xlink">cache only</wordasword> pour éviter les falsifications des
  réponses aux questions émises par les postes client du réseau
  d'agence.</para>

  <para xmlns:xlink="http://www.w3.org/1999/xlink">Le <link xmlns:xlink="http://www.w3.org/1999/xlink" linkend="interco.netfilter.qa.topologie.spoke">routeur
  d'agence</link> doit s'assurer que le trafic réseau entrant sur son interface
  <acronym xmlns:xlink="http://www.w3.org/1999/xlink">WAN</acronym> est bien relatif à une demande qui a été émise via
  cette même interface. Ce routeur d'agence doit «masquer» son réseau local
  d'extrémité à l'aide des fonctions de traduction d'adresse source
  <acronym xmlns:xlink="http://www.w3.org/1999/xlink">S-NAT</acronym>. Il doit aussi ouvrir un accès d'administration
  <acronym xmlns:xlink="http://www.w3.org/1999/xlink">SSH</acronym> tout en se protégeant des attaques de type
  dictionnaire qui consistent à essayer de se connecter au poste avec des
  milliers de couples <wordasword xmlns:xlink="http://www.w3.org/1999/xlink">login/password</wordasword> connus. Enfin, ce
  même routeur d'agence doit donner accès à un service Web hébergé dans un
  périmètre dédié au sein de cette agence.</para>

  <para xmlns:xlink="http://www.w3.org/1999/xlink">Pour traiter les questions ci-après, il est vivement conseillé de
  s'appuyer sur la <xref xmlns:xlink="http://www.w3.org/1999/xlink" linkend="interco.netfilter.qa.refdocs"/>.</para>
  </sect2>

  <sect2 xmlns:xlink="http://www.w3.org/1999/xlink" xml:id="interco.netfilter.qa.archi.adressage">
    <title xmlns:xlink="http://www.w3.org/1999/xlink">Plan d'adressage WAN</title>

  <para xmlns:xlink="http://www.w3.org/1999/xlink">Le plan d'adressage des liaisons <acronym xmlns:xlink="http://www.w3.org/1999/xlink">WAN</acronym> reprend celui
  du support de travaux pratiques <link xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="http://www.inetdoc.net/travaux_pratiques/interco.ppp.q/"><citetitle xmlns:xlink="http://www.w3.org/1999/xlink">Topologie Hub &amp; Spoke avec le protocole PPP</citetitle></link>.</para>

  <table xmlns:xlink="http://www.w3.org/1999/xlink" xml:id="WAN.addressing" frame="all" pgwide="1">
    <title xmlns:xlink="http://www.w3.org/1999/xlink">Plan d'adressage liaisons WAN</title>
    <tgroup xmlns:xlink="http://www.w3.org/1999/xlink" cols="6">
      <colspec xmlns:xlink="http://www.w3.org/1999/xlink" colnum="1" colwidth="3*"/>
      <colspec xmlns:xlink="http://www.w3.org/1999/xlink" colnum="2" colwidth="1*"/>
      <colspec xmlns:xlink="http://www.w3.org/1999/xlink" colnum="3" colwidth="1*"/>
      <colspec xmlns:xlink="http://www.w3.org/1999/xlink" colnum="4" colwidth="5*"/>
      <colspec xmlns:xlink="http://www.w3.org/1999/xlink" colnum="5" colwidth="1*"/>
      <colspec xmlns:xlink="http://www.w3.org/1999/xlink" colnum="6" colwidth="3*"/>
    <thead xmlns:xlink="http://www.w3.org/1999/xlink">
      <row xmlns:xlink="http://www.w3.org/1999/xlink">
      <entry xmlns:xlink="http://www.w3.org/1999/xlink" align="left">Poste routeur central</entry>
      <entry xmlns:xlink="http://www.w3.org/1999/xlink">bus</entry>
      <entry xmlns:xlink="http://www.w3.org/1999/xlink">N° tél.</entry>
      <entry xmlns:xlink="http://www.w3.org/1999/xlink">Adresses IP hub:spoke</entry>
      <entry xmlns:xlink="http://www.w3.org/1999/xlink">N° tél.</entry>
      <entry xmlns:xlink="http://www.w3.org/1999/xlink" align="left">Poste routeur d'agence</entry>
      </row>
    </thead>
    <tbody xmlns:xlink="http://www.w3.org/1999/xlink">
      <row xmlns:xlink="http://www.w3.org/1999/xlink">
      <entry xmlns:xlink="http://www.w3.org/1999/xlink">alderaan</entry>
      <entry xmlns:xlink="http://www.w3.org/1999/xlink">S0.1</entry>
      <entry xmlns:xlink="http://www.w3.org/1999/xlink">104</entry>
      <entry xmlns:xlink="http://www.w3.org/1999/xlink"><systemitem xmlns:xlink="http://www.w3.org/1999/xlink" class="ipaddress">192.168.104.1:192.168.104.2</systemitem></entry>
      <entry xmlns:xlink="http://www.w3.org/1999/xlink">105</entry>
      <entry xmlns:xlink="http://www.w3.org/1999/xlink">bespin</entry>
      </row>
      <row xmlns:xlink="http://www.w3.org/1999/xlink">
      <entry xmlns:xlink="http://www.w3.org/1999/xlink">centares</entry>
      <entry xmlns:xlink="http://www.w3.org/1999/xlink">S0.2</entry>
      <entry xmlns:xlink="http://www.w3.org/1999/xlink">106</entry>
      <entry xmlns:xlink="http://www.w3.org/1999/xlink"><systemitem xmlns:xlink="http://www.w3.org/1999/xlink" class="ipaddress">192.168.106.1:192.168.106.2</systemitem></entry>
      <entry xmlns:xlink="http://www.w3.org/1999/xlink">107</entry>
      <entry xmlns:xlink="http://www.w3.org/1999/xlink">coruscant</entry>
      </row>
      <row xmlns:xlink="http://www.w3.org/1999/xlink">
      <entry xmlns:xlink="http://www.w3.org/1999/xlink">dagobah</entry>
      <entry xmlns:xlink="http://www.w3.org/1999/xlink">S0.3</entry>
      <entry xmlns:xlink="http://www.w3.org/1999/xlink">108</entry>
      <entry xmlns:xlink="http://www.w3.org/1999/xlink"><systemitem xmlns:xlink="http://www.w3.org/1999/xlink" class="ipaddress">192.168.108.1:192.168.108.2</systemitem></entry>
      <entry xmlns:xlink="http://www.w3.org/1999/xlink">109</entry>
      <entry xmlns:xlink="http://www.w3.org/1999/xlink">endor</entry>
      </row>
      <row xmlns:xlink="http://www.w3.org/1999/xlink">
      <entry xmlns:xlink="http://www.w3.org/1999/xlink">felucia</entry>
      <entry xmlns:xlink="http://www.w3.org/1999/xlink">S0.4</entry>
      <entry xmlns:xlink="http://www.w3.org/1999/xlink">110</entry>
      <entry xmlns:xlink="http://www.w3.org/1999/xlink"><systemitem xmlns:xlink="http://www.w3.org/1999/xlink" class="ipaddress">192.168.110.1:192.168.110.2</systemitem></entry>
      <entry xmlns:xlink="http://www.w3.org/1999/xlink">111</entry>
      <entry xmlns:xlink="http://www.w3.org/1999/xlink">geonosis</entry>
      </row>
      <row xmlns:xlink="http://www.w3.org/1999/xlink">
      <entry xmlns:xlink="http://www.w3.org/1999/xlink">hoth</entry>
      <entry xmlns:xlink="http://www.w3.org/1999/xlink">S0.5</entry>
      <entry xmlns:xlink="http://www.w3.org/1999/xlink">112</entry>
      <entry xmlns:xlink="http://www.w3.org/1999/xlink"><systemitem xmlns:xlink="http://www.w3.org/1999/xlink" class="ipaddress">192.168.112.1:192.168.112.2</systemitem></entry>
      <entry xmlns:xlink="http://www.w3.org/1999/xlink">113</entry>
      <entry xmlns:xlink="http://www.w3.org/1999/xlink">mustafar</entry>
      </row>
      <row xmlns:xlink="http://www.w3.org/1999/xlink">
      <entry xmlns:xlink="http://www.w3.org/1999/xlink">naboo</entry>
      <entry xmlns:xlink="http://www.w3.org/1999/xlink">S0.6</entry>
      <entry xmlns:xlink="http://www.w3.org/1999/xlink">114</entry>
      <entry xmlns:xlink="http://www.w3.org/1999/xlink"><systemitem xmlns:xlink="http://www.w3.org/1999/xlink" class="ipaddress">192.168.114.1:192.168.114.2</systemitem></entry>
      <entry xmlns:xlink="http://www.w3.org/1999/xlink">115</entry>
      <entry xmlns:xlink="http://www.w3.org/1999/xlink">tatooine</entry> 
      </row>
<!--      <row>
      <entry>tatooine</entry>
      <entry>S0.7</entry>
      <entry>116</entry>
      <entry><systemitem class='ipaddress'>192.168.116.1:192.168.116.2</systemitem></entry>
      <entry>117</entry>
      <entry>???</entry>
      </row>-->
    </tbody>
    </tgroup>
  </table>
  </sect2> 
</sect1>

<sect1 xmlns:xlink="http://www.w3.org/1999/xlink" xml:id="interco.netfilter.qa.tools">
  <title xmlns:xlink="http://www.w3.org/1999/xlink">Les outils de filtrage réseau</title>

  <para xmlns:xlink="http://www.w3.org/1999/xlink">Sur un système GNU/Linux, les fonctions de filtrage réseau sont
  réparties entre les espaces mémoire noyau
  (<wordasword xmlns:xlink="http://www.w3.org/1999/xlink">kernelspace</wordasword>) et utilisateur
  (<wordasword xmlns:xlink="http://www.w3.org/1999/xlink">userspace</wordasword>).</para>

  <para xmlns:xlink="http://www.w3.org/1999/xlink">Que l'on utilise un noyau fourni par la distribution au le noyau
  construit à l'issue des travaux pratiques <link xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="http://www.inetdoc.net/travaux_pratiques/interco.kernel.q/"><citetitle xmlns:xlink="http://www.w3.org/1999/xlink">Configuration des fonctions réseau &amp; compilation du noyau Linux</citetitle></link>, les
  fonctions de filtrage réseau sont disponibles sous forme de modules que l'on
  (charge|décharge) de la mémoire système en cours d'exécution. Les outils de
  filtrage réseau du noyau Linux chargent dynamiquement ces modules en fonction
  de la syntaxe des règles de filtrage saisies.</para>

  <sect2 xmlns:xlink="http://www.w3.org/1999/xlink" xml:id="interco.netfilter.qa.tools.iptables">
    <title xmlns:xlink="http://www.w3.org/1999/xlink">Questions sur iptables</title>

  <qandaset xmlns:xlink="http://www.w3.org/1999/xlink" defaultlabel="number">
    <qandaentry xmlns:xlink="http://www.w3.org/1999/xlink">
    <question xmlns:xlink="http://www.w3.org/1999/xlink">
    <para xmlns:xlink="http://www.w3.org/1999/xlink"><phrase xmlns:xlink="http://www.w3.org/1999/xlink">Quels paquets contiennent les outils utilisateur principaux
    de manipulation des fonctions de filtrage réseau ?</phrase></para>

    <para xmlns:xlink="http://www.w3.org/1999/xlink">Rechercher dans le cache du gestionnaire de paquets de la
    distribution des mots clés tels que <option xmlns:xlink="http://www.w3.org/1999/xlink">iptables</option> ou
    <option xmlns:xlink="http://www.w3.org/1999/xlink">firewall</option> à l'aide des commandes
    <command xmlns:xlink="http://www.w3.org/1999/xlink">apt-cache</command> ou <command xmlns:xlink="http://www.w3.org/1999/xlink">aptitude</command>.</para>

    <para xmlns:xlink="http://www.w3.org/1999/xlink">Dans le cadre des travaux pratiques, seuls les outils élémentaires
    sont utilisés pour faciliter la compréhension des mécanismes de suivi de
    communication du système de filtrage réseau. On ne s'intéresse donc pas aux
    paquets qui fournissent des solutions de filtrage «clé en main».</para>
    </question>
    <answer xmlns:xlink="http://www.w3.org/1999/xlink">
    <para xmlns:xlink="http://www.w3.org/1999/xlink">On sait que la partie <wordasword xmlns:xlink="http://www.w3.org/1999/xlink">userspace</wordasword> des
    fonctions de filtrage réseau s'appelle <application xmlns:xlink="http://www.w3.org/1999/xlink">iptables</application>.
    On lance donc une recherche avec ce mot clé dans la base de données des
    paquets Debian et on installe les paquets intéressants.</para>

    <para xmlns:xlink="http://www.w3.org/1999/xlink">Une recherche simple dans le catalogue des paquets donne le résultat
    suivant.</para>

<screen xmlns:xlink="http://www.w3.org/1999/xlink" width="80"><prompt xmlns:xlink="http://www.w3.org/1999/xlink">$</prompt> aptitude search iptables
p   arno-iptables-firewall       - single- and multi-homed firewall script with DSL/ADSL support
i   <emphasis xmlns:xlink="http://www.w3.org/1999/xlink">iptables</emphasis>                     - Outils d'administration pour le filtrage de paquets et le NAT
p   iptables-dev                 - iptables development files
p   iptables-persistent          - Simple package to set up iptables on boot
p   libiptables-chainmgr-perl    - Perl extension for manipulating iptables policies
p   libiptables-parse-perl       - Perl extension for parsing iptables firewall rulesets</screen>

    <para xmlns:xlink="http://www.w3.org/1999/xlink">Une recherche plus précise dans les descriptions de paquets donne une
    liste plus étoffée.</para>

<screen xmlns:xlink="http://www.w3.org/1999/xlink" width="80"># aptitude search '~diptables' | grep ipt
p   apf-firewall                    - easy iptables based firewall system
p   arno-iptables-firewall          - single- and multi-homed firewall script wi
p   firehol                         - An easy to use but powerful iptables state
p   fwsnort                         - Snort-to-iptables rule translator
p   ipkungfu                        - iptables-based Linux firewall
i   <emphasis xmlns:xlink="http://www.w3.org/1999/xlink">iptables</emphasis>                        - Outils d'administration pour le filtrage d
p   iptables-dev                    - iptables development files
p   iptables-persistent             - Simple package to set up iptables on boot
i   <emphasis xmlns:xlink="http://www.w3.org/1999/xlink">iptstate</emphasis>                        - Top-like state for netfilter/iptables
p   libiptables-chainmgr-perl       - Perl extension for manipulating iptables p
p   libiptables-parse-perl          - Perl extension for parsing iptables firewa
p   mxallowd                        - Anti-Spam-Daemon using nolisting/iptables
p   netscript-2.4                   - Linux 2.4.x (and 2.6.x) router/firewall ne
p   uif                             - Advanced iptables-firewall script
p   uruk                            - Very small firewall script, for configurin
i   xtables-addons-common           - Extensions targets and matches for iptable
p   xtables-addons-source           - Extensions targets and matches for iptable</screen>

    <para xmlns:xlink="http://www.w3.org/1999/xlink">Comme on doit rester à un faible niveau d'intégration des règles de
    filtrage de manière à bien illustrer les mécanismes de suivi de
    communication. Les deux paquets retenus sont
    <application xmlns:xlink="http://www.w3.org/1999/xlink">iptables</application> et <application xmlns:xlink="http://www.w3.org/1999/xlink">iptstate</application>.
    On utilise les commandes usuelles d'installation et de consultation des
    informations sur ces deux paquets.</para>

<screen xmlns:xlink="http://www.w3.org/1999/xlink" width="80"><prompt xmlns:xlink="http://www.w3.org/1999/xlink">#</prompt> aptitude install iptables iptstate
&lt;snipped/&gt;
<prompt xmlns:xlink="http://www.w3.org/1999/xlink">#</prompt> apt-cache show iptables
&lt;snipped/&gt;
<prompt xmlns:xlink="http://www.w3.org/1999/xlink">#</prompt> apt-cache show iptstate
&lt;snipped/&gt;
</screen>
    </answer>
    </qandaentry>

    <qandaentry xmlns:xlink="http://www.w3.org/1999/xlink">
    <question xmlns:xlink="http://www.w3.org/1999/xlink">
    <para xmlns:xlink="http://www.w3.org/1999/xlink"><phrase xmlns:xlink="http://www.w3.org/1999/xlink">Quelles sont les options de la commande
    <application xmlns:xlink="http://www.w3.org/1999/xlink">iptables</application> qui permettent de visualiser les règles
    de filtrage réseau actives ainsi que les compteurs
    correspondants ? Quelle option faut-il préciser pour spécifier la
    table consultée : <application xmlns:xlink="http://www.w3.org/1999/xlink">netfilter</application> ou
    <application xmlns:xlink="http://www.w3.org/1999/xlink">nat</application>.</phrase></para>

    <para xmlns:xlink="http://www.w3.org/1999/xlink">Consulter les pages de manuels via
    <userinput xmlns:xlink="http://www.w3.org/1999/xlink"><prompt xmlns:xlink="http://www.w3.org/1999/xlink">#</prompt> man iptables</userinput>.</para>
    </question>
    <answer xmlns:xlink="http://www.w3.org/1999/xlink">
    <para xmlns:xlink="http://www.w3.org/1999/xlink">La consultation des pages de manuels permet de relever le jeu
    d'options <option xmlns:xlink="http://www.w3.org/1999/xlink">-vL</option>.</para>

<screen xmlns:xlink="http://www.w3.org/1999/xlink" width="80"><prompt xmlns:xlink="http://www.w3.org/1999/xlink">#</prompt> iptables -vL
Chain INPUT (policy ACCEPT 0 packets, 0 bytes)
 pkts bytes target     prot opt in     out     source               destination

Chain FORWARD (policy ACCEPT 0 packets, 0 bytes)
 pkts bytes target     prot opt in     out     source               destination

Chain OUTPUT (policy ACCEPT 0 packets, 0 bytes)
 pkts bytes target     prot opt in     out     source               destination</screen>

    <para xmlns:xlink="http://www.w3.org/1999/xlink">La table <systemitem xmlns:xlink="http://www.w3.org/1999/xlink">netfilter</systemitem> est utilisée de façon
    implicite alors que la table <systemitem xmlns:xlink="http://www.w3.org/1999/xlink">nat</systemitem> de traduction
    d'adresses doit être appelée explicitement.</para>

<screen xmlns:xlink="http://www.w3.org/1999/xlink" width="80"># iptables -vL -t nat
Chain PREROUTING (policy ACCEPT 0 packets, 0 bytes)
 pkts bytes target     prot opt in     out     source               destination

Chain POSTROUTING (policy ACCEPT 0 packets, 0 bytes)
 pkts bytes target     prot opt in     out     source               destination

Chain OUTPUT (policy ACCEPT 0 packets, 0 bytes)
 pkts bytes target     prot opt in     out     source               destination
</screen>
    </answer>
    </qandaentry>

    <qandaentry xmlns:xlink="http://www.w3.org/1999/xlink">
    <question xmlns:xlink="http://www.w3.org/1999/xlink">
    <para xmlns:xlink="http://www.w3.org/1999/xlink"><phrase xmlns:xlink="http://www.w3.org/1999/xlink">Comment visualiser les modules chargés dynamiquement en
    fonction de l'utilisation des règles de filtrage
    réseau ?</phrase></para>

    <para xmlns:xlink="http://www.w3.org/1999/xlink">Utiliser la commande qui sert à lister les modules chargés en mémoire
    avant et après avoir consulté les tables de filtrage réseau pour la
    première fois.</para>
    </question>
    <answer xmlns:xlink="http://www.w3.org/1999/xlink">
    <para xmlns:xlink="http://www.w3.org/1999/xlink">La commande <command xmlns:xlink="http://www.w3.org/1999/xlink">lsmod</command> sert à lister les modules
    chargés en mémoire. En exécutant cette commande avant et après avoir
    utilisé <command xmlns:xlink="http://www.w3.org/1999/xlink">iptables</command>, on visualise par différence les
    nouveaux modules chargés par chaque appel. Par exemple, l'exécution des
    deux commandes de consultation de la question précédente provoque le
    chargement des modules suivants.</para>

    <itemizedlist xmlns:xlink="http://www.w3.org/1999/xlink">
      <listitem xmlns:xlink="http://www.w3.org/1999/xlink">
      <para xmlns:xlink="http://www.w3.org/1999/xlink">Après consultation de la table
      <systemitem xmlns:xlink="http://www.w3.org/1999/xlink">netfilter</systemitem> :</para>
<screen xmlns:xlink="http://www.w3.org/1999/xlink" width="80"># lsmod |less
Module                  Size  Used by
iptable_filter          2258  0 
ip_tables              13899  1 iptable_filter
x_tables               12845  1 ip_tables
&lt;snipped/&gt;
</screen>
      </listitem>
      <listitem xmlns:xlink="http://www.w3.org/1999/xlink">
      <para xmlns:xlink="http://www.w3.org/1999/xlink">Après consultation de la table
      <systemitem xmlns:xlink="http://www.w3.org/1999/xlink">nat</systemitem> :</para>
<screen xmlns:xlink="http://www.w3.org/1999/xlink" width="80"># lsmod |less
iptable_nat             4299  0 
nf_nat                 13388  1 iptable_nat
nf_conntrack_ipv4       9833  3 iptable_nat,nf_nat
nf_conntrack           46535  3 iptable_nat,nf_nat,nf_conntrack_ipv4
nf_defrag_ipv4          1139  1 nf_conntrack_ipv4
iptable_filter          2258  0 
ip_tables              13899  2 iptable_nat,iptable_filter
x_tables               12845  2 iptable_nat,ip_tables
&lt;snipped/&gt;
</screen>
      </listitem>
    </itemizedlist>
    </answer>
    </qandaentry>

    <qandaentry xmlns:xlink="http://www.w3.org/1999/xlink">
      <question xmlns:xlink="http://www.w3.org/1999/xlink">
      <para xmlns:xlink="http://www.w3.org/1999/xlink"><phrase xmlns:xlink="http://www.w3.org/1999/xlink">Quels sont les outils de sauvegarde et de restauration des
      jeux de règles de filtrage réseau fournis avec le paquet
      <application xmlns:xlink="http://www.w3.org/1999/xlink">iptables</application> ?</phrase></para>

      <para xmlns:xlink="http://www.w3.org/1999/xlink">Consulter la liste des fichiers du paquet
      <application xmlns:xlink="http://www.w3.org/1999/xlink">iptables</application>.</para>
      </question>
      <answer xmlns:xlink="http://www.w3.org/1999/xlink">
      <para xmlns:xlink="http://www.w3.org/1999/xlink">La liste des fichiers du paquet contient les outils
      recherchés :
      <userinput xmlns:xlink="http://www.w3.org/1999/xlink"># dpkg -L iptables |grep bin</userinput>.
      Les deux programmes <command xmlns:xlink="http://www.w3.org/1999/xlink">iptables-save</command> et
      <command xmlns:xlink="http://www.w3.org/1999/xlink">iptables-restore</command> permettent respectivement de
      sauvegarder et de restaurer l'ensemble des règles des tables
      <systemitem xmlns:xlink="http://www.w3.org/1999/xlink">netfilter</systemitem> et
      <systemitem xmlns:xlink="http://www.w3.org/1999/xlink">nat</systemitem>.</para>

      <para xmlns:xlink="http://www.w3.org/1999/xlink">Ces programmes sont indispensables pour éditer, insérer ou retirer
      des règles sans avoir à se préoccuper de l'ordre de saisie. De plus, le
      programme de restauration se charge de l'effacement des règles
      précédentes.</para>
      </answer>
    </qandaentry>
  </qandaset>
  </sect2>

  <sect2 xmlns:xlink="http://www.w3.org/1999/xlink" xml:id="interco.netfilter.qa.tools.netfilter">
    <title xmlns:xlink="http://www.w3.org/1999/xlink">Questions sur netfilter</title>

  <qandaset xmlns:xlink="http://www.w3.org/1999/xlink" defaultlabel="number">
    <qandaentry xmlns:xlink="http://www.w3.org/1999/xlink">
    <question xmlns:xlink="http://www.w3.org/1999/xlink">
    <para xmlns:xlink="http://www.w3.org/1999/xlink"><phrase xmlns:xlink="http://www.w3.org/1999/xlink">Comment identifier la version du noyau utilisée et la
    disponibilité des fonctions de filtrage réseau de cette
    version ?</phrase></para>

    <para xmlns:xlink="http://www.w3.org/1999/xlink">Après avoir utilisé la commande «historique» d'identification de la
    version du noyau, faire une recherche dans l'arborescence des modules de ce
    noyau avec la commande <command xmlns:xlink="http://www.w3.org/1999/xlink">find</command>. Trouver les fichiers dont
    le nom comprend la chaîne <option xmlns:xlink="http://www.w3.org/1999/xlink">netfilter</option>.</para>
    </question>
    <answer xmlns:xlink="http://www.w3.org/1999/xlink">
    <para xmlns:xlink="http://www.w3.org/1999/xlink">On utilise la commande <command xmlns:xlink="http://www.w3.org/1999/xlink">uname</command> que l'on associe à
    une recherche dans l'arborescence des modules du noyau en cours
    d'exécution.</para>

<screen xmlns:xlink="http://www.w3.org/1999/xlink" width="80">$ uname -r
2.6.32-5-amd64
$ find /lib/modules/`uname -r` -type d -name netfilter
/lib/modules/2.6.32-5-amd64/kernel/net/bridge/netfilter <co xml:id="netfilter.bridge"/>
/lib/modules/2.6.32-5-amd64/kernel/net/ipv4/netfilter   <co xml:id="netfilter.ipv4"/>
/lib/modules/2.6.32-5-amd64/kernel/net/decnet/netfilter
/lib/modules/2.6.32-5-amd64/kernel/net/ipv6/netfilter   <co xml:id="netfilter.ipv6"/>
/lib/modules/2.6.32-5-amd64/kernel/net/netfilter        <co xml:id="netfilter.common"/></screen>

    <calloutlist xmlns:xlink="http://www.w3.org/1999/xlink">
      <callout arearefs="netfilter.bridge">
	<para xmlns:xlink="http://www.w3.org/1999/xlink">Fonctions de filtrage au niveau liaison. Ces fonctions ne sont
	pas utilisées ici.</para>
      </callout>
      <callout arearefs="netfilter.ipv4">
	<para xmlns:xlink="http://www.w3.org/1999/xlink">Fonctions de filtrage au niveau réseau utilisant le protocole
	<acronym xmlns:xlink="http://www.w3.org/1999/xlink">IPv4</acronym>. C'est dans ce répertoire que se trouvent les
	modules utilisés dans ces travaux pratiques.</para>
      </callout>
      <callout arearefs="netfilter.ipv6">
	<para xmlns:xlink="http://www.w3.org/1999/xlink">Fonctions de filtrage au niveau réseau utilisant le protocole
	<acronym xmlns:xlink="http://www.w3.org/1999/xlink">IPv6</acronym>. Ces fonctions ne sont pas utilisées ici.</para>
      </callout>
      <callout arearefs="netfilter.common">
	<para xmlns:xlink="http://www.w3.org/1999/xlink">Fonctions communes de filtrage réseau indépendantes des niveaux
	et des protocoles utilisés. C'est notamment à ce niveau que l'on trouve
	les modules de la machine d'état de suivi de communications.</para>
      </callout>
    </calloutlist>
    </answer>
    </qandaentry>

    <qandaentry xmlns:xlink="http://www.w3.org/1999/xlink">
    <question xmlns:xlink="http://www.w3.org/1999/xlink">
      <para xmlns:xlink="http://www.w3.org/1999/xlink"><phrase xmlns:xlink="http://www.w3.org/1999/xlink">Quels sont les objets du système de fichiers virtuel
      <filename xmlns:xlink="http://www.w3.org/1999/xlink" class="directory">/proc</filename> relatifs aux fonctions de
      filtrage réseau du noyau Linux ?</phrase></para>

      <para xmlns:xlink="http://www.w3.org/1999/xlink">Avec le chargement des modules en mémoire système, de nouvelles
      entrées apparaissent dans l'arborescence <filename xmlns:xlink="http://www.w3.org/1999/xlink" class="directory">/proc</filename>. Même si l'arborescence <filename xmlns:xlink="http://www.w3.org/1999/xlink" class="directory">/proc</filename> n'est pas un véritable système de
      fichiers, il est possible d'effectuer des recherches toujours à l'aide de
      la commande <command xmlns:xlink="http://www.w3.org/1999/xlink">find</command>.</para>
    </question>
    <answer xmlns:xlink="http://www.w3.org/1999/xlink">
    <para xmlns:xlink="http://www.w3.org/1999/xlink">Le chargement des trois premiers modules entraîne la création des
    entrées relatives aux noms chaînes, aux correspondances et aux prises de
    décisions.</para>

<screen xmlns:xlink="http://www.w3.org/1999/xlink" width="80"># find /proc/net/ -name "*tables*"
/proc/net/ip_tables_targets
/proc/net/ip_tables_matches
/proc/net/ip_tables_names</screen>

    <para xmlns:xlink="http://www.w3.org/1999/xlink">La consultation des règles de la table <systemitem xmlns:xlink="http://www.w3.org/1999/xlink">nat</systemitem>
    entraîne la création de toutes les entrées nécessaires à la machine d'état
    de suivi de communication.</para>

<screen xmlns:xlink="http://www.w3.org/1999/xlink" width="80"># find /proc/net/ -name "*conntrack*"
/proc/net/ip_conntrack_expect
/proc/net/ip_conntrack
/proc/net/nf_conntrack
/proc/net/nf_conntrack_expect
/proc/net/stat/ip_conntrack
/proc/net/stat/nf_conntrack</screen>
    </answer>
    </qandaentry>

    <qandaentry xmlns:xlink="http://www.w3.org/1999/xlink">
    <question xmlns:xlink="http://www.w3.org/1999/xlink">
    <para xmlns:xlink="http://www.w3.org/1999/xlink"><phrase xmlns:xlink="http://www.w3.org/1999/xlink">Comment visualiser les informations de la machine d'état de
    suivi de communication ?</phrase></para>

    <para xmlns:xlink="http://www.w3.org/1999/xlink">Rechercher les entrées de l'arborescence <filename xmlns:xlink="http://www.w3.org/1999/xlink" class="directory">/proc</filename> dont le nom comprend la chaîne
    conntrack.</para>

    <para xmlns:xlink="http://www.w3.org/1999/xlink">La section <citetitle xmlns:xlink="http://www.w3.org/1999/xlink">«7.2 Les entrées de conntrack»</citetitle> du
    <link xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="http://www.inetdoc.net/guides/iptables-tutorial/"><citetitle xmlns:xlink="http://www.w3.org/1999/xlink">Tutoriel iptables</citetitle></link> décrit précisément les différents champs du suivi
    de communication.</para>

    <para xmlns:xlink="http://www.w3.org/1999/xlink">Le programme <application xmlns:xlink="http://www.w3.org/1999/xlink">iptstate</application> affiche les entrées
    de la table de suivi de communication sur le même mode que la commande
    <command xmlns:xlink="http://www.w3.org/1999/xlink">top</command>.</para>
    </question>
    <answer xmlns:xlink="http://www.w3.org/1999/xlink">
    <para xmlns:xlink="http://www.w3.org/1999/xlink">Les états sont directement consultables à partir du fichier virtuel
    <filename xmlns:xlink="http://www.w3.org/1999/xlink">/proc/net/ip_conntrack</filename>. Par exemple :</para>

<screen xmlns:xlink="http://www.w3.org/1999/xlink" width="80"># cat /proc/net/ip_conntrack
&lt;snipped/&gt;
udp 17 27 src=192.0.2.3 dst=192.0.2.1 sport=54932 dport=53 \
      packets=1 bytes=59 src=192.0.2.1 dst=192.0.2.3 sport=53 dport=54932 \
      packets=1 bytes=259 mark=0 secmark=0 use=2</screen>

    <para xmlns:xlink="http://www.w3.org/1999/xlink">L'exemple ci-dessus donne l'état du suivi de communication d'une
    requête <acronym xmlns:xlink="http://www.w3.org/1999/xlink">DNS</acronym> entre un poste client avec l'adresse
    <systemitem xmlns:xlink="http://www.w3.org/1999/xlink" class="ipaddress">192.0.2.3</systemitem> et le port source
    <systemitem xmlns:xlink="http://www.w3.org/1999/xlink">54932</systemitem> et un serveur avec l'adresse <systemitem xmlns:xlink="http://www.w3.org/1999/xlink" class="ipaddress">192.0.2.1</systemitem>.</para> 
    </answer>
    </qandaentry>
  </qandaset>
  </sect2>
</sect1>

<sect1 xmlns:xlink="http://www.w3.org/1999/xlink" xml:id="interco.netfilter.qa.common">
  <title xmlns:xlink="http://www.w3.org/1999/xlink">Règles de filtrage communes à toutes les configurations</title>

  <para xmlns:xlink="http://www.w3.org/1999/xlink">La mise en place du filtrage réseau sur les équipements doit répondre à
  deux principes.</para>
  
  <itemizedlist xmlns:xlink="http://www.w3.org/1999/xlink">
    <listitem xmlns:xlink="http://www.w3.org/1999/xlink">
    <para xmlns:xlink="http://www.w3.org/1999/xlink">Comme les équipements d'interconnexion mis en œuvre dans ces travaux
    pratiques délimitent des périmètres de faible dimension, on a une
    connaissance exhaustive des flux réseaux sur le système. On adopte donc la
    règle : <emphasis xmlns:xlink="http://www.w3.org/1999/xlink">tout trafic réseau non autorisé est
    interdit</emphasis>.</para>
    </listitem>
    <listitem xmlns:xlink="http://www.w3.org/1999/xlink">
    <para xmlns:xlink="http://www.w3.org/1999/xlink">Pour exploiter au mieux les fonctionnalités offertes par le noyau
    Linux, on s'appuie sur le suivi de communication (<wordasword xmlns:xlink="http://www.w3.org/1999/xlink">stateful
    inspection</wordasword>) pour obtenir un filtrage réseau le plus efficace
    possible. On cherche donc à suivre la règle d'or d'écriture des règles de
    filtrage qui consiste à <emphasis xmlns:xlink="http://www.w3.org/1999/xlink">décrire le plus précisément possible le
    premier paquet qui doit être enregistré dans la table de suivi de
    communication</emphasis>. Cette règle de description du premier paquet doit
    être placée après celle(s) qui laisse(nt) passer les flux réseau déjà
    enregistrés dans la machine d'état de suivi de communication.</para>
    </listitem>
  </itemizedlist>

  <qandaset xmlns:xlink="http://www.w3.org/1999/xlink" defaultlabel="number">
    <qandaentry xmlns:xlink="http://www.w3.org/1999/xlink">
    <question xmlns:xlink="http://www.w3.org/1999/xlink">
    <para xmlns:xlink="http://www.w3.org/1999/xlink"><phrase xmlns:xlink="http://www.w3.org/1999/xlink">Quelle est la syntaxe de la commande
    <command xmlns:xlink="http://www.w3.org/1999/xlink">iptables</command> sur la politique par défaut à appliquer sur les
    chaînes de la table <systemitem xmlns:xlink="http://www.w3.org/1999/xlink">netfilter</systemitem> pour respecter le
    premier principe de filtrage énoncé ci-dessus ?</phrase></para> 

    <para xmlns:xlink="http://www.w3.org/1999/xlink">De façon très classique, on consulte les pages de manuels de la
    commande <command xmlns:xlink="http://www.w3.org/1999/xlink">iptables</command> et on recherche le mot clé
    <option xmlns:xlink="http://www.w3.org/1999/xlink">policy</option>. La stratégie retenue suppose que l'on implante
    règles d'autorisation des flux réseaux valides et que tout autre trafic
    soit éliminé. La politique par défaut à appliquer sur les trois chaînes est
    donc : <option xmlns:xlink="http://www.w3.org/1999/xlink">DROP</option>.</para>

    <para xmlns:xlink="http://www.w3.org/1999/xlink">La section <citetitle xmlns:xlink="http://www.w3.org/1999/xlink">«9.3. Commandes»</citetitle> du
    <link xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="http://www.inetdoc.net/guides/iptables-tutorial/"><citetitle xmlns:xlink="http://www.w3.org/1999/xlink">Tutoriel iptables</citetitle></link> donne aussi la syntaxe de configuration de
    <emphasis xmlns:xlink="http://www.w3.org/1999/xlink">cible par défaut</emphasis> pour les chaînes élémentaires :
    <option xmlns:xlink="http://www.w3.org/1999/xlink">INPUT</option>, <option xmlns:xlink="http://www.w3.org/1999/xlink">FORWARD</option> et
    <option xmlns:xlink="http://www.w3.org/1999/xlink">OUTPUT</option>.</para>
    </question>
    <answer xmlns:xlink="http://www.w3.org/1999/xlink">

<screen xmlns:xlink="http://www.w3.org/1999/xlink" width="80"><prompt xmlns:xlink="http://www.w3.org/1999/xlink">#</prompt> <emphasis xmlns:xlink="http://www.w3.org/1999/xlink">iptables -P INPUT DROP</emphasis>
<prompt xmlns:xlink="http://www.w3.org/1999/xlink">#</prompt> <emphasis xmlns:xlink="http://www.w3.org/1999/xlink">iptables -P FORWARD DROP</emphasis>
<prompt xmlns:xlink="http://www.w3.org/1999/xlink">#</prompt> <emphasis xmlns:xlink="http://www.w3.org/1999/xlink">iptables -P OUTPUT DROP</emphasis>
<prompt xmlns:xlink="http://www.w3.org/1999/xlink">#</prompt> iptables -vL
Chain INPUT (policy DROP 0 packets, 0 bytes)
 pkts bytes target   prot opt in    out   source     destination

Chain FORWARD (policy DROP 0 packets, 0 bytes)
 pkts bytes target   prot opt in    out   source     destination

Chain OUTPUT (policy DROP 0 packets, 0 bytes)
 pkts bytes target   prot opt in    out   source     destination</screen>
    </answer>
    </qandaentry>

    <qandaentry xmlns:xlink="http://www.w3.org/1999/xlink">
    <question xmlns:xlink="http://www.w3.org/1999/xlink">
    <para xmlns:xlink="http://www.w3.org/1999/xlink"><phrase xmlns:xlink="http://www.w3.org/1999/xlink">Quelle est la syntaxe de la commande
    <command xmlns:xlink="http://www.w3.org/1999/xlink">iptables</command> qui autorise le trafic réseau déjà enregistré
    dans la machine d'état de suivi de communication sur les chaînes
    <option xmlns:xlink="http://www.w3.org/1999/xlink">INPUT</option> et <option xmlns:xlink="http://www.w3.org/1999/xlink">OUTPUT</option> ?</phrase></para>

    <para xmlns:xlink="http://www.w3.org/1999/xlink">La recherche de la correspondance <option xmlns:xlink="http://www.w3.org/1999/xlink">state</option> dans les
    pages de manuel de la commande <command xmlns:xlink="http://www.w3.org/1999/xlink">iptables</command> permet de
    sélectionner les états <option xmlns:xlink="http://www.w3.org/1999/xlink">ESTABLISHED</option> et
    <option xmlns:xlink="http://www.w3.org/1999/xlink">RELATED</option> à appliquer sur les chaînes.</para>

    <para xmlns:xlink="http://www.w3.org/1999/xlink">La section <citetitle xmlns:xlink="http://www.w3.org/1999/xlink">«7.3. États de l'espace
    utilisateur»</citetitle> du <link xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="http://www.inetdoc.net/guides/iptables-tutorial/"><citetitle xmlns:xlink="http://www.w3.org/1999/xlink">Tutoriel iptables</citetitle></link> décrit les
    correspondances entre les états et les flux réseau.</para>
    </question>
    <answer xmlns:xlink="http://www.w3.org/1999/xlink">

<screen xmlns:xlink="http://www.w3.org/1999/xlink" width="80"><prompt xmlns:xlink="http://www.w3.org/1999/xlink">#</prompt> <emphasis xmlns:xlink="http://www.w3.org/1999/xlink">iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT</emphasis>
<prompt xmlns:xlink="http://www.w3.org/1999/xlink">#</prompt> <emphasis xmlns:xlink="http://www.w3.org/1999/xlink">iptables -A OUTPUT -m state --state ESTABLISHED,RELATED -j ACCEPT</emphasis>
<prompt xmlns:xlink="http://www.w3.org/1999/xlink">#</prompt> iptables -vL
Chain INPUT (policy DROP 0 packets, 0 bytes)
 pkts bytes target   prot opt in    out   source     destination
    0     0 ACCEPT   0    --  any   any   anywhere   anywhere  state RELATED,ESTABLISHED

Chain FORWARD (policy DROP 0 packets, 0 bytes)
 pkts bytes target   prot opt in    out   source     destination

Chain OUTPUT (policy DROP 0 packets, 0 bytes)
 pkts bytes target   prot opt in    out   source     destination
    0     0 ACCEPT   0    --  any   any   anywhere   anywhere  state RELATED,ESTABLISHED
</screen>
    
    <para xmlns:xlink="http://www.w3.org/1999/xlink">À partir de cette étape, on utilise les programmes
    <command xmlns:xlink="http://www.w3.org/1999/xlink">iptables-save</command> et <command xmlns:xlink="http://www.w3.org/1999/xlink">iptables-restore</command>
    pour optimiser les manipulations. Ces programmes présentent un grand
    intérêt dans la mesure où l'affichage des règles de filtrage est plus
    condensé.</para>

<screen xmlns:xlink="http://www.w3.org/1999/xlink" width="80"><prompt xmlns:xlink="http://www.w3.org/1999/xlink">#</prompt> iptables-save &gt;/var/lib/iptables/active
<prompt xmlns:xlink="http://www.w3.org/1999/xlink">#</prompt> vim /var/lib/iptables/active
<prompt xmlns:xlink="http://www.w3.org/1999/xlink">#</prompt> iptables-restore &lt;/var/lib/iptables/active
<prompt xmlns:xlink="http://www.w3.org/1999/xlink">#</prompt> grep -v '^# ' /var/lib/iptables/active
*nat
:PREROUTING ACCEPT [0:0]
:POSTROUTING ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
COMMIT
*filter
:INPUT DROP [0:0]
:FORWARD DROP [0:0]
:OUTPUT DROP [0:0]
#~~~~~~~~~~~~~~~~~~~~~:: INPUT
<emphasis xmlns:xlink="http://www.w3.org/1999/xlink">-A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT</emphasis>
#~~~~~~~~~~~~~~~~~~~~~:: OUTPUT
<emphasis xmlns:xlink="http://www.w3.org/1999/xlink">-A OUTPUT -m state --state ESTABLISHED,RELATED -j ACCEPT</emphasis>
COMMIT</screen>

    <para xmlns:xlink="http://www.w3.org/1999/xlink">La commande <command xmlns:xlink="http://www.w3.org/1999/xlink">iptables-restore</command> doit être utilisée
    après chaque édition du fichier
    <filename xmlns:xlink="http://www.w3.org/1999/xlink">/var/lib/iptables/active</filename>.</para>
    </answer>
    </qandaentry>

    <qandaentry xmlns:xlink="http://www.w3.org/1999/xlink">
    <question xmlns:xlink="http://www.w3.org/1999/xlink">
    <para xmlns:xlink="http://www.w3.org/1999/xlink"><phrase xmlns:xlink="http://www.w3.org/1999/xlink">À partir des règles de filtrage précédentes, est-il possible
    d'émettre ou de recevoir du trafic réseau non enregistré dans la machine
    d'état de suivi de communication ?</phrase></para>

    <para xmlns:xlink="http://www.w3.org/1999/xlink">Faire des tests <acronym xmlns:xlink="http://www.w3.org/1999/xlink">ICMP</acronym>, <acronym xmlns:xlink="http://www.w3.org/1999/xlink">DNS</acronym> et
    <acronym xmlns:xlink="http://www.w3.org/1999/xlink">HTTP</acronym>. Conclure et justifier.</para>
    </question>
    <answer xmlns:xlink="http://www.w3.org/1999/xlink">
    <para xmlns:xlink="http://www.w3.org/1999/xlink">La réponse est non. La politique par défaut sur les chaînes
    <option xmlns:xlink="http://www.w3.org/1999/xlink">INPUT</option> et <option xmlns:xlink="http://www.w3.org/1999/xlink">OUTPUT</option> étant positionnée à
    <option xmlns:xlink="http://www.w3.org/1999/xlink">DROP</option>, tout nouveau paquet entrant ou sortant est rejeté.
    Pour qu'une communication soit possible, il faudrait avoir enregistré un
    flux réseau dans la machine d'état avant d'appliquer ce jeu de règles de
    filtrage.</para>
    </answer>
    </qandaentry>

    <qandaentry xmlns:xlink="http://www.w3.org/1999/xlink">
    <question xmlns:xlink="http://www.w3.org/1999/xlink">
    <para xmlns:xlink="http://www.w3.org/1999/xlink"><phrase xmlns:xlink="http://www.w3.org/1999/xlink">Quelle est la syntaxe de la commande
    <command xmlns:xlink="http://www.w3.org/1999/xlink">iptables</command> qui autorise le trafic réseau depuis (chaîne
    <option xmlns:xlink="http://www.w3.org/1999/xlink">OUTPUT</option>) et vers (chaîne <option xmlns:xlink="http://www.w3.org/1999/xlink">INPUT</option>)
    l'interface de boucle locale de l'équipement ?</phrase></para>

    <para xmlns:xlink="http://www.w3.org/1999/xlink">Pour que les processus locaux au système puissent communiquer entre
    eux via la pile de protocole TCP/IP, il est <emphasis xmlns:xlink="http://www.w3.org/1999/xlink">essentiel</emphasis>
    d'autoriser le trafic sur l'interface de boucle locale <option xmlns:xlink="http://www.w3.org/1999/xlink">lo</option>.
    La recherche de la correspondance <option xmlns:xlink="http://www.w3.org/1999/xlink">state</option> dans les pages de
    manuel de la commande <command xmlns:xlink="http://www.w3.org/1999/xlink">iptables</command> permet de sélectionner
    l'état <option xmlns:xlink="http://www.w3.org/1999/xlink">NEW</option> pour autoriser le premier paquet depuis et vers
    cette interface. Tous les autres paquets devront correspondre aux règles
    déjà écrites ci-dessus.</para>
    </question>
    <answer xmlns:xlink="http://www.w3.org/1999/xlink">
    <para xmlns:xlink="http://www.w3.org/1999/xlink">On ajoute deux nouvelles règles sur les chaînes
    <option xmlns:xlink="http://www.w3.org/1999/xlink">INPUT</option> et <option xmlns:xlink="http://www.w3.org/1999/xlink">OUTPUT</option> qui admettent
    respectivement tous les paquets entrant et sortant par l'interface de
    <option xmlns:xlink="http://www.w3.org/1999/xlink">lo</option> dans la table de suivi des communications.</para>

<screen xmlns:xlink="http://www.w3.org/1999/xlink" width="80"><prompt xmlns:xlink="http://www.w3.org/1999/xlink">#</prompt> grep -v '^# ' /var/lib/iptables/active
*nat
:PREROUTING ACCEPT [0:0]
:POSTROUTING ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
COMMIT
*filter
:INPUT DROP [0:0]
:FORWARD DROP [0:0]
:OUTPUT DROP [0:0]
#~~~~~~~~~~~~~~~~~~~~~:: INPUT
-A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
<emphasis xmlns:xlink="http://www.w3.org/1999/xlink">-A INPUT -i lo -m state --state NEW -j ACCEPT</emphasis>
#~~~~~~~~~~~~~~~~~~~~~:: OUTPUT
-A OUTPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
<emphasis xmlns:xlink="http://www.w3.org/1999/xlink">-A OUTPUT -o lo -m state --state NEW -j ACCEPT</emphasis>
COMMIT</screen>

    <para xmlns:xlink="http://www.w3.org/1999/xlink">À partir de ce jeu de règles, on peut lancer un test
    <acronym xmlns:xlink="http://www.w3.org/1999/xlink">ICMP</acronym> :
    <userinput xmlns:xlink="http://www.w3.org/1999/xlink"># ping -c 4 127.0.0.1</userinput>.</para>
    </answer>
    </qandaentry>

    <qandaentry xmlns:xlink="http://www.w3.org/1999/xlink">
    <question xmlns:xlink="http://www.w3.org/1999/xlink">
    <para xmlns:xlink="http://www.w3.org/1999/xlink"><phrase xmlns:xlink="http://www.w3.org/1999/xlink">Quelle est la syntaxe de la commande
    <command xmlns:xlink="http://www.w3.org/1999/xlink">iptables</command> qui autorise le trafic sortant sur l'interface
    <acronym xmlns:xlink="http://www.w3.org/1999/xlink">LAN</acronym> en sortie du système ?</phrase></para>

    <para xmlns:xlink="http://www.w3.org/1999/xlink">Comme pour la question précédente, les processus locaux au système
    doivent pouvoir émettre du trafic via la pile de protocole TCP/IP. Il est
    donc préférable d'autoriser le trafic sortant sur l'interface
    <acronym xmlns:xlink="http://www.w3.org/1999/xlink">LAN</acronym>. On utilise à nouveau l'état <option xmlns:xlink="http://www.w3.org/1999/xlink">NEW</option>
    pour autoriser le premier paquet depuis l'interface. Tous les autres
    paquets devront correspondre aux communications déjà enregistrées dans les
    tables de suivi.</para>
    </question>
    <answer xmlns:xlink="http://www.w3.org/1999/xlink">
    <para xmlns:xlink="http://www.w3.org/1999/xlink">On ajoute une règle sur la chaîne <option xmlns:xlink="http://www.w3.org/1999/xlink">OUTPUT</option> qui admet,
    dans la table de suivi des communications, les paquets sortant par
    l'interface <option xmlns:xlink="http://www.w3.org/1999/xlink">eth0</option>.</para>

<screen xmlns:xlink="http://www.w3.org/1999/xlink" width="80"><prompt xmlns:xlink="http://www.w3.org/1999/xlink">#</prompt> grep -v '^# ' /var/lib/iptables/active
*nat
:PREROUTING ACCEPT [0:0]
:POSTROUTING ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
COMMIT
*filter
:INPUT DROP [0:0]
:FORWARD DROP [0:0]
:OUTPUT DROP [0:0]
#~~~~~~~~~~~~~~~~~~~~~:: INPUT
-A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
-A INPUT -i lo -m state --state NEW -j ACCEPT
#~~~~~~~~~~~~~~~~~~~~~:: OUTPUT
-A OUTPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
-A OUTPUT -o lo -m state --state NEW -j ACCEPT
<emphasis xmlns:xlink="http://www.w3.org/1999/xlink">-A OUTPUT -o eth0 -m state --state NEW -j ACCEPT</emphasis>
COMMIT</screen>
    </answer>
    </qandaentry>

    <qandaentry xmlns:xlink="http://www.w3.org/1999/xlink">
    <question xmlns:xlink="http://www.w3.org/1999/xlink">
    <para xmlns:xlink="http://www.w3.org/1999/xlink"><phrase xmlns:xlink="http://www.w3.org/1999/xlink">Quelle est la syntaxe de la commande <command xmlns:xlink="http://www.w3.org/1999/xlink">iptables</command> qui
    autorise le trafic <acronym xmlns:xlink="http://www.w3.org/1999/xlink">ICMP</acronym> en entrée du système en limitant
    le nombre des nouvelles requêtes à 5 par minute ?</phrase></para>

    <para xmlns:xlink="http://www.w3.org/1999/xlink">Interdire tout trafic <acronym xmlns:xlink="http://www.w3.org/1999/xlink">ICMP</acronym> est une très mauvaise
    idée du point de vue administration réseau. Pour autant, il est très facile
    de se prémunir contre les tentatives de saturation du trafic sur les
    interfaces en limitant le nombre de requêtes simultanées en entrée sur
    toutes les interfaces. Dans un premier temps on se contente de cette règle
    unique très simple même s'il est judicieux de valider les types et les
    codes des messages <acronym xmlns:xlink="http://www.w3.org/1999/xlink">ICMP</acronym>. Dans un deuxième temps, on
    distinguera les types de messages ; voir <xref xmlns:xlink="http://www.w3.org/1999/xlink" linkend="interco.netfilter.qa.extended.icmp"/>.</para>

    <para xmlns:xlink="http://www.w3.org/1999/xlink">On peut qualifier le fonctionnement de la limitation de trafic à
    l'aide des commandes <command xmlns:xlink="http://www.w3.org/1999/xlink">ping</command> et <command xmlns:xlink="http://www.w3.org/1999/xlink">hping3</command> à
    partir d'un hôte distant.</para>
    </question>
    <answer xmlns:xlink="http://www.w3.org/1999/xlink">
    <para xmlns:xlink="http://www.w3.org/1999/xlink">La recherche de la correspondance <option xmlns:xlink="http://www.w3.org/1999/xlink">limit</option> dans les
    pages de manuel de la commande <command xmlns:xlink="http://www.w3.org/1999/xlink">iptables</command> permet de
    compléter la syntaxe de la règle d'autorisation du trafic
    <acronym xmlns:xlink="http://www.w3.org/1999/xlink">ICMP</acronym> avec l'état <option xmlns:xlink="http://www.w3.org/1999/xlink">NEW</option> pour le suivi de
    communication.</para>

<screen xmlns:xlink="http://www.w3.org/1999/xlink" width="80"><prompt xmlns:xlink="http://www.w3.org/1999/xlink">#</prompt> grep -v '^# ' /var/lib/iptables/active
*nat
:PREROUTING ACCEPT [0:0]
:POSTROUTING ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
COMMIT
*filter
:INPUT DROP [0:0]
:FORWARD DROP [0:0]
:OUTPUT DROP [0:0]
#~~~~~~~~~~~~~~~~~~~~~:: INPUT
-A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
<emphasis xmlns:xlink="http://www.w3.org/1999/xlink">-A INPUT -p icmp -m limit --limit 5/min -m state --state NEW -j ACCEPT</emphasis>
-A INPUT -i lo -m state --state NEW -j ACCEPT
#~~~~~~~~~~~~~~~~~~~~~:: OUTPUT
-A OUTPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
-A OUTPUT -o lo -m state --state NEW -j ACCEPT
-A OUTPUT -o eth0 -m state --state NEW -j ACCEPT
COMMIT</screen>

    <para xmlns:xlink="http://www.w3.org/1999/xlink">Les tests de qualification de la nouvelle règle utilisent la commande
    usuelle <command xmlns:xlink="http://www.w3.org/1999/xlink">ping</command> puis un outil beaucoup moins classique qui
    offre de nombreuses «possibilités», <command xmlns:xlink="http://www.w3.org/1999/xlink">hping3</command>.</para>

<screen xmlns:xlink="http://www.w3.org/1999/xlink" width="80"><prompt xmlns:xlink="http://www.w3.org/1999/xlink">#</prompt> ping -n -c 3 192.0.2.3
PING 192.0.2.3 (192.0.2.3) 56(84) bytes of data.
64 bytes from 192.0.2.3: icmp_req=1 ttl=64 time=0.958 ms
64 bytes from 192.0.2.3: icmp_req=2 ttl=64 time=0.746 ms
64 bytes from 192.0.2.3: icmp_req=3 ttl=64 time=0.803 ms

--- 192.0.2.3 ping statistics ---
3 packets transmitted, 3 received, <emphasis xmlns:xlink="http://www.w3.org/1999/xlink">0% packet loss</emphasis>, time 2000ms
rtt min/avg/max/mdev = 0.746/0.835/0.958/0.095 ms

<prompt xmlns:xlink="http://www.w3.org/1999/xlink">#</prompt> hping3 -1 --rand-source --fast -c 10 192.0.2.3
HPING 192.0.2.3 (tap0 192.0.2.3): icmp mode set, 28 headers + 0 data bytes
len=28 ip=192.0.2.3 ttl=64 xml:id=5204 icmp_seq=0 rtt=1.0 ms
len=28 ip=192.0.2.3 ttl=64 xml:id=9948 icmp_seq=1 rtt=0.5 ms
len=28 ip=192.0.2.3 ttl=64 xml:id=31892 icmp_seq=2 rtt=0.6 ms
len=28 ip=192.0.2.3 ttl=64 xml:id=48870 icmp_seq=3 rtt=0.6 ms
len=28 ip=192.0.2.3 ttl=64 xml:id=40501 icmp_seq=4 rtt=0.7 ms

--- 192.0.2.3 hping statistic ---
10 packets transmitted, 5 packets received, <emphasis xmlns:xlink="http://www.w3.org/1999/xlink">50% packet loss</emphasis></screen>

    <para xmlns:xlink="http://www.w3.org/1999/xlink">On constate que le premier test ne produit aucune erreur alors que la
    tentative de <wordasword xmlns:xlink="http://www.w3.org/1999/xlink">spoofing</wordasword> rapide des adresses
    <acronym xmlns:xlink="http://www.w3.org/1999/xlink">IP</acronym> source entraîne des pertes de paquets
    <acronym xmlns:xlink="http://www.w3.org/1999/xlink">ICMP</acronym> dès que la limite fixée dans la règle de filtrage
    est atteinte.</para>
    </answer>
    </qandaentry>
  </qandaset>

  <para xmlns:xlink="http://www.w3.org/1999/xlink">Une fois ces règles basiques en place, on peut aborder les filtrages
  réseau spécifiques à la topologie de travaux pratiques.</para>
</sect1>

<sect1 xmlns:xlink="http://www.w3.org/1999/xlink" xml:id="interco.netfilter.qa.client">
  <title xmlns:xlink="http://www.w3.org/1999/xlink">Règles de filtrage sur le poste routeur d'agence
  (<wordasword xmlns:xlink="http://www.w3.org/1999/xlink">spoke</wordasword>)</title>

  <para xmlns:xlink="http://www.w3.org/1999/xlink">Suivant le cahier des charges fixé, la première contrainte imposée au
  poste routeur d'agence est de s'assurer que le trafic entrant sur son interface
  <acronym xmlns:xlink="http://www.w3.org/1999/xlink">WAN</acronym> est bien relatif à une demande émise via cette même
  interface. Le seconde contrainte étant le routage pour le réseau local
  d'extrémité, on doit compléter le filtrage avec une traduction d'adresse
  source liée à cette même interface <acronym xmlns:xlink="http://www.w3.org/1999/xlink">WAN</acronym>.</para>

  <para xmlns:xlink="http://www.w3.org/1999/xlink">Il est conseillé de travailler à partir du fichier de règles de
  filtrage établi dans la section précédente. Après chaque édition de ce
  fichier, la commande <command xmlns:xlink="http://www.w3.org/1999/xlink">iptables-restore</command> permet d'appliquer
  le nouveau jeu de règles après avoir effacé les règles précédentes et remis
  les compteurs de paquets à zéro.</para>

  <qandaset xmlns:xlink="http://www.w3.org/1999/xlink">
    <qandaentry xmlns:xlink="http://www.w3.org/1999/xlink">
    <question xmlns:xlink="http://www.w3.org/1999/xlink">
    <para xmlns:xlink="http://www.w3.org/1999/xlink"><phrase xmlns:xlink="http://www.w3.org/1999/xlink">Quelle est la syntaxe de la commande
    <command xmlns:xlink="http://www.w3.org/1999/xlink">iptables</command> qui autorise le trafic sortant sur l'interface
    <acronym xmlns:xlink="http://www.w3.org/1999/xlink">WAN</acronym> ?</phrase></para>

    <para xmlns:xlink="http://www.w3.org/1999/xlink">Relativement à la configuration commune présentée précédemment, il
    suffit d'ajouter une règle d'autorisation sur la chaîne
    <acronym xmlns:xlink="http://www.w3.org/1999/xlink">OUTPUT</acronym> tout en enregistrant le premier paquet sortant
    avec l'état <acronym xmlns:xlink="http://www.w3.org/1999/xlink">NEW</acronym>.</para>

    <para xmlns:xlink="http://www.w3.org/1999/xlink">Avec ce jeu de règles actif, on peut lancer la séquence habituelle
    des tests <acronym xmlns:xlink="http://www.w3.org/1999/xlink">ICMP</acronym> et caractériser l'utilisation des règles
    en visualisant l'évolution des compteurs avec la commande
    <command xmlns:xlink="http://www.w3.org/1999/xlink">iptables -vL</command>.</para>
    </question>
    <answer xmlns:xlink="http://www.w3.org/1999/xlink">
    <para xmlns:xlink="http://www.w3.org/1999/xlink">Comme dans le cas de l'interface <acronym xmlns:xlink="http://www.w3.org/1999/xlink">LAN</acronym>, on ajoute
    une règle qui admet les nouveaux paquets sortant par l'interface
    <option xmlns:xlink="http://www.w3.org/1999/xlink">ippp0</option> dans la table de suivi des communications via la
    chaîne <option xmlns:xlink="http://www.w3.org/1999/xlink">OUTPUT</option>.</para>

<screen xmlns:xlink="http://www.w3.org/1999/xlink" width="80"><prompt xmlns:xlink="http://www.w3.org/1999/xlink">#</prompt> grep -v '^# ' /var/lib/iptables/active
*nat
:PREROUTING ACCEPT [0:0]
:POSTROUTING ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
COMMIT
*filter
:INPUT DROP [0:0]
:FORWARD DROP [0:0]
:OUTPUT DROP [0:0]
#~~~~~~~~~~~~~~~~~~~~~:: INPUT
-A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
-A INPUT -p icmp --icmp-type echo-request -m limit --limit 5/min -m state --state NEW -j ACCEPT
-A INPUT -i lo -m state --state NEW -j ACCEPT
#~~~~~~~~~~~~~~~~~~~~~:: OUTPUT
-A OUTPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
-A OUTPUT -o lo -m state --state NEW -j ACCEPT
<emphasis xmlns:xlink="http://www.w3.org/1999/xlink">-A OUTPUT -o ippp0 -m state --state NEW -j ACCEPT</emphasis>
-A OUTPUT -o eth0 -m state --state NEW -j ACCEPT
COMMIT</screen>
    </answer>
    </qandaentry>

    <qandaentry xmlns:xlink="http://www.w3.org/1999/xlink">
    <question xmlns:xlink="http://www.w3.org/1999/xlink">
    <para xmlns:xlink="http://www.w3.org/1999/xlink"><phrase xmlns:xlink="http://www.w3.org/1999/xlink">Quelle est la syntaxe de la commande
    <command xmlns:xlink="http://www.w3.org/1999/xlink">iptables</command> qui active la traduction d'adresse source pour
    le trafic sortant sur l'interface
    <acronym xmlns:xlink="http://www.w3.org/1999/xlink">WAN</acronym> ?</phrase></para>

    <para xmlns:xlink="http://www.w3.org/1999/xlink">Le but est de configurer le routeur d'agence pour qu'il ne soit
    visible de l'Internet qu'à travers l'adresse <acronym xmlns:xlink="http://www.w3.org/1999/xlink">IP</acronym> délivrée
    par le routeur central (ou le fournisseur d'accès). Cette opération utilise
    la table <option xmlns:xlink="http://www.w3.org/1999/xlink">nat</option>. On ajoute dans cette table une règle de
    traduction d'adresse source dynamique liée à l'interface
    <acronym xmlns:xlink="http://www.w3.org/1999/xlink">WAN</acronym>. Il faut rechercher les informations sur la cible
    <option xmlns:xlink="http://www.w3.org/1999/xlink">MASQUERADE</option> dans les pages de manuels de la commande
    <command xmlns:xlink="http://www.w3.org/1999/xlink">iptables</command>.</para>
    </question>
    <answer xmlns:xlink="http://www.w3.org/1999/xlink">
    <para xmlns:xlink="http://www.w3.org/1999/xlink">On ajoute une règle dans la chaîne <option xmlns:xlink="http://www.w3.org/1999/xlink">POSTROUTING</option> qui
    traduit l'adresse <acronym xmlns:xlink="http://www.w3.org/1999/xlink">IP</acronym> source de tous les paquets sortant
    par l'interface <option xmlns:xlink="http://www.w3.org/1999/xlink">ippp0</option> avec l'adresse attribuée
    dynamiquement via le protocole <acronym xmlns:xlink="http://www.w3.org/1999/xlink">PPP</acronym> à cette
    interface.</para>

<screen xmlns:xlink="http://www.w3.org/1999/xlink" width="80"><prompt xmlns:xlink="http://www.w3.org/1999/xlink">#</prompt> grep -v '^# ' /var/lib/iptables/active
*nat
:PREROUTING ACCEPT [0:0]
:POSTROUTING ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
#~~~~~~~~~~~~~~~~~~~~~:: POSTROUTING
<emphasis xmlns:xlink="http://www.w3.org/1999/xlink">-A POSTROUTING -o ippp0 -j MASQUERADE</emphasis>
COMMIT
*filter
:INPUT DROP [0:0]
:FORWARD DROP [0:0]
:OUTPUT DROP [0:0]
#~~~~~~~~~~~~~~~~~~~~~:: INPUT
-A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
-A INPUT -p icmp --icmp-type echo-request -m limit --limit 5/min -m state --state NEW -j ACCEPT
-A INPUT -i lo -m state --state NEW -j ACCEPT
#~~~~~~~~~~~~~~~~~~~~~:: OUTPUT
-A OUTPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
-A OUTPUT -o lo -m state --state NEW -j ACCEPT
-A OUTPUT -o ippp0 -m state --state NEW -j ACCEPT
COMMIT</screen>
    </answer>
    </qandaentry>
    
    <qandaentry xmlns:xlink="http://www.w3.org/1999/xlink">
      <question xmlns:xlink="http://www.w3.org/1999/xlink">
      <para xmlns:xlink="http://www.w3.org/1999/xlink"><phrase xmlns:xlink="http://www.w3.org/1999/xlink">Ce jeu de règles est-il suffisant pour que le poste se
      comporte comme un routeur avec une fonction de traduction d'adresses
      <acronym xmlns:xlink="http://www.w3.org/1999/xlink">IP</acronym> sources ?</phrase></para>

      <para xmlns:xlink="http://www.w3.org/1999/xlink">Cette question comprend deux parties. Il faut s'intéresser dans un
      premier temps à la fonction de routage proprement dite et consulter
      l'indicateur d'état du noyau Linux qui correspond à la capacité à
      transmettre un paquet d'une interface vers une autre. Dans un second
      temps, il faut identifier dans le système de filtrage la chaîne dédiée au
      transit des paquets.</para>
      </question>
      <answer xmlns:xlink="http://www.w3.org/1999/xlink">
      <para xmlns:xlink="http://www.w3.org/1999/xlink">La réponse est non. Il manque au moins deux conditions pour que le
      routage et la transmission des paquets entre les interfaces soient
      actifs.</para>

      <itemizedlist xmlns:xlink="http://www.w3.org/1999/xlink">
        <listitem xmlns:xlink="http://www.w3.org/1999/xlink">
	<para xmlns:xlink="http://www.w3.org/1999/xlink">Pour qu'un paquet soit transmis d'une interface réseau vers une
	autre, il faut s'assurer que le routage est actif au niveau du noyau.
	Cette fonction est paramétrée par la variable d'état
	<option xmlns:xlink="http://www.w3.org/1999/xlink">ip_forward</option> du système de fichiers virtuel <filename xmlns:xlink="http://www.w3.org/1999/xlink" class="directory">/proc</filename>. La valeur <option xmlns:xlink="http://www.w3.org/1999/xlink">1</option>
	indique que la fonction routage est active dans le noyau :</para>

<screen xmlns:xlink="http://www.w3.org/1999/xlink" width="80"><prompt xmlns:xlink="http://www.w3.org/1999/xlink">#</prompt> echo 1 &gt; /proc/sys/net/ipv4/ip_forward</screen>
	</listitem>
	<listitem xmlns:xlink="http://www.w3.org/1999/xlink">
	<para xmlns:xlink="http://www.w3.org/1999/xlink">Comme la politique par défaut sur la chaîne
	<option xmlns:xlink="http://www.w3.org/1999/xlink">FORWARD</option> est <option xmlns:xlink="http://www.w3.org/1999/xlink">DROP</option>, aucun paquet ne
	peut traverser les règles de filtrage et transiter d'une interface vers
	l'autre. Sans règle supplémentaire, les tests <acronym xmlns:xlink="http://www.w3.org/1999/xlink">ICMP</acronym>
	doivent incrémenter le compteur <option xmlns:xlink="http://www.w3.org/1999/xlink">DROP</option> de la chaîne
	<option xmlns:xlink="http://www.w3.org/1999/xlink">FORWARD</option>.</para>
	</listitem>
      </itemizedlist>
      </answer>
    </qandaentry>

    <qandaentry xmlns:xlink="http://www.w3.org/1999/xlink">
      <question xmlns:xlink="http://www.w3.org/1999/xlink">
      <para xmlns:xlink="http://www.w3.org/1999/xlink"><phrase xmlns:xlink="http://www.w3.org/1999/xlink">Quelle est la syntaxe de la commande
      <command xmlns:xlink="http://www.w3.org/1999/xlink">iptables</command> qui autorise le transfert des paquets entrant
      par l'interface <acronym xmlns:xlink="http://www.w3.org/1999/xlink">LAN</acronym> vers l'interface
      <acronym xmlns:xlink="http://www.w3.org/1999/xlink">WAN</acronym> ?</phrase></para>

      <para xmlns:xlink="http://www.w3.org/1999/xlink">Rechercher la syntaxe des règles correspondant à ce qui a déjà été
      vu dans la mise au point du jeu de règles communes pour les chaînes
      <option xmlns:xlink="http://www.w3.org/1999/xlink">INPUT</option> et <option xmlns:xlink="http://www.w3.org/1999/xlink">OUTPUT</option>. Il faut que tout
      trafic relatif à une demande enregistrée dans la table de suivi des
      communications soit accepté. Il faut aussi que les nouveaux paquets
      entrant par l'interface <acronym xmlns:xlink="http://www.w3.org/1999/xlink">LAN</acronym> soient admis et enregistré
      dans cette table.</para>
      </question>
      <answer xmlns:xlink="http://www.w3.org/1999/xlink">
      <para xmlns:xlink="http://www.w3.org/1999/xlink">On implante deux règles dans la chaîne <option xmlns:xlink="http://www.w3.org/1999/xlink">FORWARD</option>.
      Une première règle pour le trafic relatif à une demande déjà enregistrée
      et une seconde pour les paquets entrant par l'interface
      <acronym xmlns:xlink="http://www.w3.org/1999/xlink">LAN</acronym>.</para>

<screen xmlns:xlink="http://www.w3.org/1999/xlink" width="80"><prompt xmlns:xlink="http://www.w3.org/1999/xlink">#</prompt> grep -v '^# ' /var/lib/iptables/active
*nat
:PREROUTING ACCEPT [0:0]
:POSTROUTING ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
#~~~~~~~~~~~~~~~~~~~~~:: POSTROUTING
-A POSTROUTING -o ippp0 -j MASQUERADE
COMMIT
*filter
:INPUT DROP [0:0]
:FORWARD DROP [0:0]
:OUTPUT DROP [0:0]
#~~~~~~~~~~~~~~~~~~~~~:: INPUT
-A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
-A INPUT -p icmp --icmp-type echo-request -m limit --limit 5/min -m state --state NEW -j ACCEPT
-A INPUT -i lo -m state --state NEW -j ACCEPT
<emphasis xmlns:xlink="http://www.w3.org/1999/xlink">#~~~~~~~~~~~~~~~~~~~~~:: FORWARD
-A FORWARD -m state --state ESTABLISHED,RELATED -j ACCEPT
-A FORWARD -i eth0 -m state --state NEW -j ACCEPT</emphasis>
#~~~~~~~~~~~~~~~~~~~~~:: OUTPUT
-A OUTPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
-A OUTPUT -o lo -m state --state NEW -j ACCEPT
-A OUTPUT -o ippp0 -m state --state NEW -j ACCEPT
COMMIT</screen>

      <para xmlns:xlink="http://www.w3.org/1999/xlink">Cette configuration ne peut être qualifiée qu'avec un trafic devant
      transiter entre deux interfaces. Avec la configuration de travaux
      pratiques proposée, il faut connecter un poste supplémentaire sur le même
      réseau local que celui de l'interface <acronym xmlns:xlink="http://www.w3.org/1999/xlink">LAN</acronym> du routeur
      d'agence. C'est le trafic réseau initié par ce nouvel hôte réseau qui
      utilise les deux règles de la chaîne <option xmlns:xlink="http://www.w3.org/1999/xlink">FORWARD</option> implantées
      dans le script ci-dessus.</para>

      <para xmlns:xlink="http://www.w3.org/1999/xlink">L'instruction
      <userinput xmlns:xlink="http://www.w3.org/1999/xlink"><prompt xmlns:xlink="http://www.w3.org/1999/xlink">#</prompt> iptables -vL FORWARD</userinput>
      affiche les compteurs relatifs à la chaîne <option xmlns:xlink="http://www.w3.org/1999/xlink">FORWARD</option>. Ces
      compteurs évoluent lorsqu'un nouveau trafic à destination d'un autre
      réseau apparaît sur une interface.</para>
      </answer>
    </qandaentry>

    <qandaentry xmlns:xlink="http://www.w3.org/1999/xlink">
      <question xmlns:xlink="http://www.w3.org/1999/xlink">
      <para xmlns:xlink="http://www.w3.org/1999/xlink"><phrase xmlns:xlink="http://www.w3.org/1999/xlink">Quelle est la syntaxe de la commande
      <command xmlns:xlink="http://www.w3.org/1999/xlink">iptables</command> qui permet l'administration à distance du
      routeur d'agence (<wordasword xmlns:xlink="http://www.w3.org/1999/xlink">Spoke</wordasword>) via son interface
      <acronym xmlns:xlink="http://www.w3.org/1999/xlink">WAN</acronym> en utilisant le protocole
      <acronym xmlns:xlink="http://www.w3.org/1999/xlink">SSH</acronym> ? Proposer une  configuration qui offre une
      protection contre les attaques de type «dictionnaire».</phrase></para>
      </question>
      <answer xmlns:xlink="http://www.w3.org/1999/xlink">
      <para xmlns:xlink="http://www.w3.org/1999/xlink">Un premier niveau de réponse consiste à admettre les nouvelles
      demandes de connexions <acronym xmlns:xlink="http://www.w3.org/1999/xlink">TCP</acronym> sur le port numéro 22 sur
      l'interface <acronym xmlns:xlink="http://www.w3.org/1999/xlink">WAN</acronym>. On obtient alors le jeu de règles
      suivant.</para>

<screen xmlns:xlink="http://www.w3.org/1999/xlink" width="80"><prompt xmlns:xlink="http://www.w3.org/1999/xlink">#</prompt> grep -v '^# ' /var/lib/iptables/active
*nat
:PREROUTING ACCEPT [0:0]
:POSTROUTING ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
#~~~~~~~~~~~~~~~~~~~~~:: POSTROUTING
-A POSTROUTING -o ippp0 -j MASQUERADE
COMMIT
*filter
:INPUT DROP [0:0]
:FORWARD DROP [0:0]
:OUTPUT DROP [0:0]
#~~~~~~~~~~~~~~~~~~~~~:: INPUT
-A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
-A INPUT -p icmp --icmp-type echo-request -m limit --limit 5/min -m state --state NEW -j ACCEPT
-A INPUT -i lo -m state --state NEW -j ACCEPT
<emphasis xmlns:xlink="http://www.w3.org/1999/xlink">-A INPUT -i ippp0 -p tcp --syn --dport 22 -m state --state NEW -j ACCEPT</emphasis>
#~~~~~~~~~~~~~~~~~~~~~:: FORWARD
-A FORWARD -m state --state ESTABLISHED,RELATED -j ACCEPT
-A FORWARD -i eth0 -m state --state NEW -j ACCEPT
#~~~~~~~~~~~~~~~~~~~~~:: OUTPUT
-A OUTPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
-A OUTPUT -o lo -m state --state NEW -j ACCEPT
-A OUTPUT -o ippp0 -m state --state NEW -j ACCEPT
-A OUTPUT -o eth0 -m state --state NEW -j ACCEPT
COMMIT</screen>

      <para xmlns:xlink="http://www.w3.org/1999/xlink">Du point de vue sécurité, cette configuration n'est pas très
      satisfaisante. Sachant que toutes les nouvelles demandes de connexion
      <acronym xmlns:xlink="http://www.w3.org/1999/xlink">TCP</acronym> sont acceptées, on ouvre la porte à toutes les
      attaques de type «dictionnaire».</para>

      <para xmlns:xlink="http://www.w3.org/1999/xlink">La section <citetitle xmlns:xlink="http://www.w3.org/1999/xlink">«10.3.19. Correspondance Recent»</citetitle>
      du <link xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="http://www.inetdoc.net/guides/iptables-tutorial/"><citetitle xmlns:xlink="http://www.w3.org/1999/xlink">Tutoriel iptables</citetitle></link> décrit précisément les différentes
      possibilités du module <option xmlns:xlink="http://www.w3.org/1999/xlink">recent</option>. En utilisant cette
      fonctionnalité, on peut remplacer la solution donnée ci-dessus par le jeu
      de règles suivant qui limite ne nombre de tentatives de connexions à 4
      par minute.</para>

<screen xmlns:xlink="http://www.w3.org/1999/xlink" width="80"><prompt xmlns:xlink="http://www.w3.org/1999/xlink">#</prompt> grep -v '^# ' /var/lib/iptables/active
*nat
:PREROUTING ACCEPT [0:0]
:POSTROUTING ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
#~~~~~~~~~~~~~~~~~~~~~:: POSTROUTING
-A POSTROUTING -o ippp0 -j MASQUERADE
COMMIT
*filter
:INPUT DROP [0:0]
:FORWARD DROP [0:0]
:OUTPUT DROP [0:0]
#~~~~~~~~~~~~~~~~~~~~~:: INPUT
-A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
-A INPUT -p icmp --icmp-type echo-request -m limit --limit 5/min \
     -m state --state NEW -j ACCEPT
-A INPUT -i lo -m state --state NEW -j ACCEPT
<emphasis xmlns:xlink="http://www.w3.org/1999/xlink">-A INPUT -i ippp0 -p tcp --dport 22 -m recent --set --name SSH \
     -m state --state NEW -j ACCEPT
-A INPUT -i ippp0 -p tcp --dport 22 -m recent --update --seconds 60 --hitcount 4 \
     --rttl --name SSH -m limit --limit 5/min -j LOG --log-prefix "SSH_brute_force "
-A INPUT -i ippp0 -p tcp --dport 22 \
     -m recent --update --seconds 60 --hitcount 4 --rttl --name SSH -j DROP</emphasis>
#~~~~~~~~~~~~~~~~~~~~~:: FORWARD
-A FORWARD -m state --state ESTABLISHED,RELATED -j ACCEPT
-A FORWARD -i eth0 -m state --state NEW -j ACCEPT
#~~~~~~~~~~~~~~~~~~~~~:: OUTPUT
-A OUTPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
-A OUTPUT -o lo -m state --state NEW -j ACCEPT
-A OUTPUT -o ippp0 -m state --state NEW -j ACCEPT
-A OUTPUT -o eth0 -m state --state NEW -j ACCEPT
COMMIT</screen>

<warning xmlns:xlink="http://www.w3.org/1999/xlink">
  <para xmlns:xlink="http://www.w3.org/1999/xlink">Dans la copie d'écran ci-dessus, des lignes ont été coupées avec des
  caractères '\' dans le but d'optimiser l'affichage. Pour rétablir la syntaxe
  correcte des règles de filtrage, il est possible d'utiliser
  <application xmlns:xlink="http://www.w3.org/1999/xlink">sed</application> avec une instruction du type
  <userinput xmlns:xlink="http://www.w3.org/1999/xlink"><prompt xmlns:xlink="http://www.w3.org/1999/xlink">$</prompt> sed '/^[ \-].*\\$/N;s/\\\n *//' dump.iptables</userinput>
  où le fichier <filename xmlns:xlink="http://www.w3.org/1999/xlink">dump.iptables</filename> contient la copie d'écran
  ci-dessus.</para>
</warning>

      <para xmlns:xlink="http://www.w3.org/1999/xlink">Non seulement la solution présentée ci-dessus s'est montrée très
      efficace ces dernières années, mais elle à le mérite de ne pas faire
      intervenir un outil tiers ; ce qui diminue le coût
      d'administration.</para>
      </answer>
    </qandaentry>
  </qandaset>
</sect1>

<sect1 xmlns:xlink="http://www.w3.org/1999/xlink" xml:id="interco.netfilter.qa.routeur">
  <title xmlns:xlink="http://www.w3.org/1999/xlink">Règles de filtrage sur le routeur central
  (<wordasword xmlns:xlink="http://www.w3.org/1999/xlink">hub</wordasword>)</title>

  <para xmlns:xlink="http://www.w3.org/1999/xlink">Suivant le cahier des charges fixé, le routeur central doit autoriser
  le trafic issu du poste client sur son interface <acronym xmlns:xlink="http://www.w3.org/1999/xlink">WAN</acronym> et le
  router sur l'interface <acronym xmlns:xlink="http://www.w3.org/1999/xlink">LAN</acronym>.</para>

  <para xmlns:xlink="http://www.w3.org/1999/xlink">Tout comme dans le cas du routeur d'agence, on utilise le jeu de
  règles communes que l'on complète avec les besoins spécifiques à la
  configuration d'un routeur qui doit faire transiter le trafic d'un interface
  sur l'autre.</para>

  <para xmlns:xlink="http://www.w3.org/1999/xlink">À la différence du routeur d'agence, le routeur central maîtrise
  l'attribution des adresses <acronym xmlns:xlink="http://www.w3.org/1999/xlink">IP</acronym>. On peut donc inclure le
  contrôle des adresses <acronym xmlns:xlink="http://www.w3.org/1999/xlink">IP</acronym> sources dans les règles de
  filtrage réseau.</para>

  <qandaset xmlns:xlink="http://www.w3.org/1999/xlink">
    <qandaentry xmlns:xlink="http://www.w3.org/1999/xlink">
      <question xmlns:xlink="http://www.w3.org/1999/xlink">
      <para xmlns:xlink="http://www.w3.org/1999/xlink"><phrase xmlns:xlink="http://www.w3.org/1999/xlink">Le jeu de règles communes est-il suffisant pour que le
      poste se comporte comme un routeur ?</phrase></para>

      <para xmlns:xlink="http://www.w3.org/1999/xlink">Identifier les conditions nécessaires pour que la fonction routage
      du noyau soit active et que le filtrage réseau autorise le transit de
      l'interface <acronym xmlns:xlink="http://www.w3.org/1999/xlink">WAN</acronym> vers l'interface
      <acronym xmlns:xlink="http://www.w3.org/1999/xlink">LAN</acronym>.</para>
      </question>
      <answer xmlns:xlink="http://www.w3.org/1999/xlink">
      <para xmlns:xlink="http://www.w3.org/1999/xlink">Non. Il manque au moins 2 conditions pour que le routage et la
      traduction d'adresses sources soient actifs.</para>
      <itemizedlist xmlns:xlink="http://www.w3.org/1999/xlink">
        <listitem xmlns:xlink="http://www.w3.org/1999/xlink">
	<para xmlns:xlink="http://www.w3.org/1999/xlink">Pour qu'un paquet soit transmis d'une interface réseau vers une
	autre, il faut s'assurer que le routage est actif au niveau du noyau.
	Cette fonction est paramétrée par la variable d'état
	<option xmlns:xlink="http://www.w3.org/1999/xlink">ip_forward</option> du système de fichiers virtuel <filename xmlns:xlink="http://www.w3.org/1999/xlink" class="directory">/proc</filename>. La valeur <option xmlns:xlink="http://www.w3.org/1999/xlink">1</option>
	indique que la fonction routage est active dans le noyau :</para>

<screen xmlns:xlink="http://www.w3.org/1999/xlink" width="80"># echo 1 &gt; /proc/sys/net/ipv4/ip_forward
</screen>
	</listitem>
	<listitem xmlns:xlink="http://www.w3.org/1999/xlink">
	<para xmlns:xlink="http://www.w3.org/1999/xlink">Comme la politique par défaut sur la chaîne
	<option xmlns:xlink="http://www.w3.org/1999/xlink">FORWARD</option> est <option xmlns:xlink="http://www.w3.org/1999/xlink">DROP</option>, aucun paquet ne
	peut traverser les règles de filtrage et transiter d'une interface vers
	l'autre. Sans règle supplémentaire, les tests <acronym xmlns:xlink="http://www.w3.org/1999/xlink">ICMP</acronym>
	doivent incrémenter le compteur <option xmlns:xlink="http://www.w3.org/1999/xlink">DROP</option> de la chaîne
	<option xmlns:xlink="http://www.w3.org/1999/xlink">FORWARD</option>.</para>
	</listitem>
      </itemizedlist>
      </answer>
    </qandaentry>

    <qandaentry xmlns:xlink="http://www.w3.org/1999/xlink">
      <question xmlns:xlink="http://www.w3.org/1999/xlink">
      <para xmlns:xlink="http://www.w3.org/1999/xlink"><phrase xmlns:xlink="http://www.w3.org/1999/xlink">Quelle est la syntaxe de la commande
      <command xmlns:xlink="http://www.w3.org/1999/xlink">iptables</command> qui autorise le transfert des paquets entrant
      par l'interface <acronym xmlns:xlink="http://www.w3.org/1999/xlink">WAN</acronym> vers l'interface
      <acronym xmlns:xlink="http://www.w3.org/1999/xlink">LAN</acronym> ?</phrase></para>
      </question>
      <answer xmlns:xlink="http://www.w3.org/1999/xlink">
      <para xmlns:xlink="http://www.w3.org/1999/xlink">Il faut implanter deux règles dans la chaîne
      <option xmlns:xlink="http://www.w3.org/1999/xlink">FORWARD</option>. Une première règle qui correspond à ce qui a
      déjà été vu dans la mise au point du jeu de règles communes pour les
      chaînes <option xmlns:xlink="http://www.w3.org/1999/xlink">INPUT</option> et <option xmlns:xlink="http://www.w3.org/1999/xlink">OUTPUT</option> : tout
      trafic relatif à une demande enregistrée dans la machine d'état de suivi
      de communication est accepté. Une seconde règle qui accepte les paquets
      entrants par l'interface <acronym xmlns:xlink="http://www.w3.org/1999/xlink">LAN</acronym> en enregistrant les
      nouvelles communication dans la même machine d'état. On obtient le jeu de
      règles suivant :</para>

<screen xmlns:xlink="http://www.w3.org/1999/xlink" width="80"># cat iptables.router
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# T a b l e   F I L T E R
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*filter
:INPUT DROP [0:0]
:FORWARD DROP [0:0]
:OUTPUT DROP [0:0]
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# I N P U T
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
-A INPUT -p icmp -m limit --limit 5/sec -m state --state NEW -j ACCEPT
-A INPUT -i lo -m state --state NEW -j ACCEPT
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# F O R W A R D
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-A FORWARD -m state --state RELATED,ESTABLISHED -j ACCEPT
-A FORWARD -i ippp0 -s 192.168.96.0/20 -m state --state NEW -j ACCEPT
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# O U T P U T
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-A OUTPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
-A OUTPUT -o lo -m state --state NEW -j ACCEPT
-A OUTPUT -o eth0 -m state --state NEW -j ACCEPT
COMMIT
</screen>
      </answer>
    </qandaentry>

    <qandaentry xmlns:xlink="http://www.w3.org/1999/xlink">
      <question xmlns:xlink="http://www.w3.org/1999/xlink">
      <para xmlns:xlink="http://www.w3.org/1999/xlink"><phrase xmlns:xlink="http://www.w3.org/1999/xlink">Après avoir initié des communications avec les différents
      protocoles usuels (<acronym xmlns:xlink="http://www.w3.org/1999/xlink">ICMP</acronym>, <acronym xmlns:xlink="http://www.w3.org/1999/xlink">UDP</acronym> et
      <acronym xmlns:xlink="http://www.w3.org/1999/xlink">TCP</acronym>), relever l'état des communications du routeur
      d'agence distant avec l'outil
      <application xmlns:xlink="http://www.w3.org/1999/xlink">iptsate</application></phrase>.</para>
      </question>
    </qandaentry>

    <qandaentry xmlns:xlink="http://www.w3.org/1999/xlink">
      <question xmlns:xlink="http://www.w3.org/1999/xlink">
      <para xmlns:xlink="http://www.w3.org/1999/xlink"><phrase xmlns:xlink="http://www.w3.org/1999/xlink">Est-il possible de visualiser à l'aide de l'analyseur
      réseau <application xmlns:xlink="http://www.w3.org/1999/xlink">wireshark</application> le trafic retour relatif aux
      requêtes émises par le client
      <acronym xmlns:xlink="http://www.w3.org/1999/xlink">WAN</acronym> ?</phrase></para>
      </question>
      <answer xmlns:xlink="http://www.w3.org/1999/xlink">
      <para xmlns:xlink="http://www.w3.org/1999/xlink">Non. Pour que le trafic retour aboutisse sur l'interface du client
      <acronym xmlns:xlink="http://www.w3.org/1999/xlink">WAN</acronym>, il faudrait que la route vers le réseau étendu
      soit connue du reste de l'Internet.</para>
      </answer>
    </qandaentry>

    <qandaentry xmlns:xlink="http://www.w3.org/1999/xlink">
      <question xmlns:xlink="http://www.w3.org/1999/xlink">
      <para xmlns:xlink="http://www.w3.org/1999/xlink"><phrase xmlns:xlink="http://www.w3.org/1999/xlink">Sans protocole de routage dynamique assurant la publication
      de la route vers le réseau étendu sur l'Internet, quelle est la solution
      technique à utiliser pour que les postes clients distants puissent
      accéder aux autres réseaux ?</phrase></para>
      </question>
      <answer xmlns:xlink="http://www.w3.org/1999/xlink">
      <para xmlns:xlink="http://www.w3.org/1999/xlink">C'est la traduction d'adresse source qui permet d'utiliser
      l'adresse <acronym xmlns:xlink="http://www.w3.org/1999/xlink">IP</acronym> de l'interface <acronym xmlns:xlink="http://www.w3.org/1999/xlink">LAN</acronym> du
      routeur comme la seule interface visible de l'Internet.</para>
      </answer>
    </qandaentry>

    <qandaentry xmlns:xlink="http://www.w3.org/1999/xlink">
      <question xmlns:xlink="http://www.w3.org/1999/xlink">
      <para xmlns:xlink="http://www.w3.org/1999/xlink"><phrase xmlns:xlink="http://www.w3.org/1999/xlink">Quelle est la syntaxe de la règle d'implantation de la
      traduction d'adresses <acronym xmlns:xlink="http://www.w3.org/1999/xlink">IP</acronym> source en sortie de
      l'interface <acronym xmlns:xlink="http://www.w3.org/1999/xlink">LAN</acronym> du routeur
      central ?</phrase></para>
      </question>
      <answer xmlns:xlink="http://www.w3.org/1999/xlink">

<screen xmlns:xlink="http://www.w3.org/1999/xlink" width="80"># cat iptables.router
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# T a b l e   N A T
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*nat
:PREROUTING ACCEPT [0:0]
:POSTROUTING ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
-A POSTROUTING -o eth0 -j MASQUERADE
COMMIT
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# T a b l e   F I L T E R
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*filter
:INPUT DROP [0:0]
:FORWARD DROP [0:0]
:OUTPUT DROP [0:0]
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# I N P U T
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
-A INPUT -p icmp -m limit --limit 5/sec -m state --state NEW -j ACCEPT
-A INPUT -i lo -m state --state NEW -j ACCEPT
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# F O R W A R D
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-A FORWARD -m state --state RELATED,ESTABLISHED -j ACCEPT
-A FORWARD -i ippp0 -s 192.168.96.0/20 -m state --state NEW -j ACCEPT
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# O U T P U T
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-A OUTPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
-A OUTPUT -o lo -m state --state NEW -j ACCEPT
-A OUTPUT -o eth0 -m state --state NEW -j ACCEPT
COMMIT
</screen>
      </answer>
    </qandaentry>
  </qandaset>
</sect1>

<sect1 xmlns:xlink="http://www.w3.org/1999/xlink" xml:id="interco.netfilter.qa.extended">
  <title xmlns:xlink="http://www.w3.org/1999/xlink">Règles de filtrage avec identification des protocoles</title>

  <para xmlns:xlink="http://www.w3.org/1999/xlink">Pour les deux configurations étudiées ci-avant, aucune distinction de
  protocole n'a été effectuée. Pour affiner le processus d'enregistrement et de
  suivi des communications réseau, il est possible de distinguer les
  caractéristiques de chacun des protocoles autorisés.</para>

  <sect2 xmlns:xlink="http://www.w3.org/1999/xlink" xml:id="interco.netfilter.qa.extended.icmp">
    <title xmlns:xlink="http://www.w3.org/1999/xlink">Protocole ICMP</title>

  <para xmlns:xlink="http://www.w3.org/1999/xlink">Le protocole <acronym xmlns:xlink="http://www.w3.org/1999/xlink">ICMP</acronym> décrit dans le document standard
  <link xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="http://www.faqs.org/rfcs/rfc792.html">
  RFC792 <citetitle xmlns:xlink="http://www.w3.org/1999/xlink">Internet Control Message Protocol</citetitle></link> est une pièce essentielle du modèle <acronym xmlns:xlink="http://www.w3.org/1999/xlink">TCP/IP</acronym>.
  Il est principalement utilisé pour rapporter les conditions d'erreurs sur les
  réseaux. Cependant, les caractéristiques actuelles du protocole ne
  recommandent aucun contrôle de validation sur les messages d'erreur reçus. Ce
  protocole laisse donc la porte ouverte à une grande variété d'attaques qui
  peuvent être effectuées contre <acronym xmlns:xlink="http://www.w3.org/1999/xlink">TCP</acronym> à l'aide de messages
  <acronym xmlns:xlink="http://www.w3.org/1999/xlink">ICMP</acronym>. Ces attaques comprennent la réinitialisation de
  connexion, la réduction du débit de sortie, les dégradations de performances.
  Toutes ces attaques peuvent être réalisées depuis des réseaux distants, sans
  la nécessité d'analyser les paquets qui correspondent à la connexion
  <acronym xmlns:xlink="http://www.w3.org/1999/xlink">TCP</acronym> attaquée.</para> 
  
  <para xmlns:xlink="http://www.w3.org/1999/xlink">Alors que les implications sur la sécurité du protocole
  <acronym xmlns:xlink="http://www.w3.org/1999/xlink">ICMP</acronym> sont connues depuis longtemps, tous les systèmes
  n'ont pas mis en application des contrôles de validation sur les messages
  d'erreur reçus pour réduire au minimum l'impact de ces attaques.</para>

  <para xmlns:xlink="http://www.w3.org/1999/xlink">Au niveau du noyau Linux, les responsables du sous-système réseau ont
  décidé de ne plus traiter les messages de type 4
  <option xmlns:xlink="http://www.w3.org/1999/xlink">source-quench</option>.</para>

  <para xmlns:xlink="http://www.w3.org/1999/xlink">On dispose des ressources suivantes pour débuter l'étude du protocole
  <acronym xmlns:xlink="http://www.w3.org/1999/xlink">ICMP</acronym>.</para> 

  <itemizedlist xmlns:xlink="http://www.w3.org/1999/xlink">
    <listitem xmlns:xlink="http://www.w3.org/1999/xlink">
    <para xmlns:xlink="http://www.w3.org/1999/xlink">La liste des types de messages <acronym xmlns:xlink="http://www.w3.org/1999/xlink">ICMP</acronym> est
    enregistrée par l'<citetitle xmlns:xlink="http://www.w3.org/1999/xlink">Internet Assigned Numbers
    Authority</citetitle> (<acronym xmlns:xlink="http://www.w3.org/1999/xlink">IANA</acronym>) :
    <link xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="http://www.iana.org/assignments/icmp-parameters">
   <citetitle xmlns:xlink="http://www.w3.org/1999/xlink">ICMP parameters</citetitle></link>.</para>
    </listitem>
    <listitem xmlns:xlink="http://www.w3.org/1999/xlink">
    <para xmlns:xlink="http://www.w3.org/1999/xlink">Le <link xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="http://www.inetdoc.net/guides/iptables-tutorial/"><citetitle xmlns:xlink="http://www.w3.org/1999/xlink">Tutoriel iptables</citetitle></link> contient une section complète de
    présentation des caractéristiques du protocole
    <acronym xmlns:xlink="http://www.w3.org/1999/xlink">ICMP</acronym>.</para>
    </listitem>
  </itemizedlist>
  </sect2>

  <sect2 xmlns:xlink="http://www.w3.org/1999/xlink" xml:id="interco.netfilter.qa.extended.common">
    <title xmlns:xlink="http://www.w3.org/1999/xlink">Règles de filtrage communes à toutes les configurations</title>

  <itemizedlist xmlns:xlink="http://www.w3.org/1999/xlink">
    <listitem xmlns:xlink="http://www.w3.org/1999/xlink">
    <para xmlns:xlink="http://www.w3.org/1999/xlink">Avec le protocole <acronym xmlns:xlink="http://www.w3.org/1999/xlink">TCP</acronym>, il est possible
    d'identifier les phases d'établissement, de maintien et de libération de
    connexion.</para>
    </listitem>
    <listitem xmlns:xlink="http://www.w3.org/1999/xlink">
    <para xmlns:xlink="http://www.w3.org/1999/xlink">Avec le protocole <acronym xmlns:xlink="http://www.w3.org/1999/xlink">UDP</acronym>, il n'y a pas grand chose à
    identifier puisque ce protocole n'est pas orienté connexion et que le
    nombre des champs de l'en-tête est très limité.</para>
    </listitem>
  </itemizedlist>

  <qandaset xmlns:xlink="http://www.w3.org/1999/xlink">
    <qandaentry xmlns:xlink="http://www.w3.org/1999/xlink">
      <question xmlns:xlink="http://www.w3.org/1999/xlink">
      <para xmlns:xlink="http://www.w3.org/1999/xlink"><phrase xmlns:xlink="http://www.w3.org/1999/xlink">Quelle est la syntaxe d'appel de la commande
      <command xmlns:xlink="http://www.w3.org/1999/xlink">iptables</command> qui permet d'afficher la liste des messages
      <acronym xmlns:xlink="http://www.w3.org/1999/xlink">ICMP</acronym> et leurs types connus du système de filtrage
      réseau ?</phrase></para>
      </question>
      <answer xmlns:xlink="http://www.w3.org/1999/xlink">
      <para xmlns:xlink="http://www.w3.org/1999/xlink">Après avoir recherché le mot clé <option xmlns:xlink="http://www.w3.org/1999/xlink">icmp</option> dans les
      pages de manuels de la commande <command xmlns:xlink="http://www.w3.org/1999/xlink">iptables</command>, on obtient
      l'instruction suivante :
      <userinput xmlns:xlink="http://www.w3.org/1999/xlink"># iptables -p icmp -h</userinput>.</para>
      </answer>
    </qandaentry>

    <qandaentry xmlns:xlink="http://www.w3.org/1999/xlink">
      <question xmlns:xlink="http://www.w3.org/1999/xlink">
      <para xmlns:xlink="http://www.w3.org/1999/xlink"><phrase xmlns:xlink="http://www.w3.org/1999/xlink">Quelles sont les modifications à apporter sur le jeu de
      règles communes pour distinguer les messages <acronym xmlns:xlink="http://www.w3.org/1999/xlink">ICMP</acronym> les
      plus importants ?</phrase></para>
      </question>
      <answer xmlns:xlink="http://www.w3.org/1999/xlink">
      <para xmlns:xlink="http://www.w3.org/1999/xlink">On considère quatre types de messages
      <acronym xmlns:xlink="http://www.w3.org/1999/xlink">ICMP</acronym> :</para>
      <itemizedlist xmlns:xlink="http://www.w3.org/1999/xlink">
	<listitem xmlns:xlink="http://www.w3.org/1999/xlink">
	<para xmlns:xlink="http://www.w3.org/1999/xlink">Type de message 8 : <option xmlns:xlink="http://www.w3.org/1999/xlink">echo-request</option> :
	on autorise les nouvelles requêtes <wordasword xmlns:xlink="http://www.w3.org/1999/xlink">ping</wordasword> à
	raison de 5 par seconde.</para>
	</listitem>
	<listitem xmlns:xlink="http://www.w3.org/1999/xlink">
	<para xmlns:xlink="http://www.w3.org/1999/xlink">Type de message 0  <option xmlns:xlink="http://www.w3.org/1999/xlink">echo-reply</option> : on
	autorise les réponses <wordasword xmlns:xlink="http://www.w3.org/1999/xlink">pong</wordasword> aux requêtes
	<wordasword xmlns:xlink="http://www.w3.org/1999/xlink">ping</wordasword> enregistrées dans la machine d'état de
	suivi de communication.</para>
	</listitem>
	<listitem xmlns:xlink="http://www.w3.org/1999/xlink">
	<para xmlns:xlink="http://www.w3.org/1999/xlink">Type de message 3 :
	<option xmlns:xlink="http://www.w3.org/1999/xlink">destination-unreachable</option> : on autorise toutes les
	notifications d'erreur sur la destination relatives à une demande émise
	à partir de ce système.</para>
	</listitem>
	<listitem xmlns:xlink="http://www.w3.org/1999/xlink">
	<para xmlns:xlink="http://www.w3.org/1999/xlink">Type de message 11 : <option xmlns:xlink="http://www.w3.org/1999/xlink">time-exceeded</option> :
	on autorise toutes les notification de débordement de temps relatives
	au trafic émis à partir de ce système.</para>
	</listitem>
      </itemizedlist>

<screen xmlns:xlink="http://www.w3.org/1999/xlink" width="80"># cat iptables.common
*filter
:INPUT DROP [0:0]
:FORWARD DROP [0:0]
:OUTPUT DROP [0:0]
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# I N P U T
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-A INPUT -p icmp --icmp-type echo-request -m limit --limit 5/s -m state --state NEW -j ACCEPT
-A INPUT -p icmp --icmp-type echo-reply -m state --state ESTABLISHED -j ACCEPT
-A INPUT -p icmp --icmp-type destination-unreachable -m state --state RELATED -j ACCEPT
-A INPUT -p icmp --icmp-type time-exceeded -m state --state RELATED -j ACCEPT
-A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
-A INPUT -i lo -m state --state NEW -j ACCEPT
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# O U T P U T
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-A OUTPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
-A OUTPUT -o lo -m state --state NEW -j ACCEPT
COMMIT
</screen>
      </answer>
    </qandaentry>

    <qandaentry xmlns:xlink="http://www.w3.org/1999/xlink">
      <question xmlns:xlink="http://www.w3.org/1999/xlink">
      <para xmlns:xlink="http://www.w3.org/1999/xlink"><phrase xmlns:xlink="http://www.w3.org/1999/xlink">Quelles sont les modifications à apporter sur le jeu de
      règles communes pour distinguer les conditions sur les connexions
      <acronym xmlns:xlink="http://www.w3.org/1999/xlink">TCP</acronym> ?</phrase></para>
      </question>
      <answer xmlns:xlink="http://www.w3.org/1999/xlink">
      <para xmlns:xlink="http://www.w3.org/1999/xlink">On distingue les demandes d'ouverture de connexion avec l'option
      <option xmlns:xlink="http://www.w3.org/1999/xlink">--syn</option> des connexions déjà établies avec l'option inverse
      <option xmlns:xlink="http://www.w3.org/1999/xlink">! --syn</option>.</para>

<screen xmlns:xlink="http://www.w3.org/1999/xlink" width="80"># cat iptables.common
*filter
:INPUT DROP [0:0]
:FORWARD DROP [0:0]
:OUTPUT DROP [0:0]
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# I N P U T
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-A INPUT -p icmp --icmp-type echo-request -m limit --limit 5/s -m state --state NEW -j ACCEPT
-A INPUT -p icmp --icmp-type echo-reply -m state --state ESTABLISHED -j ACCEPT
-A INPUT -p icmp --icmp-type destination-unreachable -m state --state RELATED -j ACCEPT
-A INPUT -p icmp --icmp-type time-exceeded -m state --state RELATED -j ACCEPT
-A INPUT -p tcp ! --syn -m state --state ESTABLISHED -j ACCEPT
-A INPUT -p tcp --syn -m state --state RELATED -j ACCEPT
-A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
-A INPUT -i lo -m state --state NEW -j ACCEPT
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# O U T P U T
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-A OUTPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
-A OUTPUT -o lo -m state --state NEW -j ACCEPT
COMMIT
</screen>
      </answer>
    </qandaentry>

    <qandaentry xmlns:xlink="http://www.w3.org/1999/xlink">
      <question xmlns:xlink="http://www.w3.org/1999/xlink">
      <para xmlns:xlink="http://www.w3.org/1999/xlink"><phrase xmlns:xlink="http://www.w3.org/1999/xlink">Quelles sont les modifications à apporter sur le jeu de
      règles communes pour distinguer le protocole
      <acronym xmlns:xlink="http://www.w3.org/1999/xlink">UDP</acronym> ?</phrase></para>
      </question>
      <answer xmlns:xlink="http://www.w3.org/1999/xlink">

<screen xmlns:xlink="http://www.w3.org/1999/xlink" width="80"># cat iptables.common
*filter
:INPUT DROP [0:0]
:FORWARD DROP [0:0]
:OUTPUT DROP [0:0]
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# I N P U T
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-A INPUT -p icmp --icmp-type echo-request -m limit --limit 5/s -m state --state NEW -j ACCEPT
-A INPUT -p icmp --icmp-type echo-reply -m state --state ESTABLISHED -j ACCEPT
-A INPUT -p icmp --icmp-type destination-unreachable -m state --state RELATED -j ACCEPT
-A INPUT -p icmp --icmp-type time-exceeded -m state --state RELATED -j ACCEPT
-A INPUT -p tcp ! --syn -m state --state ESTABLISHED -j ACCEPT
-A INPUT -p tcp --syn -m state --state RELATED -j ACCEPT
-A INPUT -p udp -m state --state ESTABLISHED,RELATED -j ACCEPT
-A INPUT -i lo -m state --state NEW -j ACCEPT
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# O U T P U T
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-A OUTPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
-A OUTPUT -o lo -m state --state NEW -j ACCEPT
COMMIT
</screen>
      </answer>
    </qandaentry>
  </qandaset>
  </sect2>
</sect1>

<sect1 xmlns:xlink="http://www.w3.org/1999/xlink" xml:id="interco.netfilter.qa.refdocs">
  <title xmlns:xlink="http://www.w3.org/1999/xlink">Documents de référence</title>

  <sect2 xmlns:xlink="http://www.w3.org/1999/xlink" xml:id="interco.netfilter.qa.refdocs.ietf">
    <title xmlns:xlink="http://www.w3.org/1999/xlink">IETF &amp; IANA</title>

  <variablelist xmlns:xlink="http://www.w3.org/1999/xlink">
    <varlistentry xmlns:xlink="http://www.w3.org/1999/xlink" xml:id="interco.netfilter.qa.refdocs.iana.icmp-types">
      <term xmlns:xlink="http://www.w3.org/1999/xlink"><citetitle xmlns:xlink="http://www.w3.org/1999/xlink">Types de messages ICMP</citetitle></term>
      <listitem xmlns:xlink="http://www.w3.org/1999/xlink">
	<para xmlns:xlink="http://www.w3.org/1999/xlink">L'<citetitle xmlns:xlink="http://www.w3.org/1999/xlink">Internet Assigned Numbers Authority</citetitle> a
	enregistré les types de messages <acronym xmlns:xlink="http://www.w3.org/1999/xlink">ICMP</acronym> à la page
	<link xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="http://www.iana.org/assignments/icmp-parameters">
   <citetitle xmlns:xlink="http://www.w3.org/1999/xlink">ICMP parameters</citetitle></link>.</para>
      </listitem>
    </varlistentry>
  </variablelist>
  </sect2>

  <sect2 xmlns:xlink="http://www.w3.org/1999/xlink" xml:id="interco.netfilter.qa.refdocs.debian">
    <title xmlns:xlink="http://www.w3.org/1999/xlink">Distribution Debian GNU/Linux</title>

  <variablelist xmlns:xlink="http://www.w3.org/1999/xlink">
    <varlistentry xmlns:xlink="http://www.w3.org/1999/xlink" xml:id="interco.netfilter.qa.debian-reference.networking">
      <term xmlns:xlink="http://www.w3.org/1999/xlink"><citetitle xmlns:xlink="http://www.w3.org/1999/xlink">Manuel de référence Debian</citetitle></term>
      <listitem xmlns:xlink="http://www.w3.org/1999/xlink">
	<para xmlns:xlink="http://www.w3.org/1999/xlink"><link xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="http://www.debian.org/doc/manuals/debian-reference/ch05.fr.html"><citetitle xmlns:xlink="http://www.w3.org/1999/xlink">Manuel de référence Debian : configuration du réseau</citetitle></link> : chapitre du manuel de
	référence <citetitle xmlns:xlink="http://www.w3.org/1999/xlink">Debian</citetitle> consacré à la configuration
	réseau.</para>
      </listitem>
    </varlistentry>
  </variablelist>
  </sect2>

  <sect2 xmlns:xlink="http://www.w3.org/1999/xlink" xml:id="interco.netfilter.qa.refdocs.inetdoc">
    <title xmlns:xlink="http://www.w3.org/1999/xlink">Site inetdoc.net</title>

  <variablelist xmlns:xlink="http://www.w3.org/1999/xlink">
    <varlistentry xmlns:xlink="http://www.w3.org/1999/xlink" xml:id="interco.netfilter.qa.config.interface.lan">
      <term xmlns:xlink="http://www.w3.org/1999/xlink"><citetitle xmlns:xlink="http://www.w3.org/1999/xlink">Configuration d'une interface de réseau local</citetitle></term>
      <listitem xmlns:xlink="http://www.w3.org/1999/xlink">
      <para xmlns:xlink="http://www.w3.org/1999/xlink"><link xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="http://www.inetdoc.net/travaux_pratiques/config.interface.lan/"><citetitle xmlns:xlink="http://www.w3.org/1999/xlink">Configuration d'une interface de réseau local</citetitle></link> : identification du type d'interface,
      de ses caractéristiques et manipulations des paramètres. Ce support
      fournit une méthodologie de dépannage simple d'une connexion
      réseau.</para>
      </listitem>
    </varlistentry>

    <varlistentry xmlns:xlink="http://www.w3.org/1999/xlink" xml:id="interco.netfilter.qa.fonctions.noyau">
      <term xmlns:xlink="http://www.w3.org/1999/xlink"><citetitle xmlns:xlink="http://www.w3.org/1999/xlink">Fonctions réseau du noyau Linux</citetitle></term>
      <listitem xmlns:xlink="http://www.w3.org/1999/xlink">
      <para xmlns:xlink="http://www.w3.org/1999/xlink"><link xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="http://www.inetdoc.net/travaux_pratiques/interco.kernel.q/"><citetitle xmlns:xlink="http://www.w3.org/1999/xlink">Configuration des fonctions réseau &amp; compilation du noyau Linux</citetitle></link> : présentation et configuration des
      fonctions réseau du noyau LINUX</para>
      </listitem>
    </varlistentry>

    <varlistentry xmlns:xlink="http://www.w3.org/1999/xlink" xml:id="interco.netfilter.qa.fonctions.noyau.tp">
      <term xmlns:xlink="http://www.w3.org/1999/xlink"><citetitle xmlns:xlink="http://www.w3.org/1999/xlink">Configuration des fonctions réseau &amp; compilation du
      noyau LINUX</citetitle></term>
      <listitem xmlns:xlink="http://www.w3.org/1999/xlink">
      <para xmlns:xlink="http://www.w3.org/1999/xlink"><link xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="http://www.inetdoc.net/travaux_pratiques/interco.kernel.q/"><citetitle xmlns:xlink="http://www.w3.org/1999/xlink">Configuration des fonctions réseau &amp; compilation du noyau Linux</citetitle></link> : travaux pratiques sur la
      préparation d'un système routeur GNU/Linux. Compilation d'un noyau LINUX
      à partir de ses sources après avoir passé en revue ses fonctions réseau
      et sélectionné les pilotes de périphériques nécessaires.</para>
      </listitem>
    </varlistentry>

    <varlistentry xmlns:xlink="http://www.w3.org/1999/xlink" xml:id="interco.netfilter.qa.refdocs.iptables-tutorial">
      <term xmlns:xlink="http://www.w3.org/1999/xlink"><citetitle xmlns:xlink="http://www.w3.org/1999/xlink">Didacticiel sur Iptables</citetitle></term>
      <listitem xmlns:xlink="http://www.w3.org/1999/xlink">
      <para xmlns:xlink="http://www.w3.org/1999/xlink"><link xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="http://www.inetdoc.net/guides/iptables-tutorial/"><citetitle xmlns:xlink="http://www.w3.org/1999/xlink">Tutoriel iptables</citetitle></link> : guide très complet sur le
      fonctionnement du filtrage réseau avec les noyaux Linux.</para>
      </listitem>
    </varlistentry>

    <varlistentry xmlns:xlink="http://www.w3.org/1999/xlink" xml:id="interco.netfilter.qa.nat-howto">
      <term xmlns:xlink="http://www.w3.org/1999/xlink"><citetitle xmlns:xlink="http://www.w3.org/1999/xlink">Guide Pratique du NAT</citetitle></term>
      <listitem xmlns:xlink="http://www.w3.org/1999/xlink">
      <para xmlns:xlink="http://www.w3.org/1999/xlink"><link xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="http://www.netfilter.org/documentation/HOWTO/fr/NAT-HOWTO.html"><citetitle xmlns:xlink="http://www.w3.org/1999/xlink">Guide Pratique du NAT</citetitle></link> : Ce document décrit comment réaliser du
      camouflage d'adresse <acronym xmlns:xlink="http://www.w3.org/1999/xlink">IP</acronym>, un serveur mandataire
      transparent, de la redirection de ports ou d'autres formes de Traduction
      d'adresse réseau (<wordasword xmlns:xlink="http://www.w3.org/1999/xlink">Network Address Translation</wordasword> ou
      <acronym xmlns:xlink="http://www.w3.org/1999/xlink">NAT</acronym>) avec le noyau Linux 2.4.</para>
      </listitem>
    </varlistentry>
  </variablelist>
  </sect2>
</sect1>
</article>

