Passerelle et routes

Bonjour,

J’ai une machine qui fait office de passerelle entre deux réseaux . J’ai les routes suivants :

Destination     Passerelle      Genmask         Indic Metric Ref    Use Iface
0.0.0.0         192.168.6.253   0.0.0.0         UG    0      0        0 eth0
192.168.6.0     0.0.0.0         255.255.255.0   U     0      0        0 eth0
192.168.9.0     0.0.0.0         255.255.255.0   U     0      0        0 eth1

Pourtant lorsque je fais un ping de google.fr ou que j’essaie de mettre a jour cette machine, cela ne fonctionne pas.

Auriez vous une idée?
Merci

Les règles iptables ?
Les adresses de DNS définies dans /etc/resolv.conf ?

Les régles iptables en place
iptables -L
Chain INPUT (policy DROP)
target prot opt source destination
INETIN all – anywhere anywhere
ACCEPT all – localnet/24 anywhere
ACCEPT all – anywhere anywhere

    Chain FORWARD (policy DROP)
    target     prot opt source               destination         
    INETIN     all  --  anywhere             anywhere            
    INETOUT    all  --  anywhere             anywhere            

    Chain OUTPUT (policy ACCEPT)
    target     prot opt source               destination         
    INETOUT    all  --  anywhere             anywhere            

    Chain DMZIN (0 references)
    target     prot opt source               destination         

    Chain DMZOUT (0 references)
    target     prot opt source               destination         

    Chain INETIN (2 references)
    target     prot opt source               destination         
    LTREJECT   all  --  anywhere             anywhere             state INVALID
    LTREJECT   icmp --  anywhere             anywhere             icmp redirect
    LTREJECT   icmp --  anywhere             anywhere             icmp router-advertisement
    LTREJECT   icmp --  anywhere             anywhere             icmp router-solicitation
    LTREJECT   icmp --  anywhere             anywhere             icmptype 15
    LTREJECT   icmp --  anywhere             anywhere             icmptype 16
    LTREJECT   icmp --  anywhere             anywhere             icmp address-mask-request
    LTREJECT   icmp --  anywhere             anywhere             icmp address-mask-reply
    ACCEPT     icmp --  anywhere             anywhere             icmp echo-request limit: avg 50/sec burst 5
    LTREJECT   icmp --  anywhere             anywhere             icmp echo-request
    TCPACCEPT  tcp  --  anywhere             anywhere             tcp dpt:ssh
    TCPACCEPT  tcp  --  anywhere             anywhere             tcp dpt:http
    TCPACCEPT  tcp  --  anywhere             anywhere             tcp dpt:https
    UDPACCEPT  udp  --  anywhere             anywhere             udp dpt:domain
    ACCEPT     all  --  anywhere             anywhere             state ESTABLISHED
    TCPACCEPT  tcp  --  anywhere             anywhere             tcp dpts:1024:65535 state RELATED
    UDPACCEPT  udp  --  anywhere             anywhere             udp dpts:1024:65535 state RELATED
    LTREJECT   all  --  anywhere             anywhere            

    Chain INETOUT (2 references)
    target     prot opt source               destination         
    ACCEPT     all  --  anywhere             anywhere            

    Chain LDROP (0 references)
    target     prot opt source               destination         
    LOG        tcp  --  anywhere             anywhere             limit: avg 2/sec burst 5 LOG level info prefix "TCP Dropped "
    LOG        udp  --  anywhere             anywhere             limit: avg 2/sec burst 5 LOG level info prefix "UDP Dropped "
    LOG        icmp --  anywhere             anywhere             limit: avg 2/sec burst 5 LOG level info prefix "ICMP Dropped "
    LOG        all  -f  anywhere             anywhere             limit: avg 2/sec burst 5 LOG level warning prefix "FRAGMENT Dropped "
    DROP       all  --  anywhere             anywhere            

    Chain LREJECT (0 references)
    target     prot opt source               destination         
    LOG        tcp  --  anywhere             anywhere             limit: avg 2/sec burst 5 LOG level info prefix "TCP Rejected "
    LOG        udp  --  anywhere             anywhere             limit: avg 2/sec burst 5 LOG level info prefix "UDP Rejected "
    LOG        icmp --  anywhere             anywhere             limit: avg 2/sec burst 5 LOG level info prefix "ICMP Rejected "
    LOG        all  -f  anywhere             anywhere             limit: avg 2/sec burst 5 LOG level warning prefix "FRAGMENT Rejected "
    REJECT     all  --  anywhere             anywhere             reject-with icmp-port-unreachable

    Chain LTREJECT (13 references)
    target     prot opt source               destination         
    LOG        tcp  --  anywhere             anywhere             limit: avg 2/sec burst 5 LOG level info prefix "TCP Rejected "
    LOG        udp  --  anywhere             anywhere             limit: avg 2/sec burst 5 LOG level info prefix "UDP Rejected "
    LOG        icmp --  anywhere             anywhere             limit: avg 2/sec burst 5 LOG level info prefix "ICMP Rejected "
    LOG        all  -f  anywhere             anywhere             limit: avg 2/sec burst 5 LOG level warning prefix "FRAGMENT Rejected "
    TREJECT    all  --  anywhere             anywhere            

    Chain TCPACCEPT (4 references)
    target     prot opt source               destination         
    ACCEPT     tcp  --  anywhere             anywhere             tcpflags: FIN,SYN,RST,ACK/SYN limit: avg 500/sec burst 5
    LOG        tcp  --  anywhere             anywhere             tcpflags: FIN,SYN,RST,ACK/SYN limit: avg 2/sec burst 5 LOG level warning prefix "Possible SynFlood "
    LTREJECT   tcp  --  anywhere             anywhere             tcpflags: FIN,SYN,RST,ACK/SYN
    ACCEPT     tcp  --  anywhere             anywhere             tcpflags:! FIN,SYN,RST,ACK/SYN
    LOG        all  --  anywhere             anywhere             limit: avg 2/sec burst 5 LOG level warning prefix "Mismatch in TCPACCEPT "
    LTREJECT   all  --  anywhere             anywhere            

    Chain TREJECT (1 references)
    target     prot opt source               destination         
    REJECT     tcp  --  anywhere             anywhere             reject-with tcp-reset
    REJECT     udp  --  anywhere             anywhere             reject-with icmp-port-unreachable
    DROP       icmp --  anywhere             anywhere            
    REJECT     all  --  anywhere             anywhere             reject-with icmp-port-unreachable

    Chain UDPACCEPT (2 references)
    target     prot opt source               destination         
    ACCEPT     udp  --  anywhere             anywhere            
    LOG        all  --  anywhere             anywhere             limit: avg 2/sec burst 5 LOG level warning prefix "Mismatch on UDPACCEPT "
    LTREJECT   all  --  anywhere             anywhere            

    Chain ULDROP (0 references)
    target     prot opt source               destination         
    ULOG       tcp  --  anywhere             anywhere             limit: avg 2/sec burst 5 ULOG copy_range 0 nlgroup 1 prefix "LDROP_TCP" queue_threshold 1
    ULOG       udp  --  anywhere             anywhere             limit: avg 2/sec burst 5 ULOG copy_range 0 nlgroup 1 prefix "LDROP_UDP" queue_threshold 1
    ULOG       icmp --  anywhere             anywhere             limit: avg 2/sec burst 5 ULOG copy_range 0 nlgroup 1 prefix "LDROP_ICMP" queue_threshold 1
    ULOG       all  -f  anywhere             anywhere             limit: avg 2/sec burst 5 ULOG copy_range 0 nlgroup 1 prefix "LDROP_FRAG" queue_threshold 1
    DROP       all  --  anywhere             anywhere            

    Chain ULREJECT (0 references)
    target     prot opt source               destination         
    ULOG       tcp  --  anywhere             anywhere             limit: avg 2/sec burst 5 ULOG copy_range 0 nlgroup 1 prefix "LREJECT_TCP" queue_threshold 1
    ULOG       udp  --  anywhere             anywhere             limit: avg 2/sec burst 5 ULOG copy_range 0 nlgroup 1 prefix "LREJECT_UDP" queue_threshold 1
    ULOG       icmp --  anywhere             anywhere             limit: avg 2/sec burst 5 ULOG copy_range 0 nlgroup 1 prefix "LREJECT_UDP" queue_threshold 1
    ULOG       all  -f  anywhere             anywhere             limit: avg 2/sec burst 5 ULOG copy_range 0 nlgroup 1 prefix "LREJECT_FRAG" queue_threshold 1
    REJECT     all  --  anywhere             anywhere             reject-with icmp-port-unreachable

    Chain ULTREJECT (0 references)
    target     prot opt source               destination         
    ULOG       tcp  --  anywhere             anywhere             limit: avg 2/sec burst 5 ULOG copy_range 0 nlgroup 1 prefix "LTREJECT_TCP" queue_threshold 1
    ULOG       udp  --  anywhere             anywhere             limit: avg 2/sec burst 5 ULOG copy_range 0 nlgroup 1 prefix "LTREJECT_UDP" queue_threshold 1
    ULOG       icmp --  anywhere             anywhere             limit: avg 2/sec burst 5 ULOG copy_range 0 nlgroup 1 prefix "LTREJECT_ICMP" queue_threshold 1
    ULOG       all  -f  anywhere             anywhere             limit: avg 2/sec burst 5 ULOG copy_range 0 nlgroup 1 prefix "LTREJECT_FRAG" queue_threshold 1
    REJECT     tcp  --  anywhere             anywhere             reject-with tcp-reset
    REJECT     udp  --  anywhere             anywhere             reject-with icmp-port-unreachable
    DROP       icmp --  anywhere             anywhere            
    REJECT     all  --  anywhere             anywhere             reject-with icmp-port-unreachable

Le contenu du fichier resolv

 #search psf-fr.net
nameserver 192.168.6.98
nameserver 8.8.8.8

Avec iptables-save stp.
Par quoi ces règles ont-elle été générées ?

Aussi, quand tu écrivais “ça ne marche pas”, que se passe-t-il exactement ?

192.168.6.98 est bien l’adresse d’un serveur DNS récursif capable de résoudre les noms de domaines publics ?

Alors en fait il n’y a pas de régles iptables.

Quand je dis que cela ne fonctionne pas voila ce que sa donne.

ping www.google.fr
PING www.google.fr (216.58.209.227) 56(84) bytes of data.

apt-get update           
Err http://ftp.fr.debian.org wheezy Release.gpg                                                    
  Impossible d'initialiser la connexion � ftp.fr.debian.org:�80 (2a01:e0c:1:1598::2). - connect (101: Le r�seau n'est pas accessible) [IP�: 2a01:e0c:1:1598::2 80]
Ign http://ftp.fr.debian.org wheezy Release                                                        
Ign http://ftp.fr.debian.org wheezy/main Sources/DiffIndex
Ign http://ftp.fr.debian.org wheezy/contrib Sources/DiffIndex
Ign http://ftp.fr.debian.org wheezy/non-free Sources/DiffIndex
Ign http://ftp.fr.debian.org wheezy/main i386 Packages/DiffIndex
Ign http://ftp.fr.debian.org wheezy/contrib i386 Packages/DiffIndex
Ign http://ftp.fr.debian.org wheezy/non-free i386 Packages/DiffIndex
Err http://ftp.fr.debian.org wheezy/contrib Translation-fr_FR
  Impossible d'initialiser la connexion � ftp.fr.debian.org:�80 (2a01:e0c:1:1598::2). - connect (101: Le r�seau n'est pas accessible) [IP�: 2a01:e0c:1:1598::2 80]
Err http://ftp.fr.debian.org wheezy/contrib Translation-fr
  Impossible d'initialiser la connexion � ftp.fr.debian.org:�80 (2a01:e0c:1:1598::2). - connect (101: Le r�seau n'est pas accessible) [IP�: 2a01:e0c:1:1598::2 80]
Err http://ftp.fr.debian.org wheezy/contrib Translation-en
  Impossible d'initialiser la connexion � ftp.fr.debian.org:�80 (2a01:e0c:1:1598::2). - connect (101: Le r�seau n'est pas accessible) [IP�: 2a01:e0c:1:1598::2 80]
Err http://ftp.fr.debian.org wheezy/main Translation-fr_FR
  Impossible d'initialiser la connexion � ftp.fr.debian.org:�80 (2a01:e0c:1:1598::2). - connect (101: Le r�seau n'est pas accessible) [IP�: 2a01:e0c:1:1598::2 80]
Err http://ftp.fr.debian.org wheezy/main Translation-fr
  Impossible d'initialiser la connexion � ftp.fr.debian.org:�80 (2a01:e0c:1:1598::2). - connect (101: Le r�seau n'est pas accessible) [IP�: 2a01:e0c:1:1598::2 80]
Err http://ftp.fr.debian.org wheezy/main Translation-en
  Impossible d'initialiser la connexion � ftp.fr.debian.org:�80 (2a01:e0c:1:1598::2). - connect (101: Le r�seau n'est pas accessible) [IP�: 2a01:e0c:1:1598::2 80]
Err http://ftp.fr.debian.org wheezy/non-free Translation-fr_FR
  Impossible d'initialiser la connexion � ftp.fr.debian.org:�80 (2a01:e0c:1:1598::2). - connect (101: Le r�seau n'est pas accessible) [IP�: 2a01:e0c:1:1598::2 80]
Err http://ftp.fr.debian.org wheezy/non-free Translation-fr
  Impossible d'initialiser la connexion � ftp.fr.debian.org:�80 (2a01:e0c:1:1598::2). - connect (101: Le r�seau n'est pas accessible) [IP�: 2a01:e0c:1:1598::2 80]
Err http://ftp.fr.debian.org wheezy/non-free Translation-en
  Impossible d'initialiser la connexion � ftp.fr.debian.org:�80 (2a01:e0c:1:1598::2). - connect (101: Le r�seau n'est pas accessible) [IP�: 2a01:e0c:1:1598::2 80]

Et oui 192.168.6.98 est bien l’adresse d’un serveur DNS récursif capable de résoudre les noms de domaines publics. C’est notre DNS interne.

D’accord, la résolution DNS fonctionne.

Par contre quand tu dis qu’il n’y a pas de règles iptables, ce n’est pas ce que dit la sortie de la commande iptables -L ci-dessus. A quoi correspond-elle ?

NB : A moins que ton réseau et cette machine aient une connectivité IPv6 globale, le problème n’a rien à voir avec IPv6 malgré les messages d’erreurs d’apt-get mentionnant l’adresse IPv6 de ftp.fr.debian.org. apt-get a d’abord essayé de se connecter à l’adresse IPv4, sans succès puis a essayé l’adresse IPv6 sans plus de succès et, n’ayant plus d’adresse à essayer, a affiché un message d’erreur avec la dernière adresse utilisée qui se trouve être l’adresse IPv6.

La commandeiptables-save -c > save_iptables.txt donne un fichier vide.

Alors je répète ma question : d’où vient le résultat d’iptables -L que tu as posté plus haut ? D’une autre machine ?

Autre piste : le pare-feu du routeur internet autorise-t-il la machine à communiquer avec l’extérieur ?

Elle vient de la machine qui fait office de passerelle d’ou j’ai les problèmes de ping comme indiquer ci-dessus.

Oui elle l’autorise puisque cette machine qui est en place depuis des années fonctionnait correctement car j’ai pu la mettre a jour en Wheezy.

Bonjour,
Dans le fichier /etc/sysctl.conf, vérifie que net.ipv4.ip_forward=1 soit présent et pas commenté.
Le forwarding est très utile pour faire du routage.
Sinon, pour gérer tes règles iptables, tu peux utiliser iptables-persistent, un paquet de la suite netfilter-persistent.
Peux-tu aussi nous donner le retour de la commande iptables-save, merci.

iptables -L et iptables-save exécutés sur la même machine renvoient les mêmes règles, sous un format différent. Si l’une renvoie quelque chose, l’autre ne peut pas ne rien renvoyer.

ip_forward est forcément déjà à 1 sur une machine faisant office de routeur, et n’est pas utilisé pour les communications dont la machine est la source ou la destination.

À condition de le définir en faisant la configuration. Moi, par exemple, j’oublie à chaque fois et j’ai des soucis de routage.

Si la machine sert de routeur depuis longtemps, c’est forcément déjà le cas.

Alors je reprends.

Oui le net.ipv4.ip_forward=1 est bien dé commenté

Pour iptables-save en fait je me suis planté de machine et je lançais la commande sur la machine qui n’était pas la bonne. Désolé PascalHambourg!

Voici le résultat de la commande.

iptables-save
# Generated by iptables-save v1.4.14 on Thu Dec  8 23:12:07 2016
*mangle
:PREROUTING ACCEPT [38934545:3852116690]
:INPUT ACCEPT [37660350:3735540788]
:FORWARD ACCEPT [15497:15658815]
:OUTPUT ACCEPT [14984:1561654]
:POSTROUTING ACCEPT [30358:17212333]
COMMIT
# Completed on Thu Dec  8 23:12:07 2016
# Generated by iptables-save v1.4.14 on Thu Dec  8 23:12:07 2016
*nat
:PREROUTING ACCEPT [30530077:3116116650]
:INPUT ACCEPT [1823915:323758705]
:OUTPUT ACCEPT [3926:210136]
:POSTROUTING ACCEPT [5355:267296]
-A PREROUTING -i eth1 -p tcp -m tcp --dport 3010 -j DNAT --to-destination 192.168.9.8:3010
-A PREROUTING -i eth1 -p tcp -m tcp --dport 3011 -j DNAT --to-destination 192.168.9.5:3011
-A PREROUTING -i eth1 -p tcp -m tcp --dport 443 -j DNAT --to-destination 192.168.9.8:443
-A PREROUTING -i eth1 -p tcp -m tcp --dport 3014 -j DNAT --to-destination 192.168.9.13:80
-A PREROUTING -i eth1 -p tcp -m tcp --dport 3015 -j DNAT --to-destination 192.168.9.5:8080
-A PREROUTING -i eth1 -p tcp -m tcp --dport 21433 -j DNAT --to-destination 192.168.9.12:1433
-A PREROUTING -i eth1 -p tcp -m tcp --dport 31433 -j DNAT --to-destination 192.168.9.13:1433
-A PREROUTING -i eth1 -p udp -m udp --dport 21433 -j DNAT --to-destination 192.168.9.12:1433
-A PREROUTING -i eth1 -p udp -m udp --dport 31433 -j DNAT --to-destination 192.168.9.13:1433
-A PREROUTING -i eth0 -p tcp -m tcp --dport 3012 -j DNAT --to-destination 192.168.9.8:3012
-A PREROUTING -s 192.168.9.8/32 -i eth1 -p tcp -m tcp --dport 3012 -j ACCEPT
-A PREROUTING -i eth0 -p tcp -m tcp --dport 3010 -j DNAT --to-destination 192.168.9.8:3010
-A PREROUTING -s 192.168.9.8/32 -i eth1 -p tcp -m tcp --dport 3010 -j ACCEPT
-A PREROUTING -i eth0 -p tcp -m tcp --dport 3011 -j DNAT --to-destination 192.168.9.5:443
-A PREROUTING -s 192.168.9.5/32 -i eth1 -p tcp -m tcp --dport 3011 -j ACCEPT
-A PREROUTING -i eth0 -p tcp -m tcp --dport 3014 -j DNAT --to-destination 192.168.9.5:3014
-A PREROUTING -s 192.168.9.5/32 -i eth1 -p tcp -m tcp --dport 3014 -j ACCEPT
-A PREROUTING -i eth0 -p tcp -m tcp --dport 3015 -j DNAT --to-destination 192.168.9.5:8080
-A PREROUTING -s 192.168.9.5/32 -i eth1 -p tcp -m tcp --dport 3015 -j ACCEPT
-A PREROUTING -i eth0 -p tcp -m tcp --dport 443 -j DNAT --to-destination 192.168.9.8:443
-A PREROUTING -s 192.168.9.8/32 -i eth1 -p tcp -m tcp --dport 443 -j ACCEPT
-A PREROUTING -i eth0 -p tcp -m tcp --dport 3050 -j DNAT --to-destination 192.168.9.8:3050
-A PREROUTING -s 192.168.9.8/32 -i eth1 -p tcp -m tcp --dport 3050 -j ACCEPT
-A PREROUTING -i eth0 -p tcp -m tcp --dport 21433 -j DNAT --to-destination 192.168.9.12:1433
-A PREROUTING -s 192.168.9.12/32 -i eth1 -p tcp -m tcp --dport 21433 -j ACCEPT
-A PREROUTING -i eth0 -p tcp -m tcp --dport 31433 -j DNAT --to-destination 192.168.9.13:1433
-A PREROUTING -s 192.168.9.13/32 -i eth1 -p tcp -m tcp --dport 31433 -j ACCEPT
-A POSTROUTING -s 192.168.6.0/24 -o eth1 -j MASQUERADE
COMMIT
# Completed on Thu Dec  8 23:12:07 2016
# Generated by iptables-save v1.4.14 on Thu Dec  8 23:12:07 2016
*filter
:INPUT DROP [6651:2421935]
:FORWARD DROP [66:3498]
:OUTPUT ACCEPT [9604:1063780]
:DMZIN - [0:0]
:DMZOUT - [0:0]
:INETIN - [0:0]
:INETOUT - [0:0]
:LDROP - [0:0]
:LREJECT - [0:0]
:LTREJECT - [0:0]
:TCPACCEPT - [0:0]
:TREJECT - [0:0]
:UDPACCEPT - [0:0]
:ULDROP - [0:0]
:ULREJECT - [0:0]
:ULTREJECT - [0:0]
-A INPUT -i eth1 -j INETIN
-A INPUT -s 192.168.1.0/24 -j ACCEPT
-A INPUT -i lo -j ACCEPT
-A FORWARD -i eth1 -o eth0 -j INETIN
-A FORWARD -i eth0 -o eth1 -j INETOUT
-A OUTPUT -o eth1 -j INETOUT
-A INETIN -m state --state INVALID -j LTREJECT
-A INETIN -p icmp -m icmp --icmp-type 5 -j LTREJECT
-A INETIN -p icmp -m icmp --icmp-type 9 -j LTREJECT
-A INETIN -p icmp -m icmp --icmp-type 10 -j LTREJECT
-A INETIN -p icmp -m icmp --icmp-type 15 -j LTREJECT
-A INETIN -p icmp -m icmp --icmp-type 16 -j LTREJECT
-A INETIN -p icmp -m icmp --icmp-type 17 -j LTREJECT
-A INETIN -p icmp -m icmp --icmp-type 18 -j LTREJECT
-A INETIN -p icmp -m icmp --icmp-type 8 -m limit --limit 50/sec -j ACCEPT
-A INETIN -p icmp -m icmp --icmp-type 8 -j LTREJECT
-A INETIN -p tcp -m tcp --dport 22 -j TCPACCEPT
-A INETIN -p tcp -m tcp --dport 80 -j TCPACCEPT
-A INETIN -p tcp -m tcp --dport 443 -j TCPACCEPT
-A INETIN -p udp -m udp --dport 53 -j UDPACCEPT
-A INETIN -m state --state ESTABLISHED -j ACCEPT
-A INETIN -p tcp -m tcp --dport 1024:65535 -m state --state RELATED -j TCPACCEPT
-A INETIN -p udp -m udp --dport 1024:65535 -m state --state RELATED -j UDPACCEPT
-A INETIN -j LTREJECT
-A INETOUT -j ACCEPT
-A LDROP -p tcp -m limit --limit 2/sec -j LOG --log-prefix "TCP Dropped " --log-level 6
-A LDROP -p udp -m limit --limit 2/sec -j LOG --log-prefix "UDP Dropped " --log-level 6
-A LDROP -p icmp -m limit --limit 2/sec -j LOG --log-prefix "ICMP Dropped " --log-level 6
-A LDROP -f -m limit --limit 2/sec -j LOG --log-prefix "FRAGMENT Dropped "
-A LDROP -j DROP
-A LREJECT -p tcp -m limit --limit 2/sec -j LOG --log-prefix "TCP Rejected " --log-level 6
-A LREJECT -p udp -m limit --limit 2/sec -j LOG --log-prefix "UDP Rejected " --log-level 6
-A LREJECT -p icmp -m limit --limit 2/sec -j LOG --log-prefix "ICMP Rejected " --log-level 6
-A LREJECT -f -m limit --limit 2/sec -j LOG --log-prefix "FRAGMENT Rejected "
-A LREJECT -j REJECT --reject-with icmp-port-unreachable
-A LTREJECT -p tcp -m limit --limit 2/sec -j LOG --log-prefix "TCP Rejected " --log-level 6
-A LTREJECT -p udp -m limit --limit 2/sec -j LOG --log-prefix "UDP Rejected " --log-level 6
-A LTREJECT -p icmp -m limit --limit 2/sec -j LOG --log-prefix "ICMP Rejected " --log-level 6
-A LTREJECT -f -m limit --limit 2/sec -j LOG --log-prefix "FRAGMENT Rejected "
-A LTREJECT -j TREJECT
-A TCPACCEPT -p tcp -m tcp --tcp-flags FIN,SYN,RST,ACK SYN -m limit --limit 500/sec -j ACCEPT
-A TCPACCEPT -p tcp -m tcp --tcp-flags FIN,SYN,RST,ACK SYN -m limit --limit 2/sec -j LOG --log-prefix "Possible SynFlood "
-A TCPACCEPT -p tcp -m tcp --tcp-flags FIN,SYN,RST,ACK SYN -j LTREJECT
-A TCPACCEPT -p tcp -m tcp ! --tcp-flags FIN,SYN,RST,ACK SYN -j ACCEPT
-A TCPACCEPT -m limit --limit 2/sec -j LOG --log-prefix "Mismatch in TCPACCEPT "
-A TCPACCEPT -j LTREJECT
-A TREJECT -p tcp -j REJECT --reject-with tcp-reset
-A TREJECT -p udp -j REJECT --reject-with icmp-port-unreachable
-A TREJECT -p icmp -j DROP
-A TREJECT -j REJECT --reject-with icmp-port-unreachable
-A UDPACCEPT -p udp -j ACCEPT
-A UDPACCEPT -m limit --limit 2/sec -j LOG --log-prefix "Mismatch on UDPACCEPT "
-A UDPACCEPT -j LTREJECT
-A ULDROP -p tcp -m limit --limit 2/sec -j ULOG --ulog-prefix LDROP_TCP
-A ULDROP -p udp -m limit --limit 2/sec -j ULOG --ulog-prefix LDROP_UDP
-A ULDROP -p icmp -m limit --limit 2/sec -j ULOG --ulog-prefix LDROP_ICMP
-A ULDROP -f -m limit --limit 2/sec -j ULOG --ulog-prefix LDROP_FRAG
-A ULDROP -j DROP
-A ULREJECT -p tcp -m limit --limit 2/sec -j ULOG --ulog-prefix LREJECT_TCP
-A ULREJECT -p udp -m limit --limit 2/sec -j ULOG --ulog-prefix LREJECT_UDP
-A ULREJECT -p icmp -m limit --limit 2/sec -j ULOG --ulog-prefix LREJECT_UDP
-A ULREJECT -f -m limit --limit 2/sec -j ULOG --ulog-prefix LREJECT_FRAG
-A ULREJECT -j REJECT --reject-with icmp-port-unreachable
-A ULTREJECT -p tcp -m limit --limit 2/sec -j ULOG --ulog-prefix LTREJECT_TCP
-A ULTREJECT -p udp -m limit --limit 2/sec -j ULOG --ulog-prefix LTREJECT_UDP
-A ULTREJECT -p icmp -m limit --limit 2/sec -j ULOG --ulog-prefix LTREJECT_ICMP
-A ULTREJECT -f -m limit --limit 2/sec -j ULOG --ulog-prefix LTREJECT_FRAG
-A ULTREJECT -p tcp -j REJECT --reject-with tcp-reset
-A ULTREJECT -p udp -j REJECT --reject-with icmp-port-unreachable
-A ULTREJECT -p icmp -j DROP
-A ULTREJECT -j REJECT --reject-with icmp-port-unreachable
COMMIT
# Completed on Thu Dec  8 23:12:07 2016

Bonjour,

Le problème vient de la ligne suivante :
-A INPUT -i eth1 -j INETIN

En effet, dans la chaîne INPUT de la table filter, il faut que les paquets “retour” correspondants aux connexions TCP sortant par eth0 soient acceptés.

Or, là, seuls sont acceptés les paquets “retour” pour les connexions sortant sur eth1.

Pour régler cela, tu envoie tout ce qui entre par eth1 et eth0 vers la chaîne INETIN en remplaçant eth1 par eth+ .
Ou alors tu ajoute à la chaîne INPUT une règle qui accepte tous les paquets avec l’état ESTABLISHED.


AnonymousCoward

1 J'aime

Chapeau bas monsieur c’était bien cela.

J’ai modifié en -A INPUT -i eth+ -j INETIN et désormais c’est résolu.

Merci beaucoup a tous.

1 J'aime

Je ne comprends pas comment la résolution DNS pouvait marcher avec ces règles puisque les serveurs DNS sont côté eth0.