Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 24 Apr 2014 08:51:08 -0600 (MDT)
From:      Warren Block <wblock@wonkity.com>
To:        Rolf Nielsen <rmg1970swe@gmail.com>
Cc:        User questions <freebsd-questions@freebsd.org>
Subject:   Re: Running a command when a specific interface is created or destroyed
Message-ID:  <alpine.BSF.2.00.1404240849380.4641@wonkity.com>
In-Reply-To: <53591F01.4020108@gmail.com>
References:  <53591F01.4020108@gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Thu, 24 Apr 2014, Rolf Nielsen wrote:

> Hi,
>
> I use my phone's 3G/4G connection to connect my computer to the
> internet. With the help of the urndis driver, it comes up as ue0.
> However, if I reboot the computer, the phone automatically disables USB
> tethering, and I can't re-enable it until the boot is complete.
>
> Being somewhat paranoid, I use an OpenVPN service, and I want the cilent
> to start automatically. I obviously can't set it to start from rc.conf,
> as I can't log in to the server before I have an internet connection.
>
> So, is there a way to start the OpenVPN client automatically upon
> creation of the ue0 interface? E.g. can dhclient be set up to run the
> openvpn start script after it has given ue0 an IP address? And is there
> a way to automatically stop the openvpn client if ue0 is destroyed, e.g.
> if I disconnect my phone from the computer?

devd(8) can do that.  Look at /etc/devd.conf for some examples, and 
devd.conf(5) for more detail.



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