configure remote wake on lan and ipv6
This commit is contained in:
@@ -5,30 +5,43 @@
|
||||
...
|
||||
}:
|
||||
{
|
||||
systemd.services."wol@$${config.my.lanInterface}" = {
|
||||
description = "Wake-on-LAN for ${config.my.lanInterface}";
|
||||
systemd.services."wol${config.my.laninterface}" = {
|
||||
description = "Wake-on-LAN for ${config.my.laninterface}";
|
||||
after = [ "network.target" ];
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
serviceConfig = {
|
||||
Type = "oneshot";
|
||||
ExecStart = "${pkgs.ethtool}/bin/ethtool -s ${config.my.lanInterface} wol g";
|
||||
ExecStart = "${pkgs.ethtool}/bin/ethtool -s ${config.my.laninterface} wol g";
|
||||
RandomizedDelaySec = "30s";
|
||||
};
|
||||
};
|
||||
environment.systemPackages = [ pkgs.ethtool ];
|
||||
|
||||
boot.initrd.network = {
|
||||
enable = true;
|
||||
ssh = {
|
||||
my.wolipv6address = "2a01:e0a:9cc:99d0:8f3a:6b2c:41d7:e9f5";
|
||||
|
||||
boot.initrd = {
|
||||
network = {
|
||||
enable = true;
|
||||
port = 2222;
|
||||
authorizedKeys = [
|
||||
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIAKMJ3TkEmRQcX7RQijNa2km6a2xXJk6M6FERh7C9nTJ"
|
||||
]; # ta clé publique
|
||||
hostKeys = [ "/etc/ssh/ssh_host_ed25519_key" ];
|
||||
ssh = {
|
||||
enable = true;
|
||||
port = 65234;
|
||||
authorizedKeys = [
|
||||
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIJ2+PXfG/37rsvcVr2RAHzXmGHMr8+8iBH//1YS+zWd3"
|
||||
]; # ta clé publique
|
||||
hostKeys = [ "/etc/ssh/ssh_host_ed25519_key" ];
|
||||
};
|
||||
postCommands = ''
|
||||
ip -6 addr add ${config.my.wolipv6address}/64 dev ${config.my.laninterface}
|
||||
ip -6 route add default via fe80::224:d4ff:fea5:65bd dev ${config.my.laninterface}
|
||||
'';
|
||||
};
|
||||
availableKernelModules = [ "r8169" ];
|
||||
|
||||
};
|
||||
|
||||
boot = {
|
||||
kernelParams = [
|
||||
"ip=${config.my.ipv4address}::255.255.255.0:${config.my.ipv4gateway}:${hostname}:${config.my.laninterface}:off"
|
||||
];
|
||||
};
|
||||
boot.kernelParams = [
|
||||
"ip=192.168.0.2::192.168.0.254:255.255.255.0:${hostname}:${config.my.lanInterface}:off"
|
||||
];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user