Re: NAT & BINAT !! Help!!!

From: Daniel Hartmeier (daniel_at_benzedrine.cx)
Date: 10/29/03

  • Next message: Dennis Davis: "Re: Redefinition Error with NTP-4.2.0 on OpenBSD 3.3"
    Date: 29 Oct 2003 15:23:41 GMT
    
    

    On Wed, 29 Oct 2003 12:33:26 +0100, vit wrote:

    > nat on dc2 from { 172.16.1.0/24,! <freeout>, ! 172.16.1.3, ! 172.16.1.28 }
    > to any -> XXX.YYY.CC.FFF

    This is the problem, it doesn't do what you intend.

    I assume you want the rule to apply to all sources within 172.16.1.0/24,
    except for sources .3, .28 and those in table freeout.

    But your rule simply expands to

      nat on dc2 from 172.16.1.0/24 to any -> XXX.YYY.CC.FFF
      nat on dc2 from ! <freeout> to any -> XXX.YYY.CC.FFF
      nat on dc2 from ! 172.16.1.3 to any -> XXX.YYY.CC.FFF
      nat on dc2 from ! 172.16.1.28 to any -> XXX.YYY.CC.FFF

    which you'll see when you run pfctl -sn.

    This block matches any source address, as any source address is either
    different from 172.16.1.3 or different from 172.16.1.28. So, using
    negated entries in {} lists is pointless, due to how expansion works.

    To solve this, there's the 'no nat' option:

      no nat on dc2 from { <freeout>, 172.16.1.3, 172.16.1.28 } to any
      nat on dc2 from 172.16.1.0/24 to any -> XXX.YYY.CC.FFF

    The first matching translation rule is used, so this construct will
    cause sources <freeout>, .3 and .28 to not get translated, but any
    other source within 172.16.1.0/24 to get translated.

    Note that for outgoing connections, binat has precedence over nat (and
    no nat), which might create another conflict, possibly.

    Daniel


  • Next message: Dennis Davis: "Re: Redefinition Error with NTP-4.2.0 on OpenBSD 3.3"

    Relevant Pages

    • Re: iptables: fake ip using DNAT and SNAT
      ... :I.e, the application receieves the real source address, so the ... the "ip rule add nat" command reports to be deprecated. ... what bothers me is why packets arriving via ... You can force the translation on machine A by routing packets out the ...
      (comp.os.linux.networking)
    • Re: NAT on a 1750 with 12.3(26)
      ... is open on the translation or not) the mapping stops working. ... if I issue a "no ip nat ins..." ... causes duplicate entries in the running config and the "sh ip nat ...
      (comp.dcom.sys.cisco)
    • Re: Linux v Dedicated NAT routers - secure remote differences
      ... > NAT After IPSec ... > one-to-one address translation occurs it will ... I don't think this is the case - it was reported to me that my packets had ... This scenario is possible because ESP does not use the IP ...
      (comp.security.firewalls)
    • Re: NAT Multicast question
      ... Actually you should not need to use NAT to translate 172.24.2.34 to ... specified by the ACL or route map or the static translation) will be ... all you need is an ACL that has ... dynamic translation using ACLs or route maps. ...
      (comp.dcom.sys.cisco)