Passerelle

bonjour,
avant les MAJ du stagiaire,
pour le fun j’avais 3 machines derrière wheezy,
cela fonctionnait depuis plus d’un an
maintenant KK boudin,
mon parefeu est firestarter

je vois que je vais être obliger de tout réinstaller

mais la machine ne sera plus passerelle
A+
JB1 et :041 pour le stagiaire
:079

Il y a une question ?

bonjour,
oui cela ne fonctionne plus,

je pinge eth1 de la passerelle ainsi eth0 du wan
eth1=10.0.0.30
eth0=192.168.1.30 pointant vers 192.168.1.1

il y avait un wiki bien fait mais j’en vois un autre
A+
JB1

Cette phrase ne contient aucune information utile. Aucun compte-rendu d’actions, aucune description détaillée des résultats…

Quel est le résultat ?

Qu’entends-tu par “pointant vers” ?

sur la machine cliente 10.0.0.60:
-ping 10.0.0.30 OK
-ping 192.168.1.30 OK

pour la passerelle eth0(192.168.1.30) et eth1(10.0.0.30),
eth0 pointe vers 192.168.1.1

root@alpha30:/etc# route -n
Table de routage IP du noyau
Destination     Passerelle      Genmask         Indic Metric Ref    Use Iface
0.0.0.0         192.168.1.1     0.0.0.0         UG    0      0        0 eth0
10.0.0.0        0.0.0.0         255.0.0.0       U     0      0        0 eth1
192.168.1.0     0.0.0.0         255.255.255.0   U     0      0        0 eth0
root@alpha30:/etc# 

on dirait un problème parefeu qui est firestarter
je vais déinstaller/réinstaller avec le gestionnaire de paquet!
A+
JB1

A+
JB1

Tu n’as toujours pas décrit concrètement ce qui ne va pas.
La table de routage semble correcte, ainsi que celle du client.
Le forwarding IP est-il toujours activé (/proc/sys/net/ipv4/ip_forward=1) ?
Quelles sont les règles iptables actives, à afficher avec iptables-save ?

bonjour,
excuse-moi du retard!

extrait de /etc/sysctl.conf:

Uncomment the next line to enable packet forwarding for IPv4

net.ipv4.ip_forward=1

dommage je ne lis pas bien whireshark ou tcpdump
il y a interrogation des DNS du FAI, je ne vois pas le retour!

firewall firestarter non lancé:

root@alpha30:/etc# iptables -L                                                                                                                                
Chain INPUT (policy ACCEPT)
target     prot opt source               destination         
dtc-dos-in  all  --  anywhere             anywhere            
fail2ban-ssh  tcp  --  anywhere             anywhere             multiport dports ssh

Chain FORWARD (policy ACCEPT)
target     prot opt source               destination         

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination         

Chain dtc-dos-in (1 references)
target     prot opt source               destination         
ACCEPT     all  --  anywhere             anywhere            

Chain fail2ban-ssh (1 references)
target     prot opt source               destination         
RETURN     all  --  anywhere             anywhere            
root@alpha30:/etc# 

firestarter lancé:

root@alpha30:/etc# iptables -L                                                                                                                                
Chain INPUT (policy ACCEPT)
target     prot opt source               destination         
dtc-dos-in  all  --  anywhere             anywhere            
fail2ban-ssh  tcp  --  anywhere             anywhere             multiport dports ssh

Chain FORWARD (policy ACCEPT)
target     prot opt source               destination         

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination         

Chain dtc-dos-in (1 references)
target     prot opt source               destination         
ACCEPT     all  --  anywhere             anywhere            

Chain fail2ban-ssh (1 references)
target     prot opt source               destination         
RETURN     all  --  anywhere             anywhere            
root@alpha30:/etc# iptables -L
Chain INPUT (policy DROP)
target     prot opt source               destination         
ACCEPT     tcp  --  ns3.wanadoo.fr       anywhere             tcp flags:!FIN,SYN,RST,ACK/SYN
ACCEPT     udp  --  ns3.wanadoo.fr       anywhere            
ACCEPT     all  --  anywhere             anywhere            
ACCEPT     icmp --  anywhere             anywhere             icmp echo-request limit: avg 1/sec burst 5
ACCEPT     icmp --  anywhere             anywhere             icmp echo-reply limit: avg 1/sec burst 5
ACCEPT     udp  --  anywhere             anywhere             udp dpt:33434
ACCEPT     icmp --  anywhere             anywhere             icmp destination-unreachable
LSI        icmp --  anywhere             anywhere            
DROP       all  --  anywhere             255.255.255.255     
DROP       all  --  anywhere             192.168.1.255       
DROP       all  --  anywhere             255.255.255.255     
DROP       all  --  anywhere             10.255.255.255      
DROP       all  --  base-address.mcast.net/8  anywhere            
DROP       all  --  anywhere             base-address.mcast.net/8 
DROP       all  --  255.255.255.255      anywhere            
DROP       all  --  anywhere             default             
DROP       all  --  anywhere             anywhere             ctstate INVALID
LSI        all  -f  anywhere             anywhere             limit: avg 10/min burst 5
INBOUND    all  --  anywhere             anywhere            
INBOUND    all  --  anywhere             alpha30             
INBOUND    all  --  anywhere             alpha30.bohain.org  
INBOUND    all  --  anywhere             10.255.255.255      
LOG_FILTER  all  --  anywhere             anywhere            

Chain FORWARD (policy DROP)
target     prot opt source               destination         
ACCEPT     icmp --  anywhere             anywhere             icmp echo-request limit: avg 1/sec burst 5
ACCEPT     icmp --  anywhere             anywhere             icmp echo-reply limit: avg 1/sec burst 5
ACCEPT     udp  --  anywhere             anywhere             udp dpt:33434
ACCEPT     icmp --  anywhere             anywhere             icmp destination-unreachable
LSI        icmp --  anywhere             anywhere            
TCPMSS     tcp  --  anywhere             anywhere             tcp flags:SYN,RST/SYN TCPMSS clamp to PMTU
OUTBOUND   all  --  anywhere             anywhere            
ACCEPT     tcp  --  anywhere             10.0.0.0/8           ctstate RELATED,ESTABLISHED
ACCEPT     udp  --  anywhere             10.0.0.0/8           ctstate RELATED,ESTABLISHED
LOG_FILTER  all  --  anywhere             anywhere            

Chain OUTPUT (policy DROP)
target     prot opt source               destination         
ACCEPT     tcp  --  alpha30.bohain.org   ns3.wanadoo.fr       tcp dpt:domain
ACCEPT     udp  --  alpha30.bohain.org   ns3.wanadoo.fr       udp dpt:domain
ACCEPT     all  --  anywhere             anywhere            
DROP       all  --  base-address.mcast.net/8  anywhere            
DROP       all  --  anywhere             base-address.mcast.net/8 
DROP       all  --  255.255.255.255      anywhere            
DROP       all  --  anywhere             default             
DROP       all  --  anywhere             anywhere             ctstate INVALID
OUTBOUND   all  --  anywhere             anywhere            
OUTBOUND   all  --  anywhere             anywhere            
LOG_FILTER  all  --  anywhere             anywhere            

Chain INBOUND (4 references)
target     prot opt source               destination         
ACCEPT     tcp  --  anywhere             anywhere             ctstate RELATED,ESTABLISHED
ACCEPT     udp  --  anywhere             anywhere             ctstate RELATED,ESTABLISHED
ACCEPT     all  --  10.0.0.60            anywhere            
ACCEPT     tcp  --  anywhere             anywhere             tcp dpt:http
ACCEPT     udp  --  anywhere             anywhere             udp dpt:http
ACCEPT     tcp  --  anywhere             anywhere             tcp dpt:2222
ACCEPT     udp  --  anywhere             anywhere             udp dpt:2222
ACCEPT     tcp  --  anywhere             anywhere             tcp dpt:domain
ACCEPT     udp  --  anywhere             anywhere             udp dpt:domain
ACCEPT     tcp  --  anywhere             anywhere             tcp dpt:pop3
ACCEPT     udp  --  anywhere             anywhere             udp dpt:pop3
ACCEPT     tcp  --  anywhere             anywhere             tcp dpt:smtp
ACCEPT     udp  --  anywhere             anywhere             udp dpt:25
LSI        all  --  anywhere             anywhere            

Chain LOG_FILTER (5 references)
target     prot opt source               destination         

Chain LSI (4 references)
target     prot opt source               destination         
LOG_FILTER  all  --  anywhere             anywhere            
DROP       all  --  anywhere             anywhere            

Chain LSO (0 references)
target     prot opt source               destination         
LOG_FILTER  all  --  anywhere             anywhere            
REJECT     all  --  anywhere             anywhere             reject-with icmp-port-unreachable

Chain OUTBOUND (3 references)
target     prot opt source               destination         
ACCEPT     icmp --  anywhere             anywhere            
ACCEPT     tcp  --  anywhere             anywhere             ctstate RELATED,ESTABLISHED
ACCEPT     udp  --  anywhere             anywhere             ctstate RELATED,ESTABLISHED
ACCEPT     all  --  anywhere             anywhere            
root@alpha30:/etc# 

j’ai un nom de domaine depuis plus de 2 ans
firestarter a les paramètres d’accepter la machine 10.0.0.60 ainsi que le port 80

merci de consacrer du temps
bon appétit
A+
JB1

J’ai recommandé d’afficher les règles avec iptables-save car la sortie d’iptables -L est incomplète, en plus d’être mal fichue.

Tu dis pas de réponse aux requêtes DNS, mais quel est exactement le serveur DNS interrogé ? Est-ce directement un serveur DNS du FAI ou un serveur/proxy DNS type dnsmasq sur la passerelle qui interroge à son tour les serveurs du FAI ?
Que donne un traceroute vers une adresse IP extérieure quelconque, par exemple 8.8.8.8 ?
La résolution DNS et l’accès internet fonctionnent-ils depuis la passerelle elle-même ?

depuis la passerelle:

root@alpha30:~# traceroute 8.8.8.8
traceroute to 8.8.8.8 (8.8.8.8), 30 hops max, 60 byte packets
1 * * *
2 * * *
3 * * *
4 * * *
5 * * *
6 * * *
7 * * *
8 * * *
9 * * *
10 * * *
11 * * *
12 google-public-dns-a.google.com (8.8.8.8) 39.229 ms 40.323 ms 41.235 ms
root@alpha30:~#

le iptables-save:

root@alpha30:~# iptables-save
# Generated by iptables-save v1.4.16.3 on Tue May 21 13:38:23 2013
*mangle
:PREROUTING ACCEPT [42876]
:INPUT ACCEPT [42820]
:FORWARD ACCEPT [34:2185]
:OUTPUT ACCEPT [31016:3509650]
:POSTROUTING ACCEPT [30583:3631622]
COMMIT
# Completed on Tue May 21 13:38:23 2013
# Generated by iptables-save v1.4.16.3 on Tue May 21 13:38:23 2013
*filter
:INPUT DROP [0:0]
:FORWARD DROP [0:0]
:OUTPUT DROP [0:0]
:INBOUND - [0:0]
:LOG_FILTER - [0:0]
:LSI - [0:0]
:LSO - [0:0]
:OUTBOUND - [0:0]
-A INPUT -s 193.252.19.3/32 -p tcp -m tcp ! --tcp-flags FIN,SYN,RST,ACK SYN -j ACCEPT
-A INPUT -s 193.252.19.3/32 -p udp -j ACCEPT
-A INPUT -i lo -j ACCEPT
-A INPUT -p icmp -m icmp --icmp-type 8 -m limit --limit 1/sec -j ACCEPT
-A INPUT -p icmp -m icmp --icmp-type 0 -m limit --limit 1/sec -j ACCEPT
-A INPUT -p udp -m udp --dport 33434 -j ACCEPT
-A INPUT -p icmp -m icmp --icmp-type 3 -j ACCEPT
-A INPUT -p icmp -j LSI
-A INPUT -d 255.255.255.255/32 -i eth0 -j DROP
-A INPUT -d 192.168.1.255/32 -j DROP
-A INPUT -d 255.255.255.255/32 -i eth1 -j DROP
-A INPUT -d 10.255.255.255/32 -i eth1 -j DROP
-A INPUT -s 224.0.0.0/8 -j DROP
-A INPUT -d 224.0.0.0/8 -j DROP
-A INPUT -s 255.255.255.255/32 -j DROP
-A INPUT -d 0.0.0.0/32 -j DROP
-A INPUT -m conntrack --ctstate INVALID -j DROP
-A INPUT -f -m limit --limit 10/min -j LSI
-A INPUT -i eth0 -j INBOUND
-A INPUT -d 10.0.0.30/32 -i eth1 -j INBOUND
-A INPUT -d 192.168.1.30/32 -i eth1 -j INBOUND
-A INPUT -d 10.255.255.255/32 -i eth1 -j INBOUND
-A INPUT -j LOG_FILTER
-A FORWARD -p icmp -m icmp --icmp-type 8 -m limit --limit 1/sec -j ACCEPT
-A FORWARD -p icmp -m icmp --icmp-type 0 -m limit --limit 1/sec -j ACCEPT
-A FORWARD -p udp -m udp --dport 33434 -j ACCEPT
-A FORWARD -p icmp -m icmp --icmp-type 3 -j ACCEPT
-A FORWARD -p icmp -j LSI
-A FORWARD -p tcp -m tcp --tcp-flags SYN,RST SYN -j TCPMSS --clamp-mss-to-pmtu
-A FORWARD -i eth1 -j OUTBOUND
-A FORWARD -d 10.0.0.0/8 -p tcp -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT
-A FORWARD -d 10.0.0.0/8 -p udp -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT
-A FORWARD -j LOG_FILTER
-A OUTPUT -s 192.168.1.30/32 -d 193.252.19.3/32 -p tcp -m tcp --dport 53 -j ACCEPT
-A OUTPUT -s 192.168.1.30/32 -d 193.252.19.3/32 -p udp -m udp --dport 53 -j ACCEPT
-A OUTPUT -o lo -j ACCEPT
-A OUTPUT -s 224.0.0.0/8 -j DROP
-A OUTPUT -d 224.0.0.0/8 -j DROP
-A OUTPUT -s 255.255.255.255/32 -j DROP
-A OUTPUT -d 0.0.0.0/32 -j DROP
-A OUTPUT -m conntrack --ctstate INVALID -j DROP
-A OUTPUT -o eth0 -j OUTBOUND
-A OUTPUT -o eth1 -j OUTBOUND
-A OUTPUT -j LOG_FILTER
-A INBOUND -p tcp -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT
-A INBOUND -p udp -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT
-A INBOUND -s 10.0.0.60/32 -j ACCEPT
-A INBOUND -p tcp -m tcp --dport 80 -j ACCEPT
-A INBOUND -p udp -m udp --dport 80 -j ACCEPT
-A INBOUND -p tcp -m tcp --dport 2222 -j ACCEPT
-A INBOUND -p udp -m udp --dport 2222 -j ACCEPT
-A INBOUND -p tcp -m tcp --dport 53 -j ACCEPT
-A INBOUND -p udp -m udp --dport 53 -j ACCEPT
-A INBOUND -p tcp -m tcp --dport 110 -j ACCEPT
-A INBOUND -p udp -m udp --dport 110 -j ACCEPT
-A INBOUND -p tcp -m tcp --dport 25 -j ACCEPT
-A INBOUND -p udp -m udp --dport 25 -j ACCEPT
-A INBOUND -j LSI
-A LSI -j LOG_FILTER
-A LSI -j DROP
-A LSO -j LOG_FILTER
-A LSO -j REJECT --reject-with icmp-port-unreachable
-A OUTBOUND -p icmp -j ACCEPT
-A OUTBOUND -p tcp -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT
-A OUTBOUND -p udp -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT
-A OUTBOUND -j ACCEPT
COMMIT
# Completed on Tue May 21 13:38:23 2013
root@alpha30:~# 

bonne lecture
A+
JB1

193.252.19.3 est @DNS Orange

C’est firestarter qui génère ce bord^W jeu de règles ?
En tout cas il n’y a pas de règle de SNAT ou MASQUERADING dans la table nat (qui n’est même pas chargée). Si le routeur amont 192.168.1.1 n’a pas de route de retour vers 10.0.0.0/8 via 192.168.1.30, il ne saura pas comment retransmettre les paquets de réponse qu’il reçoit de l’extérieur.

Concernant l’absence de réponse des routeurs intermédiaires dans le traceroute, c’est a priori dû au fait que tu n’acceptes pas les messages d’erreur ICMP “Time exceeded” (type 11) renvoyés par ceux-ci. Pas très grave mais ennuyeux pour les tests.

je modifie les actions icmp dans firestarter
sur firestarter je ne peux que refuser vers sur le traffic sortant

firestarter est un outil simple qui affiche en temps réel les connexions actives sur le LAN vers le WAN

A+
JB1

Le type ICMP bloqué n’est pas le plus important.
Regarde plutôt le reste de ma réponse. Est-ce normal qu’il n’y ait pas de règle SNAT ou MASQUERADE, et si oui le routeur amont a-t-il bien une route de retour vers le sous-réseau client ?

bonjour,
architecture:
wan livebox orange passerelle Debian avec eth0 vers LB eth1 vers switch
derrière le switch 2 machines Linux

pour le retour, je ne fais aucun paramètrage, firestarter s’occupait de tout!
A+
JB

Donc il manque la règle iptables de SNAT ou MASQUERADE pour les paquets sortants. Je ne connais pas firestarter et ne sais pas comment lui faire ajouter. Sinon tu peux la créer à la main en attendant.

je tape cette commande,
mais j’arréte les actions pour l’instant:
root@alpha30:~# iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
iptables v1.4.16.3: can’t initialize iptables table `nat’: Table does not exist (do you need to insmod?)
Perhaps iptables or your kernel needs to be upgraded.
root@alpha30:~#
merci pour les réponses
A+
JB1

Tu as fait une mise à jour de ton noyau as tu dit, il te dit que le module nat n’est pas chargé soit qu’il est absent soit qu’il ne se charge pas automatiquement (ce qui est étonnant).

Fais un modprobe iptable_nat (ou ip_nat), ça devrait passer, si ça coince vérifie qu’il se charge et donne les messages de syslog ou dmesg lors du modprobe.

pour iptables j’ai pour lsmod:
sunrpc 155681 6 nfs,nfsd,auth_rpcgss,lockd,nfs_acl
iptable_mangle 12536 0
iptable_filter 12536 1
ip_tables 21997 2 iptable_filter,iptable_mangle
x_tables 19041 6 ip_tables,xt_tcpudp,xt_conntrack,xt_multiport,iptable_filter,iptable_mangle
it87 30261 0
A+
JB1

Si la table nat est manquante, ça explique bien des choses… reste à expliquer pourquoi elle n’est plus là !
Quelles mises à jour le stagiaire a-t-il faites ?
Tu dis que la passerelle a Wheezy, mais la version d’iptables 1.4.16.3 correspond plutôt à une ancienne version de sid/unstable.
Quel est le noyau actif (uname -a) ? Est-ce un noyau précompilé fourni par Debian (paquet linux-image-*), un noyau personnalisé compilé par vos soins ou fourni par une tierce partie ? S’il a été mis à jour, la machine a-t-elle été redémarrée ?
Le support du NAT est-il présent dans ce noyau en dur (=y) ou en module (=m) ?

Si en module (=m), qu’affiche

Quels sont les messages du noyau (affichés par dmesg) lors de la tentative de création de la chaîne ou du chargement du module avec “modprobe iptable_nat” ?

root@alpha30:~# grep NF_NAT /boot/config-$(uname -r)

CONFIG_NF_NAT_IPV4 is not set

root@alpha30:~#

root@alpha30:~# uname -a
Linux alpha30.bohain.org 3.8.5-20130514 #6 SMP Tue May 14 13:51:41 CEST 2013 x86_64 GNU/Linux
root@alpha30:~#

la 3.8.5 m’a étè conseillé dans une discussioncar je voulais un .config
je vais en profiter pour VFAT et chercher pour le NAT
A+
JB1

[quote=“jb1”]root@alpha30:~# grep NF_NAT /boot/config-$(uname -r)

CONFIG_NF_NAT_IPV4 is not set

root@alpha30:~#
[/quote]Bo,n donc tout s’explique[quote]
root@alpha30:~# uname -a
Linux alpha30.bohain.org 3.8.5-20130514 #6 SMP Tue May 14 13:51:41 CEST 2013 x86_64 GNU/Linux
root@alpha30:~#

la 3.8.5 m’a étè conseillé dans une discussioncar je voulais un .config
[/quote]
Là je ne comprends pas cette phrase, j’ai beau relire, je ne vois pas…

[quote]
je vais en profiter pour VFAT et chercher pour le NAT
[/quote]Là encore je ne comprends rien… VFAT bien! Tu trouveras le NAT au fond à droite.

PS: Si tu veux une config passe partout convenable, prend le config d’un noyau debian, ça conviendra parfaitement, sinon réinvente la roue.