Changing interface based on network availability

Guus Sliepen guus at tinc-vpn.org
Tue Jul 3 08:12:18 CEST 2012


On Tue, Jul 03, 2012 at 12:18:48PM +1000, Andrew Cowie wrote:

> This all just made me realize: should I have a tinc-down explicitly
> `ifconfig down`ing the $INTERFACE?

Normally the VPN interface is created when tinc starts, and deleted when tinc
exits, so there is no need to do an explicit "ifconfig $INTERFACE down". If you
are using persistant tun/tap interfaces, or using a BSD operating system, a
tinc-down script is necessary in your case.

> If so, I wonder what the initial state is; wouldn't I need tinc-down aka
> tinc-init to run to down the tun interface after it is created?

When the interface is automatically created, it is in the down state.

> >  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
> > 
> 
> Do these run before or after tinc-up?

The tinc-up script is always the first that runs, tinc-down is the very last
one. All other scripts run in between.

-- 
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/20120703/5a11ec0f/attachment-0001.pgp>


More information about the tinc mailing list