From owner-freebsd-questions@FreeBSD.ORG Thu Apr 24 14:27:21 2014 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 284E4E4C for ; Thu, 24 Apr 2014 14:27:21 +0000 (UTC) Received: from mail-lb0-x230.google.com (mail-lb0-x230.google.com [IPv6:2a00:1450:4010:c04::230]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id A41D0103D for ; Thu, 24 Apr 2014 14:27:20 +0000 (UTC) Received: by mail-lb0-f176.google.com with SMTP id 10so2033272lbg.21 for ; Thu, 24 Apr 2014 07:27:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:subject :content-type:content-transfer-encoding; bh=sysRhVkT78EkWozCijU4LwC1B9/iFQpqNuZxjuGFU1A=; b=VzSi7mRQk6SmiQ3raDewVAU3bk/liyIwr7LMpbuGQWNMj/1gFYbCkmiP59l9NuXjZH EPiPouWU/GjPmMvP1bz0o2su8tRomS2jCiWSP1EZPgKsvaOfqG8ylDkz/0LLLCfQzR/d 305srClBXgEJcOGdaEAuGCxUuqVJzeCJ+kMsJ4kFVCtHM6qzimk4vgarmCRHnVz/PCvS ZSaft5LRRU9QmLkJCtsHRMEiEBxQ2HyjgazXe8UWCsFAMrTByqvE9MwvFh/FnRZ24xgZ bdg7unsIp3uc5fNMiSipZERhIOSvHZbMnkYhenfknt3BZBf7kr6VchkZXFpu8zDLX6p1 5qXA== X-Received: by 10.112.87.226 with SMTP id bb2mr1390545lbb.29.1398349638479; Thu, 24 Apr 2014 07:27:18 -0700 (PDT) Received: from lazlar.no-ip.biz (c-5eeaaa2a-74736162.cust.telenor.se. [94.234.170.42]) by mx.google.com with ESMTPSA id lm5sm4115850lac.13.2014.04.24.07.27.16 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 24 Apr 2014 07:27:17 -0700 (PDT) Message-ID: <53591F01.4020108@gmail.com> Date: Thu, 24 Apr 2014 16:26:09 +0200 From: Rolf Nielsen User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:24.0) Gecko/20100101 Thunderbird/24.4.0 MIME-Version: 1.0 To: User questions Subject: Running a command when a specific interface is created or destroyed Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 Apr 2014 14:27:21 -0000 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? Rolf Nielsen