From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) by finch.gentoo.org (Postfix) with ESMTP id ED4521381F3 for ; Wed, 22 May 2013 20:52:30 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id D7322E086B; Wed, 22 May 2013 20:52:22 +0000 (UTC) Received: from mail.zengers.de (mail.zengers.de [85.214.225.167]) by pigeon.gentoo.org (Postfix) with ESMTP id A5250E084C for ; Wed, 22 May 2013 20:52:21 +0000 (UTC) Received: from zengers.de (dslb-092-074-037-141.pools.arcor-ip.net [92.74.37.141]) by mail.zengers.de (Postfix) with ESMTPSA id 2FCDC10001B for ; Wed, 22 May 2013 22:52:20 +0200 (CEST) Date: Wed, 22 May 2013 22:52:18 +0200 From: Alex To: gentoo-user@lists.gentoo.org Subject: Re: [gentoo-user] VPN vs LAN address hostname resolution Message-ID: <20130522205218.GA1643@zengers.de> References: <519CF41B.5040108@gmail.com> <519D021D.2050006@orlitzky.com> <519D05C9.8000308@gmail.com> <519D0ED4.80304@gmail.com> <519D13E4.1070700@orlitzky.com> <519D1E02.1080001@gmail.com> Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-user@lists.gentoo.org Reply-to: gentoo-user@lists.gentoo.org MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <519D1E02.1080001@gmail.com> User-Agent: Mutt/1.5.21 (2010-09-15) X-Archives-Salt: c1d46733-96fb-4b3d-a618-e203bae40395 X-Archives-Hash: d541135374935e1a6bc338259637a57e Hi, On Wed, May 22, 2013 at 09:35:30PM +0200, Samuraiii wrote: > Script was just checking (by sftp with public ssh keys for unprivileged > account) if LAN (eth or wifi) address is up and if not it just assigned > address to hostname from vpn range (it did not accounted if machine is > up or down). And the just write new /etc/hosts. > I'm using something similar but more sophisticated. On my machines I have two hosts files, one for vpn, one for lan. Everytime I activate vpn on my machine, a symlink to the "vpn" hosts is created. Upon deactivation of my vpn the symlink points to the "normal" hosts. It looks like this: lrwxrwxrwx 1 root root 17 Feb 3 23:24 /etc/hosts -> /etc/hosts.normal -rw-r--r-- 1 root root 1354 Feb 19 04:49 /etc/hosts.normal -rw-r--r-- 1 root root 1420 Feb 3 16:09 /etc/hosts.vpn I use OpenVPN for my vpn, which calls the scripts up.sh and down.sh during de/activation. I simply put a appropriate "ln" command at the end of these scripts. Sure not the best solution, but if you only have a few machines it is good and simple enough. -- regards alex