DNAT in freebsd
julian at freebsd.org
Wed Jul 3 02:47:52 UTC 2013
On 7/2/13 10:21 PM, Sami Halabi wrote:
> Hi again,
> So far no solution....
> Is there really no alternative in FreeBSD?
oh I'm sure there are several solutions..
I looked at the original email but have since deleted it..
ah archives to the rescue....
ok so your request is a bit short on information..
> Here is the situation i want to handle:
> My box is a router that handles several /24 behind.
> One of my links (em0) is connected to a private network
> 192.168.0.1 is me, my neighbour is 192.168.0.2.
So you are supplying your neighbour with internet access?
> I want to make that any connection comes to 192.168.0.1 to go to ip
> 193.xxx.yyy.2 using specific public ip 84.xx.yy.1
comes to 192.168.0.1 from where? from your neighbour?
Do you want to intercept all his packets that arrive at
that interface or just packets that are addressed to 192.168.0.1?
Where is 193.xxx.yyy.2? On one of your networks, or out on the internet?
IS it the interface marked "D" in the diagram below? or at [Q]?
what is it? a proxy cache?
Where is 84.xx.yy.1? Is it your interface "A" in the diagram below?
(I assume so)
By "using", do you mean that they
arrive at 193.xxx.yyy.2 with a rewritten source address of 84.xx.yy.1
or that they think they are going TO 84.xx.yy.1? Where do you want the
reply packets to go, and what should they look like?
By "go to" do you mean a rewritten destination address of 193.xxx.yyy.2,
or just routed to it with the original destination address untouched?
> And packets coming to my public 84.xx.yy.1 ip to be trsnslated as came
> from 192.168.0.1 and sent to 192.168.0.2/or ant other ips
ALL packets that arrive at 84.xx.yy.1 or just some?
> Hope that makes it clearer, and I appreciate any help.
so let's draw a picture of what I think we know..
----------- [a] ------------------------- [b] -------------
internet B|------|84.xx.yy.1 192.168.0.1|-----|192.168.0.2
| |A C D | | neighbour
----------- ------------------------- --------------
| | |
[Q] | |
your networks ?
I think we know what normal packets at [a] and [b] look like
but we still need to know what 'changed' packets want to look like.
> בתאריך 1 ביול 2013 14:16, מאת "Sami Halabi" <sodynet1 at gmail.com>:
>> I did ping 10.0.1.1 from 10.0.1.2, so packet is 10.0.1.2 ->10.0.1.1
>>> ipfw add 1000 nat 1 all from 10.0.1.2 to 10.0.1.1
>> if I have 10.0.1.1 in em1 no translation is done!
>> if I delete it (and add a static arp entry in 10.0.1.2 for mac of
>> rule 1000 translates well and I get packet from 22.214.171.124->10.0.1.1
>>> ipfw add 2000 nat 2 all from 126.96.36.199 to 10.0.1.1
>> no translation is done at all!
>>> ipfw add 3000 nat 2 all from 188.8.131.52 to 184.108.40.206
>>> ipfw add 4000 nat 1 all from 10.0.1.1 to 220.127.116.11
>>> ipfw nat 1 config same_ports ureg_only ip 18.104.22.168
>>> ipfw nat 1 config reverse same_ports ureg_only ip 22.214.171.124
>> On Mon, Jul 1, 2013 at 1:42 PM, Eugene Grosbein <eugen at grosbein.net>wrote:
>>> On 01.07.2013 17:05, Sami Halabi wrote:
>>>> forgot to mention that but this sysctl is already set to 0.
>>>> i see in the logs packets pass 1000 rule.
>>> Use rules like 'ipfw add 1500 count log ip from any to any' to check
>>> intermediate results of translation.
>> Sami Halabi
>> Information Systems Engineer
>> NMS Projects Expert
>> FreeBSD SysAdmin Expert
> freebsd-ipfw at freebsd.org mailing list
> To unsubscribe, send any mail to "freebsd-ipfw-unsubscribe at freebsd.org"
More information about the freebsd-net