From owner-freebsd-questions@FreeBSD.ORG Fri Aug 12 03:46:35 2011 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 44536106566B for ; Fri, 12 Aug 2011 03:46:35 +0000 (UTC) (envelope-from s.dave.jones@gmail.com) Received: from mail-vw0-f54.google.com (mail-vw0-f54.google.com [209.85.212.54]) by mx1.freebsd.org (Postfix) with ESMTP id 052928FC15 for ; Fri, 12 Aug 2011 03:46:34 +0000 (UTC) Received: by vws18 with SMTP id 18so2928675vws.13 for ; Thu, 11 Aug 2011 20:46:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; bh=Szs0rletujXTjfX6unlk4Is30kIMUGby3ygMscGoIbg=; b=pbPS5HvHdaeoOtYY+igxQgYQqWkB09oeC5STXKNX2svAxKQNQz30U2ZXtsY4nAYePN dC+gV55QmrwhPbZg8j9+eZdxHvTGwPmWCWRzp2i0nCqJLlo0I5NRMMXVaLK+L3ghTe05 okE6b6IubZf7EQ2mRLCh4Dg7QEOoENyG6soJk= MIME-Version: 1.0 Received: by 10.52.88.200 with SMTP id bi8mr380793vdb.212.1313120794283; Thu, 11 Aug 2011 20:46:34 -0700 (PDT) Received: by 10.52.109.72 with HTTP; Thu, 11 Aug 2011 20:46:34 -0700 (PDT) In-Reply-To: <20110727223034.0c0f0c8d@dijkstra> References: <20110727223034.0c0f0c8d@dijkstra> Date: Fri, 12 Aug 2011 11:46:34 +0800 Message-ID: From: dave jones To: "Christopher J. Ruwe" Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: freebsd-questions@freebsd.org Subject: Re: How to get ip address automatically from different dhcp server 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: Fri, 12 Aug 2011 03:46:35 -0000 Hi Christopher, Thanks for your solution. It does help a lot, but there's one problem. For example, DHCP server is not started for some reason and my computer's ethernet cable is plugged. Once dhcp server started, I can't get the IP unl= ess I unplug and then plug the ethernet cable. Do you know how to solve this issue? Thank you. Regards, Dave. On Thu, Jul 28, 2011 at 4:30 AM, Christopher J. Ruwe wrote: > On Wed, 27 Jul 2011 10:49:42 +0800 > dave jones wrote: > >> Hi, >> >> I cat get an IP address from dhcp server by adding the line >> in /etc/rc.conf: >> >> ifconfig_em0=3D"DHCP" >> >> If I move my laptop to another place, I have to manually run >> "dhclient em0" to get an IP. Otherwise, it won't get an IP >> automatically. >> >> My question is it's possible to get ip address automatically from >> different dhcp server? thanks. >> >> Regards, >> Dave. >> _______________________________________________ >> freebsd-questions@freebsd.org mailing list >> http://lists.freebsd.org/mailman/listinfo/freebsd-questions >> To unsubscribe, send any mail to >> "freebsd-questions-unsubscribe@freebsd.org" > > Have a look at /etc/devd.conf. Mine include a portion > > # > # Try to start dhclient on Ethernet like interfaces when the link comes > # up. =A0Only devices that are configured to support DHCP will actually > # run it. =A0No link down rule exists because dhclient automaticly exits > # when the link goes down. > # > notify 0 { > =A0 =A0 =A0 =A0match "system" =A0 =A0 =A0 =A0 =A0"IFNET"; > =A0 =A0 =A0 =A0match "type" =A0 =A0 =A0 =A0 =A0 =A0"LINK_UP"; > =A0 =A0 =A0 =A0media-type =A0 =A0 =A0 =A0 =A0 =A0 =A0"ethernet"; > =A0 =A0 =A0 =A0action "/etc/rc.d/dhclient quietstart $subsystem"; > }; > # > notify 0 { > =A0 =A0 =A0 =A0match "system" =A0 =A0 =A0 =A0 =A0"IFNET"; > =A0 =A0 =A0 =A0match "type" =A0 =A0 =A0 =A0 =A0 =A0"LINK_DOWN"; > =A0 =A0 =A0 =A0media-type =A0 =A0 =A0 =A0 =A0 =A0 =A0"ethernet"; > =A0 =A0 =A0 =A0action "/etc/rc.d/dhclient quietstop $subsystem ; ifconfig= $subsystem inet 0.0.0.0"; > }; > > I am under the impression that this rule does what you want to do. > > Cheers, > -- > Christopher J. Ruwe > TZ GMT + 2 >