mirror of
https://github.com/ryan4yin/nix-config.git
synced 2026-07-04 20:11:38 +02:00
feat: idols-ai - set ipv6 routes & link-local address
This commit is contained in:
@@ -6,6 +6,11 @@
|
|||||||
#############################################################
|
#############################################################
|
||||||
let
|
let
|
||||||
hostName = "ai"; # Define your hostname.
|
hostName = "ai"; # Define your hostname.
|
||||||
|
|
||||||
|
inherit (myvars.networking) defaultGateway defaultGateway6 nameservers;
|
||||||
|
inherit (myvars.networking.hostsAddr.${hostName}) iface ipv4 ipv6;
|
||||||
|
ipv4WithMask = "${ipv4}/24";
|
||||||
|
ipv6WithMask = "${ipv6}/64";
|
||||||
in {
|
in {
|
||||||
imports = [
|
imports = [
|
||||||
./netdev-mount.nix
|
./netdev-mount.nix
|
||||||
@@ -19,13 +24,38 @@ in {
|
|||||||
|
|
||||||
networking = {
|
networking = {
|
||||||
inherit hostName;
|
inherit hostName;
|
||||||
inherit (myvars.networking) defaultGateway nameservers;
|
|
||||||
inherit (myvars.networking.hostsInterface.${hostName}) interfaces;
|
|
||||||
|
|
||||||
# desktop need its cli for status bar
|
# desktop need its cli for status bar & wifi network.
|
||||||
networkmanager.enable = true;
|
networkmanager.enable = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
networking.useNetworkd = true;
|
||||||
|
systemd.network.enable = true;
|
||||||
|
|
||||||
|
# Add ipv4 address to the bridge.
|
||||||
|
systemd.network.networks."10-${iface}" = {
|
||||||
|
matchConfig.Name = [iface];
|
||||||
|
networkConfig = {
|
||||||
|
DHCP = "ipv6"; # enable DHCPv6 only, so we can get a GUA.
|
||||||
|
Address = [ipv4WithMask ipv6WithMask];
|
||||||
|
DNS = nameservers;
|
||||||
|
IPv6AcceptRA = true;
|
||||||
|
LinkLocalAddressing = "ipv6";
|
||||||
|
};
|
||||||
|
routes = [
|
||||||
|
{
|
||||||
|
Destination = "0.0.0.0/0";
|
||||||
|
Gateway = defaultGateway;
|
||||||
|
}
|
||||||
|
{
|
||||||
|
Destination = "::/0";
|
||||||
|
Gateway = defaultGateway6;
|
||||||
|
GatewayOnLink = true; # it's a gateway on local link.
|
||||||
|
}
|
||||||
|
];
|
||||||
|
linkConfig.RequiredForOnline = "routable";
|
||||||
|
};
|
||||||
|
|
||||||
# conflict with feature: containerd-snapshotter
|
# conflict with feature: containerd-snapshotter
|
||||||
# virtualisation.docker.storageDriver = "btrfs";
|
# virtualisation.docker.storageDriver = "btrfs";
|
||||||
|
|
||||||
|
|||||||
@@ -1,11 +1,17 @@
|
|||||||
{lib}: rec {
|
{lib}: rec {
|
||||||
mainGateway = "192.168.5.1"; # main router
|
mainGateway = "192.168.5.1"; # main router
|
||||||
|
mainGateway6 = "fe80::5"; # main router's link-local address
|
||||||
# use suzi as the default gateway
|
# use suzi as the default gateway
|
||||||
# it's a subrouter with a transparent proxy
|
# it's a subrouter with a transparent proxy
|
||||||
defaultGateway = "192.168.5.178";
|
defaultGateway = "192.168.5.178";
|
||||||
|
defaultGateway6 = "fe80::8";
|
||||||
nameservers = [
|
nameservers = [
|
||||||
|
# IPv4
|
||||||
"119.29.29.29" # DNSPod
|
"119.29.29.29" # DNSPod
|
||||||
"223.5.5.5" # AliDNS
|
"223.5.5.5" # AliDNS
|
||||||
|
# IPv6
|
||||||
|
"2400:3200::1" # Alidns
|
||||||
|
"2606:4700:4700::1111" # Cloudflare
|
||||||
];
|
];
|
||||||
prefixLength = 24;
|
prefixLength = 24;
|
||||||
|
|
||||||
@@ -33,6 +39,7 @@
|
|||||||
# Desktop PC
|
# Desktop PC
|
||||||
iface = "enp5s0";
|
iface = "enp5s0";
|
||||||
ipv4 = "192.168.5.100";
|
ipv4 = "192.168.5.100";
|
||||||
|
ipv6 = "fe80::10"; # Link-local Address
|
||||||
};
|
};
|
||||||
aquamarine = {
|
aquamarine = {
|
||||||
# VM
|
# VM
|
||||||
@@ -79,6 +86,7 @@
|
|||||||
suzi = {
|
suzi = {
|
||||||
iface = "enp2s0"; # fake iface, it's not used by the host
|
iface = "enp2s0"; # fake iface, it's not used by the host
|
||||||
ipv4 = "192.168.5.178";
|
ipv4 = "192.168.5.178";
|
||||||
|
ipv6 = "fe80::8"; # Link-local Address, can be used as default gateway
|
||||||
};
|
};
|
||||||
mitsuha = {
|
mitsuha = {
|
||||||
iface = "enp2s0"; # fake iface, it's not used by the host
|
iface = "enp2s0"; # fake iface, it's not used by the host
|
||||||
|
|||||||
Reference in New Issue
Block a user