jocajuni
(usa Debian)
Enviado em 25/07/2014 - 16:04h
Chain PREROUTING (policy ACCEPT)
1 DNAT tcp -- anywhere anywhere tcp dpt:ms-wbt-server to:192.168.0.251:3389
Redireciona tudo que passar ou entrar no firewall na porta ms-wbt-server* tcp para a porta 3389 do ip 192.168.0.251
* pra vc saber qual eh essa porta consulte o arquivo /etc/services
# grep ms-wbt-server /etc/services
resposta 3389
# iptables -t nat -A PREROUTING -p tcp --dport 3389 -s 0/0 -d 0/0 -j DNAT -to 192.168.0.251:3389
2 DNAT tcp -- anywhere anywhere tcp dpt:http to:192.168.0.1:3128
Redireciona tudo que passar ou entrar no firewall na porta http tcp para a porta 3128 do ip 192.168.0.1
provavelmente mandando para o squid
# iptables -t nat -A PREROUTING -p tcp --dport 80 -s 0/0 -d 0/0 -j DNAT -to 192.168.0.1:3128
3 DNAT tcp -- anywhere anywhere tcp dpt:webcache to:192.168.0.1:3128
4 DNAT tcp -- anywhere anywhere tcp dpt:https to:192.168.0.1:3128
5 DNAT tcp -- anywhere anywhere tcp dpt:tproxy to:192.168.0.1:3128
6 DNAT tcp -- anywhere anywhere tcp dpt:webcache to:192.168.0.1:3128
7 DNAT tcp -- anywhere anywhere tcp dpt:ftp to:192.168.0.1:3128
da 3 a 7 igual a 2 so mudando a porta
8 DNAT tcp -- anywhere anywhere tcp dpt:9013 to:192.168.0.163
Redireciona tudo que passar ou entrar no firewall na porta 9013 tcp para a porta 9013 do ip 192.168.0.163
# iptables -t nat -A PREROUTING -p tcp --dport 9013 -s 0/0 -d 0/0 -j DNAT -to 192.168.0.163
Chain POSTROUTING (policy ACCEPT)
num target prot opt source destination
1 MASQUERADE all -- 192.168.0.70 anywhere
2 MASQUERADE all -- 192.168.0.71 anywhere
3 MASQUERADE all -- 192.168.0.72 anywhere
4 MASQUERADE all -- 192.168.0.0/24 anywhere
as regras 1,2 e 3 compartilha a internet para as maquinas 192.168.0.70,192.168.0.71 e 192.168.0.72
a 4 compartilha a internet para a rede toda
portando nao ha a necessidade de ter as regras 1,2 e 3 ja que a 4 existe
iptables -t nat -A POSTROUTING -p all -s 192.168.0.70 -d 0/0 -j MASQUERADE
iptables -t nat -A POSTROUTING -p all -s 192.168.0.71 -d 0/0 -j MASQUERADE
iptables -t nat -A POSTROUTING -p all -s 192.168.0.72 -d 0/0 -j MASQUERADE
iptables -t nat -A POSTROUTING -p all -s 192.168.0.0/24 -d 0/0 -j MASQUERADE
[]s
Joca