How to get ip address automatically from different dhcp server

Christopher J. Ruwe cjr at cruwe.de
Wed Jul 27 20:30:50 UTC 2011


On Wed, 27 Jul 2011 10:49:42 +0800
dave jones <s.dave.jones at gmail.com> wrote:

> Hi,
> 
> I cat get an IP address from dhcp server by adding the line
> in /etc/rc.conf:
> 
> ifconfig_em0="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 at freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-questions
> To unsubscribe, send any mail to
> "freebsd-questions-unsubscribe at 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,
-- 
Christopher J. Ruwe
TZ GMT + 2
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 834 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-questions/attachments/20110727/dfccdb3e/signature.pgp


More information about the freebsd-questions mailing list