wiki:Realisations/2010-2011/Projet/Core2/Documentation/Proxy

Version 2 (modified by teste, 14 years ago) (diff)

--

Proxy

Le NAT masquerade est mis en place avec iptables.

Prérequis

Pour que le NAT fonctionne il faut activer le forwarding sur les machines.

echo 1 > /proc/sys/net/ipv4/ip_forward

Pour rendre la configuration permanente, il faut éviter /etc/sysctl.conf.

# Controls IP packet forwarding
net.ipv4.ip_forward = 1

Fichier de configuration

Fichier de configuration d'iptables

Configuration d'iptables

Public

iptables -t nat -A PREROUTING -p tcp -m tcp --dport 8080 -j DNAT --to-destination 10.30.1.1:8080
iptables -t nat -A POSTROUTING -j MASQUERADE

Interne

iptables -t nat -A PREROUTING -d 10.30.1.1 -p tcp -m tcp --dport 8080 -j DNAT --to-destination 10.30.130.2:8080
iptables -t nat -A -A POSTROUTING -d 10.30.130.2 -j MASQUERADE