From owner-freebsd-questions@FreeBSD.ORG Wed Jul 27 20:30:50 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 F41A61065673 for ; Wed, 27 Jul 2011 20:30:49 +0000 (UTC) (envelope-from cjr@cruwe.de) Received: from cruwe.de (cruwe.de [188.40.164.98]) by mx1.freebsd.org (Postfix) with ESMTP id 76B598FC13 for ; Wed, 27 Jul 2011 20:30:49 +0000 (UTC) Received: from cruwe.de (unknown [127.0.0.4]) by cruwe.de (Postfix) with ESMTP id D199D1F125 for ; Wed, 27 Jul 2011 22:30:47 +0200 (CEST) Received: by cruwe.de (Postfix, from userid 65534) id B41971F124; Wed, 27 Jul 2011 22:30:47 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.cruwe.de X-Spam-Level: X-Spam-Status: No, score=-1.0 required=4.0 tests=ALL_TRUSTED autolearn=unavailable version=3.3.1 Received: from dijkstra (p57BDF18A.dip.t-dialin.net [87.189.241.138]) (using TLSv1 with cipher DHE-RSA-AES128-SHA (128/128 bits)) (No client certificate requested) by cruwe.de (Postfix) with ESMTPSA id 47A4E1F115 for ; Wed, 27 Jul 2011 22:30:45 +0200 (CEST) Date: Wed, 27 Jul 2011 22:30:34 +0200 From: "Christopher J. Ruwe" To: freebsd-questions@freebsd.org Message-ID: <20110727223034.0c0f0c8d@dijkstra> In-Reply-To: References: X-Mailer: Claws Mail 3.7.9 (GTK+ 2.22.1; amd64-portbld-freebsd8.2) Mime-Version: 1.0 Content-Type: multipart/signed; micalg=PGP-SHA1; boundary="Sig_/s6Pl8bX8HybapaD2iNuPKA_"; protocol="application/pgp-signature" X-Virus-Scanned: ClamAV on mail.cruwe.de using ClamSMTP 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: Wed, 27 Jul 2011 20:30:50 -0000 --Sig_/s6Pl8bX8HybapaD2iNuPKA_ Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable On Wed, 27 Jul 2011 10:49:42 +0800 dave jones wrote: > Hi, >=20 > I cat get an IP address from dhcp server by adding the line > in /etc/rc.conf: >=20 > ifconfig_em0=3D"DHCP" >=20 > 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. >=20 > My question is it's possible to get ip address automatically from > different dhcp server? thanks. >=20 > 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. Only devices that are configured to support DHCP will actually # run it. No link down rule exists because dhclient automaticly exits # when the link goes down. # notify 0 { match "system" "IFNET"; match "type" "LINK_UP"; media-type "ethernet"; action "/etc/rc.d/dhclient quietstart $subsystem"; }; # 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"; }; I am under the impression that this rule does what you want to do. Cheers, --=20 Christopher J. Ruwe TZ GMT + 2 --Sig_/s6Pl8bX8HybapaD2iNuPKA_ Content-Type: application/pgp-signature; name=signature.asc Content-Disposition: attachment; filename=signature.asc -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.17 (FreeBSD) iQIcBAEBAgAGBQJOMHVyAAoJEJTIKW/o3iwUsuoP/iQCw2W12Zsg6HBXN4T8jKgO yQbXYyowdgeTQhTVGNvS789v0iEpAYhinDbhoXPJL7soGAWprlrPTIQ1ZVrh81fb 97SP8qSamhWptAwLZOZSsyBr5DcQE4+kEmdIYah7mQLNQrAESxJAxEtrUWUwqJWR pLm/WXRJpSUInZo9xSrariuWCF+i02ijH63bix/g/fhPH8HOLkfdVrcb8Kf8x/au zLeUw9orAnrqmVDDg/A/hWe2y3C5p4bhlYpn2n9/GNBajelBlOMbqrsO6jHPgIOY 7uyF6t5s8zoyLEy0hM7+AiiohXAWqGZwvYVi9yoWnqapwnnL8apWm6vrHhGaeHBr uTp8PEtBxf9x00z8SlaqvzxOzVy/9wa0dXSnZrSxZYYcQ/XSxvBItR2sMqZPKegi 8Ylo69/e3r3E4pKMMRJyARpTncMkf9esyZ1QIxgDKGuxcvlVnnqtvsPPIJbRH9s1 9tVP+o721Zlz1GJ7OzN4AqIZQSfva7L6taQ9/AzumOTd3RxGO5iqm8+NG5x7TBz5 YP14IbSEu/MlTzRczOTHCYAEfBswxx8nyL3nuy5QAO+xfCuZpJBgfpKpnVYvvplt tKG/h5nFhH6OYZL5rEebXlah7Lb0t0qc61CGAzk6SIrDzqJ4Kp8bBUVzO/FHCPdd CDJh013gsAjJtRCGYGGZ =v863 -----END PGP SIGNATURE----- --Sig_/s6Pl8bX8HybapaD2iNuPKA_--