From owner-freebsd-questions@freebsd.org Fri Aug 5 18:33:41 2016 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 A0A3BBB04D5 for ; Fri, 5 Aug 2016 18:33:41 +0000 (UTC) (envelope-from yuri@rawbw.com) Received: from shell1.rawbw.com (shell1.rawbw.com [198.144.192.42]) by mx1.freebsd.org (Postfix) with ESMTP id 78DF91E93 for ; Fri, 5 Aug 2016 18:33:41 +0000 (UTC) (envelope-from yuri@rawbw.com) Received: from yuri.doctorlan.com (c-24-5-143-190.hsd1.ca.comcast.net [24.5.143.190]) (authenticated bits=0) by shell1.rawbw.com (8.15.1/8.15.1) with ESMTPSA id u75IXYP8053589 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NO) for ; Fri, 5 Aug 2016 11:33:35 -0700 (PDT) (envelope-from yuri@rawbw.com) X-Authentication-Warning: shell1.rawbw.com: Host c-24-5-143-190.hsd1.ca.comcast.net [24.5.143.190] claimed to be yuri.doctorlan.com From: Yuri Subject: Any way to cache large /etc/hosts files? To: FreeBSD Questions Message-ID: Date: Fri, 5 Aug 2016 11:33:33 -0700 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:45.0) Gecko/20100101 Thunderbird/45.1.0 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 05 Aug 2016 18:33:41 -0000 Some people suggest using pre-compiled lists of ad and malware domains and block them on DNS level. (ex. https://github.com/StevenBlack/hosts) The resulting hosts file is about 1MB. nscd(8) caches DNS results, but it does this on name by name basis. Every new domain name request, even within the same process, causes /etc/hosts file to be reread again. Is there a way to cache /etc/hosts once and use it? Yuri