wireguard: ifup wg0 -> "unknown interface".

Einrichten des lokalen Netzes, Verbindung zu anderen Computern und Diensten.
Antworten
egerlach
Beiträge: 206
Registriert: 13.06.2009 17:21:50

wireguard: ifup wg0 -> "unknown interface".

Beitrag von egerlach » 24.11.2021 13:07:32

Hallo ,
ich plage mich hier seit einer Stunde mit debian 10.10, recht frisch installiert damit herum, wireguard soll auf debian als Server laufen:

Code: Alles auswählen

root@deb10:~# ifup wg0
ifup: unknown interface wg0
root@deb10:~#
Habe 2 Anleitungen durchprobiert, die zweite diese hier : https://gist.github.com/kalaspuffar/128 ... a54ab6683c
Überall der gleiche Fehler: unknown interface. Warum? Auf einem raspi mit debian 10.9 gehts einwandfrei.

Code: Alles auswählen

root@deb10:~# cat  /etc/wireguard/wg0.conf 
# define the WireGuard service
# define the WireGuard service
[Interface]
# contents of file wg-private.key that was recently created
PrivateKey = hlKy6azGCB0uVbCdkW8Htx23k57iWzOFJRLAYHTx5wU=

# UDP service port; 51820 is a common choice for WireGuard
ListenPort = 51820

[Peer]
PublicKey = 2GIURzIDBgI1Y+1Ei+i2C5kEOR53mH172MaidaVpD3M=


root@deb10:~# cat  /etc/network/interfaces.d/wg0
# indicate that wg0 should be created when the system boots, and on ifup -a
auto wg0

# describe wg0 as an IPv4 interface with static address
iface wg0 inet static

        # static IP address
        address 10.0.2.1/24

        # before ifup, create the device with this ip link command
        pre-up ip link add $IFACE type wireguard

        # before ifup, set the WireGuard config from earlier
        pre-up wg setconf $IFACE /etc/wireguard/$IFACE.conf

        # after ifdown, destroy the wg0 interface
        post-down ip link del $IFACE

root@deb10:~# ifconfig
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 10.0.0.104  netmask 255.255.255.0  broadcast 10.0.0.255
        inet6 fe80::215:5dff:fe80:5904  prefixlen 64  scopeid 0x20<link>
        inet6 2a02:810b:4c0:32fc:215:5dff:fe80:5904  prefixlen 64  scopeid 0x0<global>
        ether 00:15:5d:80:59:04  txqueuelen 1000  (Ethernet)
        RX packets 1792481  bytes 611954758 (583.6 MiB)
        RX errors 0  dropped 304748  overruns 0  frame 0
        TX packets 764121  bytes 104130397 (99.3 MiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

eth0:1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 10.0.0.102  netmask 255.255.255.0  broadcast 10.0.0.255
        ether 00:15:5d:80:59:04  txqueuelen 1000  (Ethernet)

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 1000  (Lokale Schleife)
        RX packets 540525  bytes 111292318 (106.1 MiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 540525  bytes 111292318 (106.1 MiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0


root@deb10:~# dpkg -l | grep wiregu
ii  wireguard                             1.0.20210223-1~bpo10+1                  all          fast, modern, secure kernel VPN tunnel (metapackage)
ii  wireguard-dkms                        1.0.20210219-1~bpo10+1                  all          fast, modern, secure kernel VPN tunnel (DKMS version)
ii  wireguard-tools                       1.0.20210223-1~bpo10+1                  amd64        fast, modern, secure kernel VPN tunnel (userland utilities)
Dieses dkms wird automatisch bei apt install wireguard installiert. 

auf dem raspi, funktioniert ifup wg0 , beide config-Dateien (siehe oben) sind tupfegleich. Aber Software von 2020. Die amd64-Version ist von 2021, hat die einen bug?
Auf Raspi;:

Code: Alles auswählen

pi@raspberrypi:~ $ sudo su -
root@raspberrypi:~# dpkg -l | grep wireg
ii  wireguard                            1.0.20200827-1~bpo10+1                  all          fast, modern, secure kernel VPN tunnel (metapackage)
ii  wireguard-tools                      1.0.20200827-1~bpo10+1                  armhf        fast, modern, secure kernel VPN tunnel (userland utilities)

root@raspberrypi:~# ifconfig
[...]
wg0: flags=209<UP,POINTOPOINT,RUNNING,NOARP>  mtu 1420
        inet 10.0.2.1  netmask 255.255.255.0  destination 10.0.2.1
        unspec 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00  txqueuelen 1000  (UNSPEC)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 18  dropped 0 overruns 0  carrier 0  collisions 0
wlan0: [...]
Es scheint auch gar kein /dev/wg0 zu existieren. Auf dem raspi, auf dem das ifup funktioniert, gibts auch kein /dev/wg0 .

Die keys kommen aus dem Web, von einer Anleitung. Also keine Sorge: meine sind das nicht.
Alles nach Anleitung! Debian 10.10 streikt und will das dasd wg0 nicht kennen! Warum?
Danke schon mal
Eckard

@habe vermutlich Fehler selbst gefunden: habe die eth0 und eth0:1 in /etc/network/interfaces eingetragen. Dann werden die Interfaces in /etc/network/interfaces.d/ ignoriert, richtig?

Benutzeravatar
bluestar
Beiträge: 2346
Registriert: 26.10.2004 11:16:34
Wohnort: Rhein-Main-Gebiet

Re: wireguard: ifup wg0 -> "unknown interface".

Beitrag von bluestar » 26.11.2021 09:32:35

Was sagt denn modinfo wireguard auf deinem Server?

mat6937
Beiträge: 2953
Registriert: 09.12.2014 10:44:00

Re: wireguard: ifup wg0 -> "unknown interface".

Beitrag von mat6937 » 26.11.2021 10:01:50

egerlach hat geschrieben: ↑ zum Beitrag ↑
24.11.2021 13:07:32
ich plage mich hier seit einer Stunde mit debian 10.10, recht frisch installiert damit herum, wireguard soll auf debian als Server laufen:
BTW: Wenn Du systemd-Version >/= 237 auf deinen Geräten hast, dann siehe z. B. den Abschnitt "Step 2 - Alternative C - systemd", in https://wiki.debian.org/WireGuard#Step_ ... figuration

Antworten