From owner-freebsd-questions Fri Dec 14 4:25:18 2001 Delivered-To: freebsd-questions@freebsd.org Received: from 217-126-145-95.uc.nombres.ttd.es (217-126-145-95.uc.nombres.ttd.es [217.126.145.95]) by hub.freebsd.org (Postfix) with ESMTP id E19BC37B417 for ; Fri, 14 Dec 2001 04:25:13 -0800 (PST) Received: by unicorn.ea4els.ampr.org (Postfix, from userid 1001) id 4FF4B31D1; Fri, 14 Dec 2001 13:25:10 +0100 (CET) To: freebsd-questions@freebsd.org Subject: Re: /etc/hosts vs. DNS for local-only machines References: <018701c18488$24f3a310$0a00000a@atkielski.com> From: Simon J Mudd Date: 14 Dec 2001 13:25:10 +0100 In-Reply-To: <018701c18488$24f3a310$0a00000a@atkielski.com> Message-ID: <86pu5i2dll.fsf@unicorn.ea4els.ampr.org> Lines: 64 User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.1 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG anthony@freebie.atkielski.com ("Anthony Atkielski") writes: > Anyway, is it better to define local hosts (those on my 10/24 LAN, not > visible from the Net) within DNS, or just within a /etc/hosts file? The easiest thing IMO is to setup each machine's local name in /etc/hosts and to use the DNS for the rest. > If I define them in DNS, how can I ensure that the definitions are > visible only from my LAN, and that named will never try to resolve > them from a different DNS server? Define your own domain "domain.madeup" and make your name server the primary nameserver for this domain. Create the zone file with your hosts and away you go. In /etc/namedb/named.conf zone "domain.makdeup" { type master; file "primaries/db.domain.madeup"; }; This will read a file with the domain information from /etc/namedb/primaries/db.domain.madeup. You need to create this "zone file". db.domain.madeup will have something like the following inside: $TTL 3600 @ IN SOA host.domain.madeup. sjmudd.pobox.com. ( 10 ; serial 10800 ; refresh 3 hours 3600 ; retry after 1 hour 604800 ; expire after 1 week 86400 ) ; minimum ttl NS host.domain.madeup.. IN MX 10 mail.domain.madeup. localhost IN A 127.0.0.1 host IN A 1.2.3.4 mail IN A 2.3.4.5 etc. You'll need to look at a book on zone files to set this up properly, but you should get the idea. If you now change /etc/resolv.conf to include search madeup.domain Then once you start named you should be able to do things like ping mail from host without having to specify anything else. Hope this helps, but do read up on BIND to set things up properly. Simon -- Simon J Mudd, Tel: +34-91-408 4878, Mobile: +34-605-085 219 Madrid, Spain. email: sjmudd@pobox.com, Postfix RPM Packager To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message