Vous n'êtes pas identifié(e).
L'icône rouge permet de télécharger chaque page du wiki visitée au format
PDF et la grise au format ODT →
Ci-dessous, les différences entre deux révisions de la page.
Les deux révisions précédentes Révision précédente Prochaine révision | Révision précédente Prochaine révision Les deux révisions suivantes | ||
utilisateurs:hypathie:tutos:proxy-transparent [16/10/2014 14:58] Hypathie [Introduction] |
utilisateurs:hypathie:tutos:proxy-transparent [16/10/2014 15:09] Hypathie [Configuration de squid comme proxy transparent] |
||
---|---|---|---|
Ligne 179: | Ligne 179: | ||
coredump_dir /var/spool/squid | coredump_dir /var/spool/squid | ||
</code> | </code> | ||
+ | S'il n'y a pas d'erreur : | ||
+ | <code>[ ok ] Restarting Squid HTTP proxy: squid.</code> | ||
===Redémarrer squid=== | ===Redémarrer squid=== | ||
Ligne 191: | Ligne 193: | ||
SQUIDPORT=3128 | SQUIDPORT=3128 | ||
+ | iptables -t nat -A PREROUTING -s $SQUIDIP -p tcp --dport 80 -j ACCEPT | ||
+ | iptables -t nat -A PREROUTING -p tcp --dport 80 -j DNAT --to-destination $SQUIDIP:$SQUIDPORT | ||
+ | |||
+ | iptables -t nat -A POSTROUTING -j MASQUERADE | ||
+ | |||
+ | iptables -t mangle -A PREROUTING -p tcp --dport $SQUIDPORT -j DROP | ||
+ | </code> | ||
+ | |||
+ | * Ce qui donne par exemple pour notre configuration: | ||
+ | <code root> | ||
iptables -t nat -A PREROUTING -s 192.168.0.1 -p tcp --dport 80 -j ACCEPT | iptables -t nat -A PREROUTING -s 192.168.0.1 -p tcp --dport 80 -j ACCEPT | ||
iptables -t nat -A PREROUTING -p tcp --dport 80 -j DNAT --to-destination 192.168.0.1:3128 | iptables -t nat -A PREROUTING -p tcp --dport 80 -j DNAT --to-destination 192.168.0.1:3128 | ||
- | iptables -t nat -A POSTROUTING -j MASQUERADE | + | iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE |
- | iptables -t mangle -A PREROUTING -p tcp --dport 192.168.0.1 -j DROP</code> | + | iptables -t mangle -A PREROUTING -p tcp --dport 192.168.0.1 -j DROP |
+ | </code> | ||
* Ce qui donne : | * Ce qui donne : | ||
Ligne 214: | Ligne 227: | ||
target prot opt source destination | target prot opt source destination | ||
MASQUERADE all -- anywhere anywhere</code> | MASQUERADE all -- anywhere anywhere</code> | ||
+ | |||
+ | ===Configurer /etc/sysctl.conf === | ||
+ | * Vérifier que les lignes suivantes comportes ces valeurs : | ||
+ | |||
+ | <code> | ||
+ | # Controls IP packet forwarding | ||
+ | net.ipv4.ip_forward = 1 | ||
+ | |||
+ | # Controls source route verification | ||
+ | net.ipv4.conf.default.rp_filter = 0 | ||
+ | |||
+ | # Do not accept source routing | ||
+ | #net.ipv4.conf.default.accept_source_route = 0 | ||
+ | </code> | ||
+ | * Faire rendre en compte une éventuelle modification : | ||
+ | <code root>sysctl -p</code> | ||
===== Utilisation ===== | ===== Utilisation ===== | ||