Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 13 Jul 2012 09:42:49 +0800
From:      Kevin Lo <kevlo@kevlo.org>
To:        Yuri <yuri@rawbw.com>
Cc:        freebsd-net@freebsd.org
Subject:   Re: System doesn't detect unplugged network cable and doesn't set interface up properly with DHCP
Message-ID:  <1342143769.2250.3.camel@nsl>
In-Reply-To: <4FFF3683.7020107@rawbw.com>
References:  <4FFF3683.7020107@rawbw.com>

next in thread | previous in thread | raw e-mail | index | archive | help
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 <OLD-IP> && 
> 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




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