Creating tun interface via systemd

Kernels & Hardware, configuring network, installing services

Creating tun interface via systemd

Postby lshl » 2020-05-12 09:37

Hello,
First a bit of background: I am trying to create a VPN over ssh (-w).
I am successful using ifconfig, and now I am trying to automate things a bit.

This is under /etc/systemd/network/vpn.netdev:
Code: Select all
[NetDev]
Name=tun5
Kind=tun

[Tun]


My current issue is, while creating the tun interface using ifconfig, I am getting the following:
Code: Select all
# ifconfig tun5 192.168.244.5 pointopoint 192.168.244.7 netmask 255.255.255.0
# ifconfig
tun5: flags=4241<UP,POINTOPOINT,NOARP,MULTICAST>  mtu 1500
        inet 192.168.244.5  netmask 255.255.255.0  destination 192.168.244.7
        unspec 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00  txqueuelen 500  (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 0  dropped 0 overruns 0  carrier 0  collisions 0


Whereas if I use /etc/systemd/network/vpn.network:
Code: Select all
[Match]
Name=tun5

[Network]
Description=Incoming connections from my network
Address=192.168.244.5/24
IPForward=ipv4

[Address]
Address=192.168.244.5/24
Peer=192.168.244.7/24


I get:
Code: Select all
tun5: flags=4241<UP,POINTOPOINT,NOARP,MULTICAST>  mtu 1500
        unspec 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00  txqueuelen 500  (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 0  dropped 0 overruns 0  carrier 0  collisions 0


Any help or suggestions would be appreciated.
lshl
 
Posts: 2
Joined: 2020-05-12 03:12

Re: Creating tun interface via systemd

Postby Head_on_a_Stick » 2020-05-12 17:59

Have you enabled (and started) systemd-networkd?
Black Lives Matter

Debian buster-backports ISO image: for new hardware support
User avatar
Head_on_a_Stick
 
Posts: 12744
Joined: 2014-06-01 17:46
Location: /dev/chair

Re: Creating tun interface via systemd

Postby lshl » 2020-05-14 02:10

Head_on_a_Stick wrote:Have you enabled (and started) systemd-networkd?

:D

Well, sorry for that, I just assumed it was enabled by default.
Still having a bit of coping struggles understanding systemd.
Problem solved :) .
lshl
 
Posts: 2
Joined: 2020-05-12 03:12


Return to System configuration

Who is online

Users browsing this forum: No registered users and 21 guests

fashionable