make a little service to start the VPN only after network is connected to hopefully fix the VPN blocking wifi on shodan issue
This commit is contained in:
parent
d7ae543cc2
commit
e6c6bd012f
1 changed files with 18 additions and 1 deletions
|
@ -188,6 +188,23 @@
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
systemd.services."start-vpn-wg" =
|
||||||
|
if config.services.vpn-ip.enable
|
||||||
|
then {
|
||||||
|
path = with pkgs; [systemd];
|
||||||
|
enable = true;
|
||||||
|
unitConfig = {
|
||||||
|
Wants = "network-online.target";
|
||||||
|
After = "network-online.target";
|
||||||
|
};
|
||||||
|
serviceConfig = {
|
||||||
|
Type = "oneshot";
|
||||||
|
ExecStart = "${pkgs.systemd}/bin/systemctl start wg-quick-wg0.service";
|
||||||
|
RemainAfterExit = "yes";
|
||||||
|
};
|
||||||
|
}
|
||||||
|
else {};
|
||||||
|
|
||||||
networking =
|
networking =
|
||||||
if config.services.vpn-ip.enable
|
if config.services.vpn-ip.enable
|
||||||
then {
|
then {
|
||||||
|
@ -195,7 +212,7 @@
|
||||||
|
|
||||||
wg-quick.interfaces = {
|
wg-quick.interfaces = {
|
||||||
wg0 = {
|
wg0 = {
|
||||||
autostart = true;
|
autostart = false;
|
||||||
address = ["10.0.0.${config.services.vpn-ip.ip}/24" "fdc9:281f:04d7:9ee9::${config.services.vpn-ip.ip}/64"];
|
address = ["10.0.0.${config.services.vpn-ip.ip}/24" "fdc9:281f:04d7:9ee9::${config.services.vpn-ip.ip}/64"];
|
||||||
dns = ["10.0.0.1" "fdc9:281f:04d7:9ee9::1"];
|
dns = ["10.0.0.1" "fdc9:281f:04d7:9ee9::1"];
|
||||||
listenPort = 51821;
|
listenPort = 51821;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue