Bom dia lista,
Tenho um proxy/squid/iptables configurado aqui onde trabalho, não sei se
configurei da melhor maneira mas funciona muito bem.

# Subindo a interface eth0 de acesso a internet
ifconfig eth0 inet 201.56.57.32 netmask 255.255.255.252
route add default gw 201.56.57.31

# Subindo a interface eth1 da rede Local (clientes)
#ifconfig eth1 inet 10.0.0.1 netmask 255.255.255.0


# ativa o repasse de pacontes entre as interfaces
echo 1 > /proc/sys/net/ipv4/ip_forward

# ativa o mascaramento
iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE



Em 14 de junho de 2011 14:17, Rogério Oliveira Naressi
<[email protected]>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
>
>
>
>
>



-- 
___________________________________

Ueder Ramos
Analista de Redes- Urbi Telecom
(62) 3541-0808
Linux User: #530240
Tecnologo em Redes de Computadores
Faculdade Estacio de Sá GO
Wireless Network Designer Lancore
Microtik RouterOS Basic - Hands On Lancore

Responder a