Creating tun interface via systemd

Kernels, Network, and Services configuration
Post Reply
Message
Author
lshl
Posts: 2
Joined: 2020-05-12 03:12

Creating tun interface via systemd

#1 Post by lshl »

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.

User avatar
Head_on_a_Stick
Posts: 13450
Joined: 2014-06-01 17:46
Location: /dev/chair

Re: Creating tun interface via systemd

#2 Post by Head_on_a_Stick »

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

Debian buster-backports ISO image: for new hardware support

lshl
Posts: 2
Joined: 2020-05-12 03:12

Re: Creating tun interface via systemd

#3 Post by lshl »

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 :) .

Post Reply