From owner-freebsd-questions@freebsd.org Sun Aug 7 17:59:40 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 EE01ABB1F9A; Sun, 7 Aug 2016 17:59:40 +0000 (UTC) (envelope-from solene@perso.pw) Received: from bsd.zplay.eu (perso.pw [62.210.240.224]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "bsd.zplay.eu", Issuer "StartCom Class 1 Primary Intermediate Server CA" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 3395D1EAF; Sun, 7 Aug 2016 17:59:39 +0000 (UTC) (envelope-from solene@perso.pw) Received: from bsd.zplay.eu (localhost [127.0.0.1]) by bsd.zplay.eu (OpenSMTPD) with ESMTP id 52c532a7; Sun, 7 Aug 2016 19:59:37 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=perso.pw; h=to:subject :mime-version:content-type:content-transfer-encoding:date:from :cc:in-reply-to:references:message-id; s=selector1; bh=lqPzhPl1O pBRxzZYasKVVOr3nB0=; b=Ug3HPqOwuIu4HTL4q/+t16Pqlz6/8e8mgcpVpDuVX KdCvhPM1G6PvCdqeSeWtjrO2XAO6WwFiDEX5uEZzuJfJkcUfDWGfKtBPmpHlg8o9 JnGROsOkgEzbQWT7+BRon3RqTJvQPGjcL0B4M8b4cEdlPLMf+iaEgO2p/rrYleNb OA= DomainKey-Signature: a=rsa-sha1; c=nofws; d=perso.pw; h=to:subject :mime-version:content-type:content-transfer-encoding:date:from :cc:in-reply-to:references:message-id; q=dns; s=selector1; b=XEq NKJRketxRcIcApjE3ggvkwtrLQoWSxuuW7u/c5qdtie3sV2kX8ODeZW/f2sOsRgk EUpjSF20V3vKWyP5+kHIPbZHnXW11ePAqUkbnA5rI46Msw2Lvz0h9iZdS5ICg7ju HiAlzxjj5W+c+p6trwRa6NeK8QfIWra2HK7J0zgE= Received: from localhost (bsd.zplay.eu [local]) by bsd.zplay.eu (OpenSMTPD) with ESMTPA id 56c60007; Sun, 7 Aug 2016 19:59:36 +0200 (CEST) To: Yuri Subject: Re: Any way to cache large /etc/hosts files? X-PHP-Originating-Script: 0:rcube.php MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Date: Sun, 07 Aug 2016 19:59:36 +0200 From: =?UTF-8?Q?Sol=C3=A8ne_Rapenne?= Cc: FreeBSD Questions , owner-freebsd-questions@freebsd.org In-Reply-To: References: Message-ID: <960897ab9ef32afef1b38047bf284f3a@mail.zplay.eu> X-Sender: solene@perso.pw User-Agent: Roundcube Webmail/1.2.0 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: Sun, 07 Aug 2016 17:59:41 -0000 Le 2016-08-05 20:33, Yuri a écrit : > 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 > > _______________________________________________ > freebsd-questions@freebsd.org mailing list > https://lists.freebsd.org/mailman/listinfo/freebsd-questions > To unsubscribe, send any mail to > "freebsd-questions-unsubscribe@freebsd.org" Hello, Maybe adsuck would be a good tool for what you want. It original purpose it to use lists of blacklisted hosts to redirect them to 127.0.0.1 by using the dns system and stop ads in browing. adsuck uses files with the same syntax as /etc/hosts and then if it doesn't know the name if will pass the request to your DNS resolver.