From owner-freebsd-questions@FreeBSD.ORG Sun Dec 14 13:23:12 2008 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3BA93106564A for ; Sun, 14 Dec 2008 13:23:12 +0000 (UTC) (envelope-from wtf.jlaine@gmail.com) Received: from mail-ew0-f21.google.com (mail-ew0-f21.google.com [209.85.219.21]) by mx1.freebsd.org (Postfix) with ESMTP id 948698FC0C for ; Sun, 14 Dec 2008 13:23:11 +0000 (UTC) (envelope-from wtf.jlaine@gmail.com) Received: by ewy14 with SMTP id 14so2964351ewy.19 for ; Sun, 14 Dec 2008 05:23:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:received:date:from:to:cc :subject:message-id:mail-followup-to:references:mime-version :content-type:content-disposition:in-reply-to:user-agent :x-operating-system; bh=zYv2485efx63KTgHSnQZb00t74rvTPbpMMOyEdKlq3Q=; b=fqU5/UIqA9C7qkAgB4vGJegh6p3lwH2bAdF4fdE1s/0hMbfU7ISAWHM0CC+D1xITq6 juIEUaGsjwNxY18bTz+gDVP77IhVosIHh9dJHepIbAOQfz4Z3payAVmym6u1xEhs0JrJ FWJhg5HoE05IdffcZvocIOZ1IRTGp1q++JqSQ= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=date:from:to:cc:subject:message-id:mail-followup-to:references :mime-version:content-type:content-disposition:in-reply-to :user-agent:x-operating-system; b=TPfbOBsmUBpnIwlRIs+1P1tZQXLTHw82ekJ2697B+0sFfm64nZ8pP6ZJbjnQdeLODY jTkNDytHylMCEhm14ZkKZ08SB1Z/pLad43iP8+puYbySdJXm4/hnOwtp+PXy33jM4AjX YwvPnJZHF3c7nvOQ9HRH7eCfu62VQcgK1oBzw= Received: by 10.210.129.10 with SMTP id b10mr6520995ebd.121.1229260990255; Sun, 14 Dec 2008 05:23:10 -0800 (PST) Received: from blackmesa ([77.66.225.53]) by mx.google.com with ESMTPS id 2sm9207611ewy.48.2008.12.14.05.23.07 (version=SSLv3 cipher=RC4-MD5); Sun, 14 Dec 2008 05:23:09 -0800 (PST) Received: by blackmesa (sSMTP sendmail emulation); Sun, 14 Dec 2008 16:23:04 +0300 Date: Sun, 14 Dec 2008 16:23:04 +0300 From: Jeff Laine To: raggen@raggens.net Message-ID: <20081214132304.GA97385@free.bsd.loc> Mail-Followup-To: Jeff Laine , raggen@raggens.net, freebsd-questions@freebsd.org References: <4945035C.6040401@telia.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4945035C.6040401@telia.com> User-Agent: Mutt/1.4.2.3i X-Operating-System: FreeBSD 7.1-RC1 i386 Cc: freebsd-questions@freebsd.org Subject: Re: Canonical way for DHCP->IP->/etc/hosts 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: Sun, 14 Dec 2008 13:23:12 -0000 On Sun, Dec 14, 2008 at 02:00:12PM +0100, Roger Olofsson wrote: > Dear mailing list, > > I am sorry if this question has been asked over and over again - however > the htdig search interface for the lists is somewhat shaky and gives > referrer errors for me. > > Pre-conditions. > Dualhomed firewalled FreeBSD7.1. One nic is LAN and the other dynamical > IP from ISP. > > Question: What is the canonical way for catching the IP address from a > DHCP assigned nic (from ISP that doesn't set hostname) and put the IP > into /etc/hosts with a hostname? > > Reason for asking > Firewall rules needs refreshing after new IP > > Possible answers: > Create dhcp-exit-hooks (undocumented?) in /etc like so: > > #!/bin/sh > > if [ ! -z "$new_ip_address" ]; then > IP=`ifconfig WAN | grep 'inet' | grep -v 'inet6' | cut -f 2 -d ' '` > if [ ! -z "$IP" ]; then > echo "$IP wan.local.domain wan" >> /etc/hosts > > > > fi > fi > Hello. I think pf can handle with dhcp updates on interfaces pretty well. If only I get your question right. -- Best regards, Jeff () X-mas ribbon campaign /\