From owner-freebsd-questions@freebsd.org Tue Apr 11 12:25:26 2017 Return-Path: Delivered-To: freebsd-questions@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 E3DA3D39817 for ; Tue, 11 Apr 2017 12:25:26 +0000 (UTC) (envelope-from smithi@nimnet.asn.au) Received: from sola.nimnet.asn.au (paqi.nimnet.asn.au [115.70.110.159]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 68956238 for ; Tue, 11 Apr 2017 12:25:25 +0000 (UTC) (envelope-from smithi@nimnet.asn.au) Received: from localhost (localhost [127.0.0.1]) by sola.nimnet.asn.au (8.14.2/8.14.2) with ESMTP id v3BCP3dh053327; Tue, 11 Apr 2017 22:25:03 +1000 (EST) (envelope-from smithi@nimnet.asn.au) Date: Tue, 11 Apr 2017 22:25:03 +1000 (EST) From: Ian Smith To: Polytropon cc: Miha Smrekar , freebsd-questions@freebsd.org Subject: Re: FreeBSD firewall configuration In-Reply-To: Message-ID: <20170411220239.S9330@sola.nimnet.asn.au> References: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 11 Apr 2017 12:25:27 -0000 In freebsd-questions Digest, Vol 671, Issue 2, Message: 3 On Mon, 10 Apr 2017 21:37:47 +0200 Polytropon wrote: > > Can you also help me with the rule to forward incoming trafic to other > > interface? > > You first need to put > > net.inet.ip.forwarding=1 > > into /etc/sysctl.conf and make this change active (read: reboot or Reboot? Like Windows? :) > manually call "service sysctl restart". > > Additionally, add > > gateway_enable="YES" > > to /etc/rc.conf. Just a minor niggle .. having gateway_enable="YES" in rc.conf causes net.inet.ip.forwarding=1 to be set by /etc/rc.d/routing, so you don't need to add it to /etc/sysctl.conf as well - though it won't hurt, unless you later wanted to turn it off by updating rc.conf :) Then just a 'service routing restart' will do the trick. From which: if checkyesno gateway_enable; then ropts_init inet echo -n ' gateway=YES' ${SYSCTL} net.inet.ip.forwarding=1 > /dev/null else ${SYSCTL} net.inet.ip.forwarding=0 > /dev/null fi cheers, Ian