[FUG-BR] Problemas com IPNAT

Alberto Viana alberto.viana em rnp.br
Quinta Fevereiro 4 12:06:27 BRST 2010


Senhores,


Estou com um problema com o ipnat. O mesmo não funciona de jeito nenhum e
já testei de várias formas as regras.


Tenho o Seguinte cenário que montei para testes:


    REDE INTERNA eth0(192.168.100.2) <-> bce0 (192.168.100.1) FIREWALL em3
(IP PUBLICO) <-> INTERNET


No arquivo /etc/ipnat.rules:

map bce0 192.168.100.0/24 -> 0/32

ipnat -l
List of active MAP/Redirect filters:
map em3 from 192.168.100.0/24 to any -> IPPUBLICO/32

mas já testei de várias outras formas pensando que poderia ser isso:

map em3 192.168.10.0/24 -> IPPUBLICO/32 portmap tcp/udp 1:65535
map em3 192.168.10.0/24 -> 0/32
map em3 from 192.168.100.0/24 to any -> IPPUBLICO/32


Pensando que poderia ser o firewall, liberei tudo no ipf para ambas as
interfaces, mas mesmo assim não funciona:

pass in quick on bce0 all
pass out quick on bce0 all
pass in quick on em3 all
pass out quick on em3 all

Está habilitada a opção de forward:

net.inet.ip.forwarding: 1

Tenho as seguintes opções relevantes no rc.conf:

defaultrouter="MEUGATEWAY"
gateway_enable="YES"
ifconfig_em3="inet IPPUBLICO netmask 255.255.255.0"
ifconfig_bce0="inet 192.168.100.1 netmask 255.255.255.0"
ipfilter_enable="YES"
ipfilter_rules="/etc/ipf.rules"
ipmon_enable="YES"
ipmon_flags="-pD /var/log/ipflog"
# NAT - VPN TCP
ipnat_enable="YES"
ipnat_rules="/etc/ipnat.rules"

Informações do que está rodando na máquina:

FreeBSD 7.2-RELEASE FreeBSD 7.2-RELEASE
ipf: IP Filter: v4.1.28 (512)
Kernel: IP Filter: v4.1.28
Running: yes



Segue abaixo tcpdump do firewall na placa da rede interna (bce0):

11:54:13.623558 IP 192.168.100.2 > 200.130.35.7: ICMP echo request, id
512, seq 2304, length 72
11:54:13.623571 IP 192.168.100.1 > 192.168.100.2: ICMP time exceeded
in-transit, length 36
11:54:13.624005 IP 192.168.100.2 > 200.130.35.7: ICMP echo request, id
512, seq 2560, length 72
11:54:13.624012 IP 192.168.100.1 > 192.168.100.2: ICMP time exceeded
in-transit, length 36
11:54:13.624431 IP 192.168.100.2 > 200.130.35.7: ICMP echo request, id
512, seq 2816, length 72
11:54:13.624442 IP 192.168.100.1 > 192.168.100.2: ICMP time exceeded
in-transit, length 36
11:54:14.621289 IP 192.168.100.2 > 200.130.35.7: ICMP echo request, id
512, seq 3072, length 72
11:54:14.621307 IP 192.168.100.1 > 192.168.100.2: ICMP host 200.130.35.7
unreachable, length 36

Colocando tcpdump na placa que de saída p/ internet (em3) não vejo nada
que indique que o pacote esteja sendo nateado, ou seja
que o pacote esteja sendo jogado para internet.


Agradeço alguma dica que me ajuda a debugar o problema.





Mais detalhes sobre a lista de discussão freebsd