I have ipfw running on a freebsd box with two NICs.
The "external" NIC is really facing a dumb router that is
configured to just pass everything through. That subnet is 192.168.0/24.
The "internal" subnet is actually a routable real internet
block, let's say a.b.c/24.
The firewall has its "internal" IP set to a.b.c.d on
interface em1.
"external" IP set to 192.168.0.2 with the dumb router
at 192.168.0.1 on interface em0.
I also have some internal hosts that are unregistered RFC
1918 addresses. I am trying to NAT these IPs and leave
the routable registered IPs untouched.
Rules:
and natd running as [cmd=]natd -v -n em0[/cmd]
tcpdump on both interfaces looking at external host 'E.F.G.H' is showing this when I try to ssh to it from the internal 10.0.0.2 box:
As you can see the rewrite is done correctly on the outgoing divert, and the external host responds. But the firewall is generating a tcp reset.
It's as if it has forgotten about the diverted socket and doesn't have an open socket for it anymore.
Hints would be wonderful, please.
The "external" NIC is really facing a dumb router that is
configured to just pass everything through. That subnet is 192.168.0/24.
The "internal" subnet is actually a routable real internet
block, let's say a.b.c/24.
The firewall has its "internal" IP set to a.b.c.d on
interface em1.
"external" IP set to 192.168.0.2 with the dumb router
at 192.168.0.1 on interface em0.
I also have some internal hosts that are unregistered RFC
1918 addresses. I am trying to NAT these IPs and leave
the routable registered IPs untouched.
Rules:
Code:
extif=em1
intif=em0
pubnet=[I]a.b.c[/I]
privnet=10.0.0.0/8
ipfw deny log ip from 192.168.0.0/24 to any in recv $intif
ipfw add divert natd log all from $privnet to any out via $extif
ipfw add allow tcp from any to [I]a.b.c.e[/I] 22 via $extif
ipfw add deny log tcp from any to any in recv $extif setup
ipfw add allow tcp from any to any setup
ipfw add allow tcp from any to any established
ipfw add allow udp 53 to [I]a.b.c[/I].0/24
ipfw add 65500 deny log ip from any to any
tcpdump on both interfaces looking at external host 'E.F.G.H' is showing this when I try to ssh to it from the internal 10.0.0.2 box:
Code:
16:52:16.207810 10.0.0.2.45642 > [I]E.F.G.H[/I].22: S 3095885078:3095885078(0) win 65535 <mss 1460,nop,wscale 1,nop,nop,timestamp 288974989 0,sackOK,eol> (DF)
16:52:16.209071 [I]a.b.c.d[/I].45642 > [I]E.F.G.H[/I].22: S 3095885078:3095885078(0) win 65535 <mss 1460,nop,wscale 1,nop,nop,timestamp 288974989 0,sackOK,eol> (DF)
16:52:16.271086 [I]E.F.G.H[/I].22 > [I]a.b.c.d[/I].45642: S 1381661810:1381661810(0) ack 3095885079 win 5792 <mss 1380,nop,nop,timestamp 2738478757 288974989,nop,wscale 2> (DF)
16:52:16.271214 [I]a.b.c.d[/I].45642 > [I]E.F.G.H[/I].22: R 3095885079:3095885079(0) win 0
As you can see the rewrite is done correctly on the outgoing divert, and the external host responds. But the firewall is generating a tcp reset.
It's as if it has forgotten about the diverted socket and doesn't have an open socket for it anymore.
Hints would be wonderful, please.