From owner-freebsd-net@freebsd.org Tue Nov 15 13:03:55 2016 Return-Path: Delivered-To: freebsd-net@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C5A2BC43D98; Tue, 15 Nov 2016 13:03:55 +0000 (UTC) (envelope-from spankthespam@gmail.com) Received: from mail-qk0-x22a.google.com (mail-qk0-x22a.google.com [IPv6:2607:f8b0:400d:c09::22a]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 80D559FE; Tue, 15 Nov 2016 13:03:55 +0000 (UTC) (envelope-from spankthespam@gmail.com) Received: by mail-qk0-x22a.google.com with SMTP id n21so133687410qka.3; Tue, 15 Nov 2016 05:03:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=rM0X/zTUnQfV6+5MqK2FrXEofV/gjiwD3ivgZNRZU58=; b=y6b6sfvM4BLj3G3IuJ8gaPdfJ979dXnP2MPlJW2PZgDmC0oXTG8CFiSj/TYOq53sGn z8quAd6yivAz+z9YkkFhEzrMnzqSOTaQBMrG+oqW/ex2Mf9yAObbdjovYbS7thgkGUpo SnDwegrYEwS3vFh+HS7rg/cCSRdqlpidPDu2bylPyx0TmLtZw6FuWJ/WTnhtNN+sc76O Q6sMByB8Lu+Rx2x91mNyBENkcSKMIp/IotOIXKjIawmwzoqHkE8IqC+32VHk7+NLEf+E HP3Id0W/7DzMY4AcGAeYpcPnxdZEgpTGNjq9vdO8bxQfKBJQggaP6SWZBNkk11TE0EIQ 6Ryg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=rM0X/zTUnQfV6+5MqK2FrXEofV/gjiwD3ivgZNRZU58=; b=PIF/lATP4A7QKEuw6l/+EvwOh7+LMauaDewQpZUdpj9ukwi0VHJOSWD9Yrz6ToxSvf 3G2rr3BFe6kJPrkfeT+y6Js9TwCYvMP/jjjvF7wpQ+EjD1ReMfFIMyPTAjyO2yWC+n41 m+BwL27+OMYc1ealX1ssdFRPkxu+U0yEK4MUNNCo/G5uoz7Q77jIedl8o89C9oLIxtwH hFKyt6gPi74/m3Kv1tEoev0bWqyn8d8n34y5ck0EVVErgU+VsVy2lJFz8CFQHXp4Akv2 g7SlmI/aK1AQe2n/NNwMyw3obyy2GF0Dh9+o8lR/tJIAXZ5peVeoD7U/bZGorsc2me7K 39yQ== X-Gm-Message-State: AKaTC01P/amTQSnFrRdZpxII78GSyu+TXOFAKon4r/8I0XZTpRJbziw9eRvIGGz5G4V+yCKhmnhJLbTZbw9JjA== X-Received: by 10.55.93.68 with SMTP id r65mr4390395qkb.84.1479215034698; Tue, 15 Nov 2016 05:03:54 -0800 (PST) MIME-Version: 1.0 Received: by 10.237.58.231 with HTTP; Tue, 15 Nov 2016 05:03:54 -0800 (PST) In-Reply-To: <20161115113705.GB1675@mail.opdns.de> References: <20161115113705.GB1675@mail.opdns.de> From: Big Lebowski Date: Tue, 15 Nov 2016 13:03:54 +0000 Message-ID: Subject: Re: NAT Reflection rules for FreeBSD PF To: Oliver Peter Cc: freebsd-pf@freebsd.org, freebsd-net@freebsd.org Content-Type: text/plain; charset=UTF-8 X-Content-Filtered-By: Mailman/MimeDel 2.1.23 X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 15 Nov 2016 13:03:55 -0000 On Tue, Nov 15, 2016 at 11:37 AM, Oliver Peter wrote: > El duderino, > > On Mon, Nov 14, 2016 at 10:30:59PM +0000, Big Lebowski wrote: > > > > I am trying to set up a 11.0-R PF based NAT for group of jails that needs > > to be able to talk to services on other jails, just as if they'd be > clients > > from outside of the network. Apparently, this is called 'NAT reflection' > > and I was able to find examples for OpenBSD PF here: > > https://www.openbsd.org/faq/pf/rdr.html (bottom of the page). > > > > Obviously, their syntax doesn't work on FreeBSD PF, so how to achieve the > > same thing? How to allow jails NAT'd on $ext_if (xn0) coming from > > $jails_net (192.168.0.0/24 aliased on lo0) to talk to each other, via > the > > $ext_if external IP? > > We did something similar in a customer setup a while ago: > > nat on $int_if from $jail_host to any -> $int_ip > rdr pass on $int_if proto { tcp, udp } from $jail_host to $ext_if > port{ $service1, service2 } -> $int_lb > > Cheers Thanks for your response Olivier! Would you mind elaborating on it a bit more? I don't understand what you're trying to achieve here, since the NAT doesn't happen on $int_if (lo0) but instead on $ext_if (xn0). The $int_if only holds the jail's IP addresses from the $jail_net range. How does that compare? Regards, BL