Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 27 Jul 2011 22:30:34 +0200
From:      "Christopher J. Ruwe" <cjr@cruwe.de>
To:        freebsd-questions@freebsd.org
Subject:   Re: How to get ip address automatically from different dhcp server
Message-ID:  <20110727223034.0c0f0c8d@dijkstra>
In-Reply-To: <CANf5e8ZtkdWZhM6f=MeWv6%2BmNJOZ75jjox28Ss7L9RWpGNG3=g@mail.gmail.com>
References:  <CANf5e8ZtkdWZhM6f=MeWv6%2BmNJOZ75jjox28Ss7L9RWpGNG3=g@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
--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 <s.dave.jones@gmail.com> 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_--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20110727223034.0c0f0c8d>