Browse Source

dn42: fix tun interfaces

master
Astro 4 months ago
parent
commit
e967ee77cb
1 changed files with 9 additions and 1 deletions
  1. 9
    1
      hosts/containers/dn42/configuration.nix

+ 9
- 1
hosts/containers/dn42/configuration.nix View File

@@ -39,6 +39,12 @@ in {
39 39
   # No Firewalling!
40 40
   networking.firewall.enable = false;
41 41
 
42
+  boot.postBootCommands = ''
43
+    if [ ! -c /dev/net/tun ]; then
44
+      mkdir -p /dev/net
45
+      mknod -m 666 /dev/net/tun c 10 200
46
+    fi
47
+  '';
42 48
   services.openvpn =
43 49
     let
44 50
       openvpnNeighbors = lib.filterAttrs (_: conf: conf ? openvpn) neighbors;
@@ -61,7 +67,9 @@ in {
61 67
           secret ${keyfile name}
62 68
         '';
63 69
         up = ''
64
-          ${pkgs.iproute}/bin/ip a a ${address6}/64 dev $1
70
+          ${pkgs.iproute}/bin/ip addr flush dev $1
71
+          ${pkgs.iproute}/bin/ip addr add ${address4} dev ${name} peer ${conf.address4}/32
72
+          ${pkgs.iproute}/bin/ip addr add ${address6}/64 dev $1
65 73
         '';
66 74
       };
67 75
     in {

Loading…
Cancel
Save