From owner-freebsd-questions@FreeBSD.ORG Wed Jan 4 20:57:40 2006 Return-Path: X-Original-To: freebsd-questions@freebsd.org Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 63ED516A41F for ; Wed, 4 Jan 2006 20:57:40 +0000 (GMT) (envelope-from reko.turja@liukuma.net) Received: from mxfep01.bredband.com (mxfep01.bredband.com [195.54.107.70]) by mx1.FreeBSD.org (Postfix) with ESMTP id DB50543D5F for ; Wed, 4 Jan 2006 20:57:34 +0000 (GMT) (envelope-from reko.turja@liukuma.net) Received: from moria.endor.swagman.org ([213.113.4.147] [213.113.4.147]) by mxfep01.bredband.com with ESMTP id <20060104205733.RABM17450.mxfep01.bredband.com@moria.endor.swagman.org>; Wed, 4 Jan 2006 21:57:33 +0100 Received: from rivendell (rivendell.endor.swagman.org [192.168.10.10]) by moria.endor.swagman.org (Postfix) with SMTP id 9734A11436; Wed, 4 Jan 2006 22:57:03 +0200 (EET) Message-ID: <011201c61171$7c3d3300$0a0aa8c0@endor.swagman.org> From: "Reko Turja" To: "Brian Bobowski" , "FreeBSD User Questions List" References: <43BC097C.4000401@gmail.com> Date: Wed, 4 Jan 2006 22:57:33 +0200 MIME-Version: 1.0 Content-Type: text/plain; format=flowed; charset="iso-8859-1"; reply-type=response Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2900.2670 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2670 Cc: Subject: Re: Setting up a FreeBSD gateway X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Jan 2006 20:57:40 -0000 ----- Original Message ----- From: "Brian Bobowski" To: "FreeBSD User Questions List" Sent: Wednesday, January 04, 2006 7:44 PM Subject: Setting up a FreeBSD gateway > However, I don't know how to set up DNS. Specifically, I want to > either pass all DNS requests through the gateway, or have the gateway > run a local DNS that queries my ISP's DNS in turn. Can anyone point me > to some steps on how to set that up? If you're going to use BIND (which I recommend and which is included in the system) check at least the following parameters in named.conf: listen-on - set this to your internal IP forwarders - if you dont want to fetch every single record from the official DNS's and want to utilize your providers DNS cache, set this variable to point on your ISP's DNS servers. forward-only as you're going to have your own domain records set up be sure this is commented out. Basically BIND with this kind of configuration will forward queries to master or forwarder servers unless it has the master record itself or there is cached record, which is still valid. defining the localhost: If the machine names are set up right in your fbsd installation, easiest is to use the make-localhost in the /etc/namedb directory. Then you forward zone file for your "domain" as well as reverse zones for the ip-ranges in use. My files are: master/mydomain.org file: $TTL 3600 @ IN SOA xxx.xxx.org. root.xxx.org. ( ; we define authority as well as the base domain (first xxx.org and ; the administrative contact - as bind has other uses for "." the mail ; address is notes with dot between domain and username. 2005111301 ;serial ; good idea is to use the shown date notation, and ALWAYS bump the serial whatever ;you do to the zone files) 86400 ;refresh 24h 7200 ;retry 2h 192200 ;expire 2d 86400) ;minimum 24h IN NS moria.endor.swagman.org. ; we define name servers for the zone only one is usually needed for "private" dns use. IN MX 5 moria.endor.swagman.org. ; I define mail handler server just in case... moria IN A 192.168.10.1 rivendell IN A 192.168.10.10 lorien IN A 192.168.10.11 muppet IN A 192.168.10.20 ;and then add my workstations As the main forward zone is now set up, we need the reverse zones as well. My reverse zone for above setup is (master/rev.mydomain.org): $TTL 1d @ IN SOA xxx.xxx.org. root.swagman.org. ( 2005111301 ;serial 1d ;refresh 2h ;retry 20d ;expire 2h ) ;neg cache IN NS moria.endor.swagman.org. 1 IN PTR moria.endor.swagman.org. 10 IN PTR rivendell.endor.swagman.org. 11 IN PTR lorien.endor.swagman.org. 20 IN PTR muppet.endor.swagman.org. With BIND the dots after the names are important, otherwise the names end up as name.my.domain.my.domain which usually isn't what you want :) After the zones are set up you can add them to named.conf as follows: zone "xxx.xxx.org" { type master; file "master/mydomain.org"; }; zone "10.168.192.in-addr.arpa" { type master; file "master/rev.mydomain.org"; }; In the above note the naming of reverse zone. To get correct resolution of reverse names you need to name your zone with similar formatting. Hope this helps a bit (although I recommend getting Bind handbook 8available from ISC as pdf, or some of the "basic" BSD books like Greg Lehey's, Or Michael Lucas's books on Freebsd - both have a good chapter on DNS setup with BIND. Of course nothing beats the O'Reilly Cricket book.) -Reko