Skip to content

How to start a script at startup? #253

Description

@MatejKovacic

I am trying to run Wireguard VPN to my server.

I created /etc/wireguard/wg0.conf with:

[Interface]
PrivateKey = ****

[Peer]
PublicKey = ****
PresharedKey = ****
Endpoint = xx.xx.xx.xx:51194
AllowedIPs = x.x.x.0/24
PersistentKeepalive = 5

Then I run:

ip link add dev wg0 type wireguard
wg setconf wg0 /etc/wireguard/wg0.conf
ip addr add x.x.x.x/32 dev wg0
ip link set up dev wg0
ip route add x.x.x.0/24 dev wg0

This works fine. But how can I start my VPN automatically at startup (reboot)?

There is no system, crontab, if I put these commands to /etc/rc.local they do not run, also if I create /etc/init.d/S99wireguard this doesn't run.

Any help?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions