@echo off setlocal enabledelayedexpansion net session >nul 2>&1 if %errorLevel% == 0 (goto go) else (goto elev) :go echo Tinc install helper echo. echo Type a node name. This node name has to be unique in the network, but can be anything ^(no special characters, please^) SET /P nodename=Node name: echo Node name set to "%nodename%" echo installing TAP device... if %PROCESSOR_ARCHITECTURE%==x86 ( pushd tap-win32 ) else ( pushd tap-win64 ) echo Should a TAP interface be installed? For first installations, the answer should be *yes*. SET /P insttap=Install a TAP device (y/n) Default: y? if %insttap%==n ( echo TAP interface not installed. ) else ( tapinstall.exe install OemWin2k.inf tap0901 ) popd echo. echo Please identify the newly installed TAP network connection in the following list^(s^): if not exist "%SystemRoot%\system32\WindowsPowerShell\v1.0\powershell.exe" ( netsh Interface IPv4 Show Addresses netsh interface show interface echo Choose the interface that was just created by TAP. There are multiple factors you can identify it on. echo 1. It has no IP address entry echo 2. It has the highest number after "Local Area connection x" ) else ( powershell Get-NetAdapter echo Choose the interface that was just created by TAP. Check for the "TAP-Win32 Adapter V9", type the name associated with it. ) set /P interfacename=Interface name: echo You can now set a new name for this interface. You can also retype the already existing name, but a short name like "VPN" makes the connection easily discernable in the local network connection list. echo. echo Keep in mind that if you change the name of the connection later on you will need to change it in tinc.conf too. set /P interface=Interface name: echo Netsh interface set interface name="%interfacename%" newname="%interface%" Netsh interface set interface name="%interfacename%" newname="%interface%" echo Name = %nodename% > tinc.conf echo Interface = %interface% >> tinc.conf echo The node needs an IP address in the tinc network. Please enter the IP you would like this node to have. echo Example: 192.168.1.1 set /P ip=IP: echo A subnet mask also has to be set. Please enter the subnet mask. echo Example: 255.255.255.0 set /P subnetmask=Subnet Mask: echo netsh interface ipv4 set address "%interface%" static %ip% %subnetmask% netsh interface ipv4 set address "%interface%" static %ip% %subnetmask% echo tinc.conf was successfully created. Next: Create keys for tinc ^ pause >nul echo. echo Tinc will now create the keys needed for operation. echo It will prompt for paths the keys should be in. echo Recommendation: Hit enter twice and keep the paths tinc suggests. mkdir hosts tincd -K4096 echo Subnet = %ip%/32 >> .\hosts\%nodename% echo If this computer has an externally reachable ^(public, static^) internet address, you can add it here. echo If it does not, this doesn't mean this node can not participate in a tinc network. It just means it has to connect to another node first. echo At least one tinc node has to have a public address so the VPN can function. echo Hit enter without typing anything to skip this entry. set address=NOTHING set /P address=Address: if %address%==NOTHING (goto addresscont) echo Address = %address% >> .\hosts\%nodename% :addresscont echo You can now set one node to connect to. This node should be publicly acessible. This entry is optional, though no connections will be possible when this node is unreachable from outside. echo You can add more nodes to connect to by adding them into the tinc.conf file set connectto=NOTHING set /P connectto=Node name to connect to: if %connectto%==NOTHING (goto connecttocont) echo ConnectTo = %connectto% >> tinc.conf :connecttocont echo Your hostfile is now in hosts\%nodename%. You can ^(and have to^) share this host file with other nodes to make a connection possible. echo Afterwards, start tinc by running tincd as Administrator. pause >nul goto end :elev .\tools\elevate -c "%~f0" :end