-
-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #36 from sebastianrakel/routes
Add possibility to define routes
- Loading branch information
Showing
4 changed files
with
81 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,6 +14,7 @@ | |
# @param description an optional string that will be added to the wireguard network interface | ||
# @param mtu configure the MTU (maximum transision unit) for the wireguard tunnel. By default linux will figure this out. You might need to lower it if you're connection through a DSL line. MTU needs to be equal on both tunnel endpoints | ||
# @param peers is an array of struct (Wireguard::Peers) for multiple peers | ||
# @param routes different routes for the systemd-networkd configuration | ||
# | ||
# @author Tim Meusel <[email protected]> | ||
# @author Sebastian Rakel <[email protected]> | ||
|
@@ -87,6 +88,7 @@ | |
Optional[String[1]] $description = undef, | ||
Optional[Integer[1280, 9000]] $mtu = undef, | ||
Optional[String[1]] $public_key = undef, | ||
Array[Hash[String[1], Variant[String[1], Boolean]]] $routes = [], | ||
) { | ||
require wireguard | ||
|
@@ -155,8 +157,14 @@ | |
require => File["/etc/wireguard/${interface}"], | ||
} | ||
$network_epp_params = { | ||
'interface' => $interface, | ||
'addresses' => $addresses, | ||
'routes' => $routes, | ||
} | ||
systemd::network { "${interface}.network": | ||
content => epp("${module_name}/network.epp", { 'interface' => $interface, 'addresses' => $addresses }), | ||
content => epp("${module_name}/network.epp", $network_epp_params), | ||
restart_service => true, | ||
owner => 'root', | ||
group => 'systemd-network', | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# THIS FILE IS MANAGED BY PUPPET | ||
# based on https://dn42.dev/howto/wireguard | ||
[Match] | ||
Name=as1234 | ||
|
||
[Network] | ||
DHCP=no | ||
IPv6AcceptRA=false | ||
IPForward=yes | ||
|
||
# for networkd >= 244 KeepConfiguration stops networkd from | ||
# removing routes on this interface when restarting | ||
KeepConfiguration=yes | ||
|
||
[Address] | ||
Address=192.0.2.1/24 | ||
|
||
[Route] | ||
Gateway=192.0.2.2 | ||
GatewayOnLink=true | ||
Destination=192.0.3.0/24 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters