[Réglé] Iptables redirection de machine

Si j’ai bien compris, 192.168.0.1 est le routeur et le serveur Postfix donc pas besoin de redirection de port 110.

Est ce que 80.1.2.2 et 3 répondent quand ils sont interrogés de manière directe par l’extérieur?

hier apret la réinstall oui, depuie sa répond plus. voir message précédent.

Et quand tu arrêtes Squid?
#/etc/init.d/squid stop

Que donnes sur 192.168.0.1

netstat -tpl

[quote]:/# netstat -i eth0 -tpl
Table d’interfaces noyau
Iface MTU Met RX-OK RX-ERR RX-DRP RX-OVR TX-OK TX-ERR TX-DRP TX-OVR Flg
eth0 1500 0 734 0 0 0 147 0 0 0 BMRU
eth1 1500 0 186 0 0 0 124 0 0 0 BMRU
eth1: 1500 0 - no statistics available - BMRU
eth1: 1500 0 - no statistics available - BMRU
lo 16436 0 0 0 0 0 0 0 0 0 LRU
[/quote]

je précise que je suis sur le serveur avec ssh.

Pas netstat -i eth0…

netstat -tpl

tout seul…

[quote]:/# netstat -tpl
Connexions Internet actives (seulement serveurs)
Proto Recv-Q Send-Q Adresse locale Adresse distante Etat PID/Program name
tcp6 0 0 *:ssh : LISTEN 3306/sshd
[/quote]

j’ai fais aussi un tcpdum -i eth1 port 80 puie tapé le nom de domaine via l’autre serveur et j’ai une réponse…

Tu es sur la machine 192.168.0.1???

Parce que ni squid, ni postfix n’est en écoute… Il n’y a que ssh qui écoute…

ben oui, ifconfig me le prouve.

a M… tu m’avais fais faire un stop de squid

[quote]:/# netstat -tpl
Connexions Internet actives (seulement serveurs)
Proto Recv-Q Send-Q Adresse locale Adresse distante Etat PID/Program name
tcp 0 0 *:3128 : LISTEN 3527/(squid)
tcp 0 0 *:smtp : LISTEN 3856/master
tcp6 0 0 *:ssh : LISTEN 3306/sshd[/quote]

Et j’ai oublié de réinstaller postfix dans la foulé (désolé)

Bon tu lances 2 consoles sur 192.168.0.1

Sur la première tu fais

tcpdump -i eth1 port 80

(et tu regardes)

sur la seconde, tu fais

tcpdump -i eth0 port 80

(et tu regardes)

et tu fais de l’exterieur une requête Web sur 80.1.2.1 80.1.2.2 et .3 pour voir si les règles fonctionnent.

La machine 192.168.0.1 est bien la passerelle pour tes serveurs 192.168.0.100 et 101?

sa redirige bien ver le bon serveur, on dirais que le serveur web ne fonctionne pas alors que si je tape l’ip 192.168.0.100 dans un navigateur sa m’affiche bien la pages.

Est ce que si tu rajoutes

iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE

Cela fonctionne?

(Après le test tu peux retirer la règle en faisant

iptables -t nat -D POSTROUTING -o eth0 -j MASQUERADE )

oui avec cette règle le site fonctionne de l’extérieur ouffff…
mais de l’intérieur via squid, toujours le message erreur 111.

Bon, ça n’est pas normal, ça signifie que tes machines 192.168.0.100 et 192.168.0.101 ne savant pas aller à l’extérieur. Peux tu me mettre le résultat de

route -n

fait sur 192.168.0.100 ???

Pour Squid, il va falloir regarder.
Il faudrait que tu fasses sur 192.168.0.1

tcpdump -i eth0 port 3128 or port 80

et que tu fasses un requête sur Squid du machine de 192.168.0.?

et que tu donnes le résultat du traffic

rout -n

[quote]Table de routage IP du noyau
Destination Passerelle Genmask Indic Metric Ref Use Iface
80.1.2.0 0.0.0.0 255.255.255.248 U 0 0 0 eth1
192.168.0.1 0.0.0.0 255.255.255.0 U 0 0 0 eth0
0.0.0.0 80.1.2.1 0.0.0.0 UG 0 0 0 eth1
[/quote]

[quote]tcpdump -i eth0 port 3128 or port 80
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on eth0, link-type EN10MB (Ethernet), capture size 96 bytes
22:30:22.993511 IP 192.168.0.4.38305 > 192.168.0.1.3128: S 2660948717:2660948717(0) win 5840 <mss 1460,sackOK,timestamp 3564975 0,nop,wscale 2>
22:30:23.038099 IP 192.168.0.2.3128 > 192.168.0.4.38305: S 992041111:992041111(0) ack 2660948718 win 5792 <mss 1460,sackOK,timestamp 2643312 3564975,nop,wscale 3>
22:30:22.993552 IP 192.168.0.4.38305 > 192.168.0.2.3128: . ack 1 win 1460 <nop,nop,timestamp 3564975 2643312>
22:30:22.993864 IP 192.168.0.4.38305 > 192.168.0.2.3128: P 1:399(398) ack 1 win 1460 <nop,nop,timestamp 3564975 2643312>
22:30:22.993896 IP 192.168.0.2.3128 > 192.168.0.4.38305: . ack 399 win 858 <nop,nop,timestamp 2643312 3564975>
22:30:23.187421 IP 192.168.0.2.3128 > 192.168.0.4.38305: P 1:1432(1431) ack 399 win 858 <nop,nop,timestamp 2643361 3564975>
22:30:23.187517 IP 192.168.0.4.38305 > 192.168.0.2.3128: . ack 1432 win 2184 <nop,nop,timestamp 3565023 2643361>
22:30:23.187575 IP 192.168.0.2.3128 > 192.168.0.4.38305: F 1432:1432(0) ack 399 win 858 <nop,nop,timestamp 2643361 3565023>
22:30:23.188606 IP 192.168.0.4.38305 > 192.168.0.2.3128: F 399:399(0) ack 1433 win 2184 <nop,nop,timestamp 3565024 2643361>
22:30:23.188616 IP 192.168.0.2.3128 > 192.168.0.4.38305: . ack 400 win 858 <nop,nop,timestamp 2643361 3565024>

10 packets captured
10 packets received by filter
0 packets dropped by kernel[/quote]

[quote=“adminlinux”]rout -n

[quote]Table de routage IP du noyau
Destination Passerelle Genmask Indic Metric Ref Use Iface
80.1.2.0 0.0.0.0 255.255.255.248 U 0 0 0 eth1
192.168.0.1 0.0.0.0 255.255.255.0 U 0 0 0 eth0
0.0.0.0 80.1.2.1 0.0.0.0 UG 0 0 0 eth1
[/quote][/quote][quote=“fran.b”]sur 192.168.0.100[/quote]

Oupsss, mes excuses

[quote]Table de routage IP du noyau
Destination Passerelle Genmask Indic Metric Ref Use Iface
192.168.0.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
0.0.0.0 192.168.0.1 0.0.0.0 UG 0 0 0 eth0
[/quote]

[quote=“adminlinux”][quote]tcpdump -i eth0 port 3128 or port 80
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on eth0, link-type EN10MB (Ethernet), capture size 96 bytes
22:30:22.993511 IP 192.168.0.4.38305 > 192.168.0.1.3128: S 2660948717:2660948717(0) win 5840 <mss 1460,sackOK,timestamp 3564975 0,nop,wscale 2>
22:30:23.038099 IP 192.168.0.2.3128 > 192.168.0.4.38305: S 992041111:992041111(0) ack 2660948718 win 5792 <mss 1460,sackOK,timestamp 2643312 3564975,nop,wscale 3>
22:30:22.993552 IP 192.168.0.4.38305 > 192.168.0.2.3128: . ack 1 win 1460 <nop,nop,timestamp 3564975 2643312>
22:30:22.993864 IP 192.168.0.4.38305 > 192.168.0.2.3128: P 1:399(398) ack 1 win 1460 <nop,nop,timestamp 3564975 2643312>
22:30:22.993896 IP 192.168.0.2.3128 > 192.168.0.4.38305: . ack 399 win 858 <nop,nop,timestamp 2643312 3564975>
22:30:23.187421 IP 192.168.0.2.3128 > 192.168.0.4.38305: P 1:1432(1431) ack 399 win 858 <nop,nop,timestamp 2643361 3564975>
22:30:23.187517 IP 192.168.0.4.38305 > 192.168.0.2.3128: . ack 1432 win 2184 <nop,nop,timestamp 3565023 2643361>
22:30:23.187575 IP 192.168.0.2.3128 > 192.168.0.4.38305: F 1432:1432(0) ack 399 win 858 <nop,nop,timestamp 2643361 3565023>
22:30:23.188606 IP 192.168.0.4.38305 > 192.168.0.2.3128: F 399:399(0) ack 1433 win 2184 <nop,nop,timestamp 3565024 2643361>
22:30:23.188616 IP 192.168.0.2.3128 > 192.168.0.4.38305: . ack 400 win 858 <nop,nop,timestamp 2643361 3565024>

10 packets captured
10 packets received by filter
0 packets dropped by kernel[/quote][/quote]

On dirait que Squid est sur 192.168.0.2 et non 192.168.0.1?

[quote=“adminlinux”][quote]tcpdump -i eth0 port 3128 or port 80
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on eth0, link-type EN10MB (Ethernet), capture size 96 bytes
22:30:22.993511 IP 192.168.0.4.38305 > 192.168.0.1.3128: S 2660948717:2660948717(0) win 5840 <mss 1460,sackOK,timestamp 3564975 0,nop,wscale 2>
22:30:23.038099 IP 192.168.0.2.3128 > 192.168.0.4.38305: S 992041111:992041111(0) ack 2660948718 win 5792 <mss 1460,sackOK,timestamp 2643312 3564975,nop,wscale 3>
22:30:22.993552 IP 192.168.0.4.38305 > 192.168.0.2.3128: . ack 1 win 1460 <nop,nop,timestamp 3564975 2643312>
22:30:22.993864 IP 192.168.0.4.38305 > 192.168.0.2.3128: P 1:399(398) ack 1 win 1460 <nop,nop,timestamp 3564975 2643312>
22:30:22.993896 IP 192.168.0.2.3128 > 192.168.0.4.38305: . ack 399 win 858 <nop,nop,timestamp 2643312 3564975>
22:30:23.187421 IP 192.168.0.2.3128 > 192.168.0.4.38305: P 1:1432(1431) ack 399 win 858 <nop,nop,timestamp 2643361 3564975>
22:30:23.187517 IP 192.168.0.4.38305 > 192.168.0.2.3128: . ack 1432 win 2184 <nop,nop,timestamp 3565023 2643361>
22:30:23.187575 IP 192.168.0.2.3128 > 192.168.0.4.38305: F 1432:1432(0) ack 399 win 858 <nop,nop,timestamp 2643361 3565023>
22:30:23.188606 IP 192.168.0.4.38305 > 192.168.0.2.3128: F 399:399(0) ack 1433 win 2184 <nop,nop,timestamp 3565024 2643361>
22:30:23.188616 IP 192.168.0.2.3128 > 192.168.0.4.38305: . ack 400 win 858 <nop,nop,timestamp 2643361 3565024>

10 packets captured
10 packets received by filter
0 packets dropped by kernel[/quote][/quote]C’est quoi cette adresse 192.168.0.2 ? Tu n’aurais pas une interface virtuelle eth0:1 sur ton lan dont tu n’aurais pas parlé ?

Oui juste désolé c’est bien 192.168.0.1 c’est une erreur de ma par.

[quote]tcpdump -i eth0 port 3128 or port 80
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on eth0, link-type EN10MB (Ethernet), capture size 96 bytes
22:30:22.993511 IP 192.168.0.4.38305 > 192.168.0.1.3128: S 2660948717:2660948717(0) win 5840 <mss 1460,sackOK,timestamp 3564975 0,nop,wscale 2>
22:30:23.038099 IP 192.168.0.1.3128 > 192.168.0.4.38305: S 992041111:992041111(0) ack 2660948718 win 5792 <mss 1460,sackOK,timestamp 2643312 3564975,nop,wscale 3>
22:30:22.993552 IP 192.168.0.4.38305 > 192.168.0.1.3128: . ack 1 win 1460 <nop,nop,timestamp 3564975 2643312>
22:30:22.993864 IP 192.168.0.4.38305 > 192.168.0.1.3128: P 1:399(398) ack 1 win 1460 <nop,nop,timestamp 3564975 2643312>
22:30:22.993896 IP 192.168.0.1.3128 > 192.168.0.4.38305: . ack 399 win 858 <nop,nop,timestamp 2643312 3564975>
22:30:23.187421 IP 192.168.0.1.13128 > 192.168.0.4.38305: P 1:1432(1431) ack 399 win 858 <nop,nop,timestamp 2643361 3564975>
22:30:23.187517 IP 192.168.0.4.38305 > 192.168.0.1.3128: . ack 1432 win 2184 <nop,nop,timestamp 3565023 2643361>
22:30:23.187575 IP 192.168.0.1.13128 > 192.168.0.4.38305: F 1432:1432(0) ack 399 win 858 <nop,nop,timestamp 2643361 3565023>
22:30:23.188606 IP 192.168.0.4.38305 > 192.168.0.1.3128: F 399:399(0) ack 1433 win 2184 <nop,nop,timestamp 3565024 2643361>
22:30:23.188616 IP 192.168.0.1.3128 > 192.168.0.4.38305: . ack 400 win 858 <nop,nop,timestamp 2643361 3565024>

10 packets captured
10 packets received by filter
0 packets dropped by kernel[/quote]