[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Ajuda na configuração de nat com Squeeze e Iptables



Minha sugestão é instalar o shorewall.

Ele é bem fácil e simples de configurar.

se você quer apenas fazer um nat com poucas regras ele faz isto pra vc.



Em Ter, 2011-06-14 às 14:17 -0300, Rogério Oliveira Naressi escreveu:
> Pessoal,
> 
>  
> 
> Estou configurando um Squeeze exclusivo para fazer NAT utilizando
> IPTABLES. 
> 
>  
> 
> Minha eth0 esta conectada a um link Embratel, e a eth1 a rede local.
> Fiz algumas buscas nas internet e cheguei a configuração abaixo, a
> qual esta funcionando.
> 
>  
> 
> Mas gostaria da opinião de vocês se é essa mesma a configuração ou há
> algo a acrescentar, já que é a primeira vez que configuro NAT.
> 
>  
> 
> Configuração da rede /etc/network/interfaces:
> 
> ===================================
> 
> auto lo
> 
> iface lo inet loopback
> 
>  
> 
> # The primary network interface
> 
> allow-hotplug eth0 eth1
> 
> iface eth0 inet static
> 
>         address 200.150.40.32
> 
>         netmask 255.255.255.0
> 
>         network 200. 150.40.0
> 
>         broadcast 200. 150.40.255
> 
>         gateway 200. 150.40.1
> 
>         # dns-* options are implemented by the resolvconf package, if
> installed
> 
>         dns-nameservers 200.255.255.65 20.255.255.70
> 
>         dns-search exemplo.com.br
> 
>  
> 
> iface eth1 inet static
> 
>         address 10.150.200.10
> 
>         netmask 255.255.255.0
> 
>         network 10.150.200.0
> 
>         broadcast 10.150.200.255
> 
>  
> 
> Configuração do IPTABLES:
> 
> ====================
> 
> iptables -F
> 
> iptables -P INPUT DROP
> 
> iptables -P OUTPUT ACCEPT
> 
> iptables -P FORWARD ACCEPT
> 
>  
> 
> # Loopback
> 
> iptables -A INPUT -d 127.0.0.1 -s 127.0.0.1 -j ACCEPT
> 
>  
> 
> # Libera acesso rede local e estabelece relação de confiança (eth1)
> 
> iptables -A INPUT -i eth1 -s 10.150.200.0/24 -j ACCEPT
> 
> iptables -A INPUT -i eth1 -m state --state NEW -j ACCEPT
> 
> iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
> 
>  
> 
> # NAT
> 
> iptables -t nat -A POSTROUTING -s 10.150.200.0/24 -o eth0 -j
> MASQUERADE
> 
> echo 1 > /proc/sys/net/ipv4/ip_forward
> 
>  
> 
>  
> 
> Obrigado,
> 
>  
> 
> Rogério Naressi
> Administrador de Rede
> 
> IPEF - Instituto de Pesquisas e Estudos Florestais
> Av. Pádua Dias, 11 - Bairro Agronomia
> 
> Caixa Postal 530 - CEP 13400-970 - Piracicaba - SP
> Telefone: (19)2105-8620 - Fax: (19)2105-8666
> Visite nosso site: http://www.ipef.br 
> 
>  
> 
>  
> 
> 



Reply to: