From owner-freebsd-net@FreeBSD.ORG Fri Jul 13 01:42:57 2012 Return-Path: Delivered-To: freebsd-net@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id B848A106566C for ; Fri, 13 Jul 2012 01:42:57 +0000 (UTC) (envelope-from kevlo@kevlo.org) Received: from ns.kevlo.org (kevlo.org [220.128.136.52]) by mx1.freebsd.org (Postfix) with ESMTP id 384D08FC08 for ; Fri, 13 Jul 2012 01:42:56 +0000 (UTC) Received: from [127.0.0.1] (git.kevlo.org [220.128.136.52]) by ns.kevlo.org (8.14.5/8.14.5) with ESMTP id q6D1ghFH033275; Fri, 13 Jul 2012 09:42:44 +0800 (CST) (envelope-from kevlo@kevlo.org) Message-ID: <1342143769.2250.3.camel@nsl> From: Kevin Lo To: Yuri Date: Fri, 13 Jul 2012 09:42:49 +0800 In-Reply-To: <4FFF3683.7020107@rawbw.com> References: <4FFF3683.7020107@rawbw.com> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.2.3-0ubuntu6 Content-Transfer-Encoding: 7bit Mime-Version: 1.0 Cc: freebsd-net@freebsd.org Subject: Re: System doesn't detect unplugged network cable and doesn't set interface up properly with DHCP X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Jul 2012 01:42:57 -0000 Yuri wrote: > I have the simplest possible DHCP setup: ifconfig_re0="DHCP" in > /etc/rc.conf. > > When the system boots, it gets connected fine. > > Now, I disconnect my laptop and connect it to another network. > When cable is disconnected, IP address of this interface stays the same, > old one is not removed. > When I plug it into another network, the same IP address stays. New IP > doesn't get set. This is bad. > So I have to manually do 'ifconfig re0 down && remove && > ifconfig re0 up'. > > I believe, once interface is set as "DHCP", all those things should > happen automatically. dhclient should drop the old IP when cable is > unplugged, and should set it up anew when cable is plugged back. > > Is my system misconfigured in some way, or this is the way how it works > in FreeBSD? Add the following lines to /etc/devd.conf: notify 0 { match "system" "IFNET"; match "type" "LINK_DOWN"; media-type "ethernet"; action "/etc/rc.d/dhclient quietstop $subsystem; ifconfig $subsystem inet 0.0.0.0"; }; Then restart devd(8). > Yuri Kevin