Debian10.page 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277
  1. # Installation
  2. - Wird an anderer Stelle des Wiki beschrieben
  3. # Allgemein
  4. - Informationen auf dieser Seite sind teilweise von anderen Wiki-Seiten übernommen.
  5. Hier sollen die Schritte nach der Installation von Debian 10 (buster) zum Aufbau eines VPN mit Tinc und Bird beschrieben werden.
  6. Für die meisten Befehle sind root Rechte erforderlich.
  7. # Hardware
  8. - APU mit Buster ohne grafische Oberfläche
  9. - Laptop mit Ubuntu 18.04
  10. Es werden für alle Interfaces statische IPV4 Adressen verwendet, auf dem Laptop ist auch DHCP aktiv.
  11. Die hier verwendeten Adressen sind dem Wiki [IP-Adressen](IP-Adressen) für berghofen entnommen.
  12. berghofen, wie auch die anderen Standorte, bestehen jeweils mindesten aus der APU und einem Laptop sowie einem Internetrouter (F!Box).
  13. An jedem Standort gibt es eine Tincverbindung zwischen APU und Laptop, lan genannt, und eine Tincverbindung zwischen APU und den anderen Standorten, wan.
  14. # Software
  15. - Debian 10.7 (buster), auf dem Laptop Ubuntu 18.04
  16. - Tinc 1.1pre17 oder tinc 1.0.36
  17. - Bird 2.07
  18. # Dateien der APU
  19. /etc/network/interfaces
  20. # This file describes the network interfaces available on your system
  21. # and how to activate them. For more information, see interfaces(5).
  22. source /etc/network/interfaces.d/*
  23. # The loopback network interface
  24. auto lo
  25. iface lo inet loopback
  26. up ip addr add 193.43.220.130/32 dev lo
  27. up /home/fb/bin/r
  28. # The primary network interface
  29. allow-hotplug enp1s0
  30. iface enp1s0 inet static
  31. address 192.168.178.51/24
  32. # gateway 192.168.178.254 #default gateway wird von bird erledigt
  33. broadcast 192.168.178.255
  34. # dns-* options are implemented by the resolvconf package, if installed
  35. dns-nameservers 192.168.178.254
  36. dns-search fritz.box
  37. allow-hotplug wan
  38. iface wan inet static
  39. address 193.43.220.162/27
  40. broadcast 193.43.220.191
  41. mtu 1504
  42. allow-hotplug lan
  43. iface lan inet static
  44. address 192.168.34.1/24
  45. broadcast 192.168.34.255
  46. mtu 1504
  47. #allow-hotplug wlp5s0
  48. #iface wlp5s0 inet dhcp
  49. # Tinc Verzeichnistruktur Tinc APU und Laptop Einstellungen
  50. etc/tinc/
  51. |-- lan
  52. | |-- hosts
  53. | | |-- apu
  54. | | `-- laptop
  55. | |-- rsa_key.priv
  56. | |-- ed25519_key.priv ## nur bei tinc 1.1
  57. | `-- tinc.conf
  58. `-- wan ## wan Verzeichis nur auf der APU
  59. |-- hosts
  60. | |-- berghofen
  61. | |-- hoerde
  62. | `-- nordstadt
  63. |-- rsa_key.priv
  64. |-- ed25519_key.priv ## nur bei tinc 1.1
  65. `-- tinc.conf
  66. /etc/tinc/lan/tinc.conf
  67. ## APU lan tinc.conf
  68. Name = apu
  69. Device = /dev/net/tun
  70. Mode = switch
  71. AddressFamily = ipv4
  72. BindToAddress = 192.168.178.51
  73. Port = 10001
  74. MaxTimeout = 30
  75. GraphDumpFile = /var/run/tinc.lan.dot
  76. ConnectTo = laptop
  77. /etc/tinc/wan/tinc.conf
  78. ## APU wan tinc.conf
  79. Name = berghofen
  80. Device = /dev/net/tun
  81. Mode = switch
  82. AddressFamily = ipv4
  83. BindToaddress = 192.168.178.51
  84. Port = 661
  85. MaxTimeout = 30
  86. GraphDumpFile = /var/run/tinc.wan.dot
  87. ConnectTo = hoerde
  88. ConnectTo = nordstadt
  89. Inhalt der hosts Dateien
  90. Die ED25519PublicKey Zeile existiert nur bei tinc 1.1
  91. /etc/tinc/lan/hosts/apu auf APU und laptop
  92. Address = 192.168.178.51
  93. Port = 10001
  94. -----BEGIN RSA PUBLIC KEY-----
  95. Schlüsseldaten
  96. -----END RSA PUBLIC KEY-----
  97. Ed25519PublicKey = WmAmMY95+B/A9FDQz7ZiV6WQcG2qAUUclRP52dwXSdD
  98. /etc/tinc/lan/hosts/laptop auf APU und laptop
  99. Address = 192.168.178.52
  100. Port = 10001
  101. -----BEGIN RSA PUBLIC KEY-----
  102. Schlüsseldaten
  103. -----END RSA PUBLIC KEY-----
  104. Ed25519PublicKey = WCkEAe/gohI7JAGLiHPKdE+ayxYrG1wuTfQQijAROuD
  105. /etc/tinc/wan/hosts/berghofen auf APU
  106. -----BEGIN RSA PUBLIC KEY-----
  107. Schlüsseldaten
  108. -----END RSA PUBLIC KEY-----
  109. Ed25519PublicKey = Tkhp7t+MsmQKsWIkO5qimTKoWdkvRigKwctxtfOu2MF
  110. /etc/tinc/wan/hosts/hoerde auf APU
  111. Address = 130.180.53.22
  112. Port = 661
  113. -----BEGIN RSA PUBLIC KEY-----
  114. Schlüsseldaten
  115. -----END RSA PUBLIC KEY-----
  116. Ed25519PublicKey = MjaltxtfPP1SdHgNH/dUuHmbYDXFdZMEUUbl0Qi/YCA
  117. /etc/tinc/wan/hosts/nordstadt auf APU
  118. Address = 91.204.4.53
  119. Port = 661
  120. -----BEGIN RSA PUBLIC KEY-----
  121. Schlüsseldaten
  122. -----END RSA PUBLIC KEY-----
  123. Ed25519PublicKey = 4znU87BKnctOFb+/JQhIltGtYN3h3czOVInolRPWgvA
  124. Beide Tinc Instanzen können auf der APU parallel gestartet werden
  125. systemctl start tinc@lan
  126. systemctl start tinc@wan
  127. # Bird auf der APU
  128. /etc/iproute2/rt_tables identisch auf APU / laptop
  129. #
  130. # reserved values
  131. #
  132. 255 local
  133. 254 main
  134. 253 default
  135. 0 unspec
  136. #
  137. # local
  138. #
  139. 1 tinc
  140. - Die bird.conf des laptops ist bis auf andere IP adressen und der fehlende Eintrag für interface wan identisch
  141. /etc/bird/bird.conf
  142. router id 193.43.220.130; /* public IP APU */
  143. log syslog { debug, info, trace, remote }; /* optional */
  144. define AS35675_all = [
  145. 193.43.220.0/23
  146. ];
  147. define AS35675_any = [
  148. 193.43.220.0/23+
  149. ];
  150. protocol device device0 {
  151. scan time 10;
  152. }
  153. /* wg. BSD: */
  154. protocol direct direct0 {
  155. ipv4;
  156. }
  157. protocol kernel kernel0 {
  158. learn on;
  159. scan time 120;
  160. ipv4 {
  161. import all;
  162. export where source != RTS_DEVICE;
  163. };
  164. }
  165. # erstellt neue routing tabelle
  166. ipv4 table fib1table;
  167. #RTS route source
  168. #import / export
  169. protocol kernel kernel1 {
  170. kernel table 1;
  171. learn on;
  172. scan time 120;
  173. ipv4 {
  174. table fib1table;
  175. import all;
  176. export where source != RTS_DEVICE;
  177. };
  178. }
  179. protocol static static1 {
  180. ipv4 {
  181. table fib1table;
  182. };
  183. route 0.0.0.0/0 via 192.168.178.254; /* zur F!Box */
  184. }
  185. protocol ospf ospfwan {
  186. ipv4 {
  187. import all;
  188. export where net ~ AS35675_any;
  189. };
  190. area 0.0.0.0 {
  191. stubnet 193.43.220.130/32 { cost 1; };
  192. interface "wan" { /* 4 Zeilen ab hier nur APU */
  193. type broadcast;
  194. cost 100;
  195. };
  196. interface "lan" {
  197. type broadcast;
  198. cost 10;
  199. };
  200. };
  201. }
  202. Den bird starten.
  203. systemctl start bird
  204. # Sonstiges
  205. /etc/sysctl.conf
  206. # Uncomment the next line to enable packet forwarding for IPv4
  207. net.ipv4.ip_forward=1