User Tools

Site Tools


technical:vpn:tinc

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
technical:vpn:tinc [2023/05/13 17:52] jctechnical:vpn:tinc [2023/05/13 18:14] (current) – external edit 127.0.0.1
Line 6: Line 6:
 ### Arch Linux ### Arch Linux
  
-```+```bash
 sudo pacman -S tinc sudo pacman -S tinc
 ``` ```
Line 12: Line 12:
 ### Slackware Linux ### Slackware Linux
  
-```+```bash
 wget https://slackbuilds.org/slackbuilds/15.0/network/tinc.tar.gz wget https://slackbuilds.org/slackbuilds/15.0/network/tinc.tar.gz
 tar xzvf tinc.tar.gz tar xzvf tinc.tar.gz
Line 21: Line 21:
 sudo installpkg tinc-1.0.36-x86_64-1_SBo.tgz sudo installpkg tinc-1.0.36-x86_64-1_SBo.tgz
 ``` ```
- 
-### MacOS 
  
 ## Generate Keys ## Generate Keys
  
-```+```bash
 tincd -n <netname> -K tincd -n <netname> -K
 ``` ```
  
 ## Config ## Config
-</markdown> 
-Copy keys to /etc/tinc/<netname>/ 
  
-```+Copy keys to `/etc/tinc/<netname>/` 
 + 
 + 
 +```bash
 sudo mkdir -p /etc/tinc/<netname>hosts sudo mkdir -p /etc/tinc/<netname>hosts
-cp rsa_key.* /etc/tinc/<netname>+cp rsa_key.* /etc/tinc/<netname>/
 ``` ```
 +
  
 Create tinc-up and tinc-down scripts. Create tinc-up and tinc-down scripts.
  
-/etc/tinc/<netname>/tinc-up+`/etc/tinc/<netname>/tinc-up`
  
 ``` ```
Line 54: Line 54:
 ``` ```
  
-/etc/tinc/<netname>/tinc-down+`/etc/tinc/<netname>/tinc-down`
  
 ``` ```
Line 69: Line 69:
 Create tinc configuration Create tinc configuration
  
-/etc/tinc/<netname>/tinc.conf+`/etc/tinc/<netname>/tinc.conf`
  
 ``` ```
Line 82: Line 82:
  
 Add tinc peers Add tinc peers
 +
 +`/etc/tinc/<netname>/hosts/<peer>`
  
 ``` ```
-Subnet = <tinc_ip_address+Subnet = <peer_ip_address
-Address = <wan_ip_address>+Address = <peer_wan_address>
  
 <Peer's RSA Public Key> <Peer's RSA Public Key>
Line 91: Line 93:
  
 ## Startup ## Startup
 +
 +Start tincd
 +
 +```bash
 +VPN=$(ls /etc/tinc/)
 +for VPN in $VPNS; do
 +  echo "Starting tinc daemon for $VPN..."
 +  /usr/sbin/tincd -n "$VPN" -d1 --logfile=/var/log/tinc."$VPN"
 +done
 +```
  
 ## Shell Script ## Shell Script
 +
 +```bash
 +#!/bin/sh
 +
 +VPNS=$(ls /etc/tinc)
 +
 +start () {
 +        for VPN in $VPNS; do
 +                echo "Starting tinc daemon for $VPN..."
 +                /usr/sbin/tincd -n "$VPN" -d1 --logfile=/var/log/tinc."$VPN"
 +        done
 +}
 +
 +stop () {
 +        for VPN in $VPNS; do
 +                echo "Stopping tinc daemon for $VPN..."
 +                /usr/sbin/tincd -n "$VPN"  -k
 +        done
 +}
 +
 +restart () {
 +        stop
 +        sleep 1
 +        start
 +}
 +
 +case "$1" in
 +        ("start")
 +                start
 +                ;;
 +        ("stop")
 +                stop
 +                ;;
 +        ("restart")
 +                restart
 +                ;;
 +        (*)
 +                echo "Usage: $0 <start|stop|restart>"
 +                exit 1
 +esac
 +
 +exit 0
 +
 +```
 +</markdown>
  
technical/vpn/tinc.1684014749.txt.gz · Last modified: 2023/05/13 17:52 by jc