nixos-demo/virtualmachines/network.nix

33 lines
894 B
Nix
Raw Normal View History

{ config, lib, ... }:
{
networking.usePredictableInterfaceNames = false;
systemd.network.networks."10-lan" = {
enable = lib.mkDefault true;
address = [ "${config.beancloud.network.address}/32" ];
routes = [
{
# A route to the host
Destination = "192.168.101.1/32";
GatewayOnLink = true;
}
{
# Default route
Destination = "0.0.0.0/0";
Gateway = "192.168.101.1";
GatewayOnLink = true;
}
];
matchConfig.Name = [ "${config.beancloud.network.interface.lan}" ];
linkConfig.RequiredForOnline = lib.mkDefault "routable";
networkConfig = {
DHCP = "no";
IPv6AcceptRA = false;
DNS = [
"9.9.9.9" # https://www.quad9.net/service/service-addresses-and-features
"2620:fe::fe" # https://www.quad9.net/service/service-addresses-and-features
];
};
};
}