+.Sh SCRIPTS
+Apart from reading the server and host configuration files,
+tinc can also run scripts at certain moments.
+Under Windows (not Cygwin), the scripts should have the extension
+.Pa .bat .
+.Bl -tag -width indent
+.It Pa @sysconfdir@/tinc/ Ns Ar NETNAME Ns Pa /tinc-up
+This is the most important script.
+If it is present it will be executed right after the tinc daemon has been started and has connected to the virtual network device.
+It should be used to set up the corresponding network interface,
+but can also be used to start other things.
+Under Windows you can use the Network Connections control panel instead of creating this script.
+.It Pa @sysconfdir@/tinc/ Ns Ar NETNAME Ns Pa /tinc-down
+This script is started right before the tinc daemon quits.
+.It Pa @sysconfdir@/tinc/ Ns Ar NETNAME Ns Pa /hosts/ Ns Ar HOST Ns Pa -up
+This script is started when the tinc daemon with name
+.Ar HOST
+becomes reachable.
+.It Pa @sysconfdir@/tinc/ Ns Ar NETNAME Ns Pa /hosts/ Ns Ar HOST Ns Pa -down
+This script is started when the tinc daemon with name
+.Ar HOST
+becomes unreachable.
+.It Pa @sysconfdir@/tinc/ Ns Ar NETNAME Ns Pa /host-up
+This script is started when any host becomes reachable.
+.It Pa @sysconfdir@/tinc/ Ns Ar NETNAME Ns Pa /host-down
+This script is started when any host becomes unreachable.
+.It Pa @sysconfdir@/tinc/ Ns Ar NETNAME Ns Pa /subnet-up
+This script is started when a Subnet becomes reachable.
+The Subnet and the node it belongs to are passed in environment variables.
+.It Pa @sysconfdir@/tinc/ Ns Ar NETNAME Ns Pa /subnet-down
+This script is started when a Subnet becomes unreachable.
+.El
+.Pp
+The scripts are started without command line arguments, but can make use of certain environment variables.
+Under UNIX like operating systems the names of environment variables must be preceded by a
+.Li $
+in scripts.
+Under Windows, in
+.Pa .bat
+files, they have to be put between
+.Li %
+signs.
+.Bl -tag -width indent
+.It Ev NETNAME
+If a netname was specified, this environment variable contains it.
+.It Ev NAME
+Contains the name of this tinc daemon.
+.It Ev DEVICE
+Contains the name of the virtual network device that tinc uses.
+.It Ev INTERFACE
+Contains the name of the virtual network interface that tinc uses.
+This should be used for commands like
+.Pa ifconfig .
+.It Ev NODE
+When a host becomes (un)reachable, this is set to its name.
+If a subnet becomes (un)reachable, this is set to the owner of that subnet.
+.It Ev REMOTEADDRESS
+When a host becomes (un)reachable, this is set to its real address.
+.It Ev REMOTEPORT
+When a host becomes (un)reachable, this is set to the port number it uses for communication with other tinc daemons.
+.It Ev SUBNET
+When a subnet becomes (un)reachable, this is set to the subnet.
+.El