Skip to content

Commit

Permalink
Merge pull request #270 from barrucadu/nya/networking
Browse files Browse the repository at this point in the history
[nyarlathotep] Netwoking changes for thing-doer
  • Loading branch information
barrucadu authored Mar 10, 2024
2 parents eba463d + 6a82c57 commit f40a447
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions hosts/nyarlathotep/configuration.nix
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,31 @@ in
nixfiles.eraseYourDarlings.barrucaduPasswordFile = config.sops.secrets."users/barrucadu".path;
sops.secrets."users/barrucadu".neededForUsers = true;

# Set up a bridge network so that VMs can connect to the LAN
#
# `enp8s0` is the physical ethernet interface, but I am slaving that to the
# `br0` bridge - so it's the bridge's MAC address that gets presented to the
# physical network.
#
# To avoid having to reconfigure static IP assignments in my router if I
# switch between bridged and non-bridged networking, set up the MAC addresses
# such that:
#
# - `br0` has the MAC address of the physical ethernet card
# - `enp8s0` has a new random MAC address (https://serverfault.com/a/631119)
#
# So if I delete this block, the MAC address the router sees is unchanged, and
# so the static IP assignment is unaffected.
networking.useDHCP = false;
networking.interfaces.br0 = {
useDHCP = true;
macAddress = "a0:36:bc:bb:65:8d";
};
networking.interfaces.enp8s0 = {
macAddress = "92:0b:e6:21:86:99";
useDHCP = true;
};
networking.bridges.br0.interfaces = [ "enp8s0" ];

###############################################################################
## Backups
Expand Down Expand Up @@ -90,6 +115,7 @@ in
###############################################################################

nixfiles.resolved.enable = true;
nixfiles.resolved.address = "10.0.0.3:53";
nixfiles.resolved.cacheSize = 1000000;
nixfiles.resolved.hostsDirs = [ "/etc/dns/hosts" ];
nixfiles.resolved.zonesDirs = [ "/etc/dns/zones" ];
Expand Down

0 comments on commit f40a447

Please sign in to comment.