Changing interface based on network availability

Guus Sliepen guus at tinc-vpn.org
Mon Jul 2 16:43:20 CEST 2012


On Wed, Jun 27, 2012 at 04:36:48PM +1000, Andrew Cowie wrote:

> Is there a way to have tinc change the interface according to whether it
> thinks it is successfully connected to a [external] next hop?
[...]
> I'm sure typing
> 
> # ifconfig tun0 down
> 
> would do the trick, but presumably we want something a touch more
> elegant — and automatic — than that.

You could do this with up/down scripts for a specific host you are interested
in. Say you want to have the interface be up when node foo is reachable, then
create the following files:

hosts/foo-up:

#!/bin/sh
ifconfig $INTERFACE up

hosts/foo-down:

#!/bin/sh
ifconfig $INTERFACE down

-- 
Met vriendelijke groet / with kind regards,
     Guus Sliepen <guus at tinc-vpn.org>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://www.tinc-vpn.org/pipermail/tinc/attachments/20120702/742c2995/attachment.pgp>


More information about the tinc mailing list