From owner-freebsd-ipfw@freebsd.org  Mon May  8 17:18:33 2017
Return-Path: <owner-freebsd-ipfw@freebsd.org>
Delivered-To: freebsd-ipfw@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 AAC90D63C6C
 for <freebsd-ipfw@mailman.ysv.freebsd.org>;
 Mon,  8 May 2017 17:18:33 +0000 (UTC)
 (envelope-from fjwcash@gmail.com)
Received: from mail-qk0-x233.google.com (mail-qk0-x233.google.com
 [IPv6:2607:f8b0:400d:c09::233])
 (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 6203A860
 for <freebsd-ipfw@freebsd.org>; Mon,  8 May 2017 17:18:33 +0000 (UTC)
 (envelope-from fjwcash@gmail.com)
Received: by mail-qk0-x233.google.com with SMTP id a72so41717742qkj.2
 for <freebsd-ipfw@freebsd.org>; Mon, 08 May 2017 10:18:33 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=mime-version:in-reply-to:references:from:date:message-id:subject:to;
 bh=BGXeqicRtQ+hwvQzkIfo+W/FRfea7ZNPIUQ4Rfqt7Hk=;
 b=bXKMFil1HMub8eziWcjpE5F89f6+bVQ2geyQ8ekWxmpThuCgn6hXAaZfVM7IXUbEwK
 YcYuHlJnWfevmXwmJidQv4KD4QNhkvgd2uE5QaI4u85u8fGmAvMgdn/HphMfY7BozIEL
 LZH9sjHLyqy1sZfiYGtMB5QKOWIfWghEiGebr4+vty/aMo1bURDDKaoHCIP0m7pXpS9p
 Rc3QccG0wEACjZZcYPvC/DqRAU/ANba0OeGgJh/O7wGqxu6T8X3EiHcfTWrH12+ZfAMF
 35AHZhu8XGksoHPPija64FdfW9zYZVaycb2aKrCXlC5sNGso1IduPHVmiDNUjCcZittQ
 FivQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:mime-version:in-reply-to:references:from:date
 :message-id:subject:to;
 bh=BGXeqicRtQ+hwvQzkIfo+W/FRfea7ZNPIUQ4Rfqt7Hk=;
 b=GNtBsT0Cw+rUx3FFgWqm5NncGmBHIMMZi45UmnpIaNKHPixez4tVW0ODa7sg1ILzjs
 gnN02HQ1qYz3L/ARWW2uP4C4e6Zdo1WmgM7lD9Y0eIcbOylc0wynER+Ek990PWo6sEfZ
 MA5sFBejTfDi1kPAkcXIHdR0wdAU8ezUo/BFEIVVInJwcL8lTCbYgZ41Z/X4k6Vjk5uH
 LPmv6yambwp2ctljY1Pty3mY3dZADbVE321q6J27y/W9nCP0F5y0+5l2StVBDm8ILrGw
 Z6B1FidN7A7hpntsJ4ZiWq5TMVREXvoU6PE3uVFA9fxrYHFpKGpFqzU0EQcUD9+N/IKA
 aKnw==
X-Gm-Message-State: AN3rC/4i91RwgT4IWnrJDWuQy6mknWmyvq7xxQjhmYSGUNsNDECKqiPY
 p82fBMMAn7+HXOfMqDAAlpH8kSuYwiI+
X-Received: by 10.55.144.6 with SMTP id s6mr25083139qkd.27.1494263912517; Mon,
 08 May 2017 10:18:32 -0700 (PDT)
MIME-Version: 1.0
Received: by 10.140.16.199 with HTTP; Mon, 8 May 2017 10:18:31 -0700 (PDT)
In-Reply-To: <11a326a1-80a7-cbf1-9e89-d8191e9dc1b6@denninger.net>
References: <26ccc7eb-bed3-680c-2c86-2a83684299fb@denninger.net>
 <08BB50FC-510C-4FCF-8443-0BB16EA2D032@obsigna.com>
 <6f304edb-ad2e-cb2a-eea9-7b6bbe0be760@freebsd.org>
 <52f73440-c1f0-7f08-0f8e-f912436ee686@denninger.net>
 <11FA2DA2-85AB-4E70-B9B5-CDADAAA3C295@obsigna.com>
 <29c05b94-be21-2090-03c5-f3905d3e2e06@denninger.net>
 <CAOjFWZ5c9s3orf5QDLZqnCfBDjNka7d-J8w1jwXahogKuAur_A@mail.gmail.com>
 <11a326a1-80a7-cbf1-9e89-d8191e9dc1b6@denninger.net>
From: Freddie Cash <fjwcash@gmail.com>
Date: Mon, 8 May 2017 10:18:31 -0700
Message-ID: <CAOjFWZ7-hH5JCzs5cV-S5YvyUZRJ8AdnUwcPtOQ+f6dU2O3UtQ@mail.gmail.com>
Subject: Re: Question that has dogged me for a while.
To: Karl Denninger <karl@denninger.net>, 
 "freebsd-ipfw@freebsd.org" <freebsd-ipfw@freebsd.org>
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
X-Content-Filtered-By: Mailman/MimeDel 2.1.23
X-BeenThere: freebsd-ipfw@freebsd.org
X-Mailman-Version: 2.1.23
Precedence: list
List-Id: IPFW Technical Discussions <freebsd-ipfw.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/freebsd-ipfw>,
 <mailto:freebsd-ipfw-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/freebsd-ipfw/>
List-Post: <mailto:freebsd-ipfw@freebsd.org>
List-Help: <mailto:freebsd-ipfw-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/freebsd-ipfw>,
 <mailto:freebsd-ipfw-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Mon, 08 May 2017 17:18:33 -0000

On Fri, May 5, 2017 at 8:34 PM, Karl Denninger <karl@denninger.net> wrote:

> Can you point me to the ruleset you posted?  Thanks in advance.
>
I can't remember all your network details, and don't have the e-mails
saved, so fill in the blanks below.  :)  And change the ports as needed.

=E2=80=8BIIF=3D<internal interface>=E2=80=8B
=E2=80=8BEIF=3D<external interface>

PUB_IP=3D"me"
SRV_IP=3D<server private IP>
PRV_NET=3D<client private subnet>=E2=80=8B


=E2=80=8B# NAT incoming traffic for port 8080 to server's private IP=E2=80=
=8B
=E2=80=8Bipfw nat 100 config same_ports ip $PUB_IP redirect_port tcp $PRV_I=
P:80
$PUB_IP:8080
=E2=80=8B

# NAT outgoing traffic from private subnet to public IP
ipfw nat 200 config same_ports ip $PUB_IP
=E2=80=8B

# Allow port 8080 traffic to server from private subnet (in)
ipfw add nat 100 tcp from $PRV_NET to $PUB_IP 8080 in  recv $IIF
ipfw add nat 200 tcp from $PRV_NET to $SRV_IP 80   out xmit $IIF

ipfw add nat 200 tcp from $SRV_IP 80   to $PUB_IP  in  recv $IIF
ipfw add nat 100 tcp from $PUB_IP 8080=E2=80=8B to $PRV_NET out xmit $IIF


# Allow port 8080 traffic from Internet to server (in)
ipfw add nat 200 tcp from any        to $PUB_IP 8080 in  recv $EIF
ipfw add allow   tcp from any        to $SRV_IP 80   out xmit $IIF

ipfw add allow   tcp from $SRV_IP 80 to any          in  recv $IIF
ipfw add nat 200 tcp from $SRV_IP 80 to any          out xmit $EIF


=E2=80=8B# Allow clients access to Internet (out)
ipfw add allow   tcp from $PRV_NET to any      in  recv $IIF
ipfw add nat 100 tcp from $PUB_IP  to any      out recv $EIF

ipfw add nat 100 tcp from any      to $PUB_IP  in  recv $EIF
ipfw add allow   tcp from any      to $PRV_NET out xmit $IIF
=E2=80=8B

=E2=80=8B# Block the rest
ipfw add deny log ip from any to any in recv $EIF
ipfw add deny log ip from any to any in recv $IIF
=E2=80=8B

--=20
Freddie Cash
fjwcash@gmail.com