feat(nasp): switch to systemd-networkd
This commit is contained in:
		
							parent
							
								
									448b6507f1
								
							
						
					
					
						commit
						619b0c998e
					
				| @ -6,7 +6,14 @@ | |||||||
|       ./hardware-configuration.nix |       ./hardware-configuration.nix | ||||||
|       ../modules/nasp.nix |       ../modules/nasp.nix | ||||||
|     ]; |     ]; | ||||||
|   nasp.serial = 2; |   nasp = { | ||||||
|  |     serial = 2; | ||||||
|  |     network = { | ||||||
|  |       eth0Name = "eno1"; | ||||||
|  |       eth1Name = "eno2"; | ||||||
|  |       eth2Name = "enp2s0np0"; | ||||||
|  |     }; | ||||||
|  |   }; | ||||||
|   boot.supportedFilesystems = [ "zfs" ]; |   boot.supportedFilesystems = [ "zfs" ]; | ||||||
|   boot.zfs.forceImportRoot = false; |   boot.zfs.forceImportRoot = false; | ||||||
|   networking.hostId = "b500d22c"; |   networking.hostId = "b500d22c"; | ||||||
|  | |||||||
| @ -2,6 +2,7 @@ | |||||||
| 
 | 
 | ||||||
| let | let | ||||||
|   mainCfg = config.nasp; |   mainCfg = config.nasp; | ||||||
|  |   networkCfg = mainCfg.network; | ||||||
|   hostName = ("g" + (builtins.toString mainCfg.serial)); |   hostName = ("g" + (builtins.toString mainCfg.serial)); | ||||||
|   ipSuffix = (builtins.toString (mainCfg.serial + 100)); |   ipSuffix = (builtins.toString (mainCfg.serial + 100)); | ||||||
|   dnew = (pkgs.writeShellScriptBin "dnew" (builtins.readFile ./scripts/dnew)); |   dnew = (pkgs.writeShellScriptBin "dnew" (builtins.readFile ./scripts/dnew)); | ||||||
| @ -12,6 +13,20 @@ in | |||||||
|       type = lib.types.int; |       type = lib.types.int; | ||||||
|       description = "Serial of the machine (gX)"; |       description = "Serial of the machine (gX)"; | ||||||
|     }; |     }; | ||||||
|  |     network = { | ||||||
|  |       eth0Name = lib.mkOption { | ||||||
|  |         type = lib.types.str; | ||||||
|  |         description = "Name of eth0 (192.168.16.0/24)"; | ||||||
|  |       }; | ||||||
|  |       eth1Name = lib.mkOption { | ||||||
|  |         type = lib.types.str; | ||||||
|  |         description = "Name of eth1 (thunet)"; | ||||||
|  |       }; | ||||||
|  |       eth2Name = lib.mkOption { | ||||||
|  |         type = lib.types.str; | ||||||
|  |         description = "Name of the RoCE NIC"; | ||||||
|  |       }; | ||||||
|  |     }; | ||||||
|   }; |   }; | ||||||
| 
 | 
 | ||||||
|   # inplementation |   # inplementation | ||||||
| @ -40,41 +55,45 @@ in | |||||||
|   ## networking |   ## networking | ||||||
|   networking.nameservers = [ "192.168.16.118" ]; |   networking.nameservers = [ "192.168.16.118" ]; | ||||||
|   services.resolved.enable = true; |   services.resolved.enable = true; | ||||||
|   networking.networkmanager.enable = true; |   networking.networkmanager.enable = false; | ||||||
|   networking.interfaces = { |   networking.useDHCP = false; | ||||||
|     eno1.wakeOnLan.enable = true; |   systemd.network.enable = true; | ||||||
|     eno1.useDHCP = true; |   systemd.network.networks."10-eth0" = { | ||||||
|     eno1.ipv4 = { |     matchConfig.Name = networkCfg.eth0Name; | ||||||
|       addresses = [ |     networkConfig = { | ||||||
|         { |       DHCP = "no"; | ||||||
|           address = "192.168.16.${ipSuffix}"; |       IPv6AcceptRA = true; | ||||||
|           prefixLength = 24; |  | ||||||
|         } |  | ||||||
|       ]; |  | ||||||
|       routes = [ |  | ||||||
|         { |  | ||||||
|           address = "0.0.0.0"; |  | ||||||
|           prefixLength = 0; |  | ||||||
|           via = "192.168.16.118"; |  | ||||||
|           options = { metric = "90"; }; |  | ||||||
|         } |  | ||||||
|       ]; |  | ||||||
|     }; |     }; | ||||||
|     eno1.ipv6.routes = [ |     address = [ "192.168.16.${ipSuffix}/24" ]; | ||||||
|  |     routes = [ | ||||||
|       { |       { | ||||||
|         address = "::"; |         routeConfig = { | ||||||
|         prefixLength = 0; |           Gateway = "192.168.16.118"; | ||||||
|         via = "fe80::2eea:7fff:feec:4689"; |           GatewayOnLink = true; | ||||||
|         options = { metric = "90"; }; |           Metric = 90; | ||||||
|  |         }; | ||||||
|       } |       } | ||||||
|     ]; |  | ||||||
|     enp2s0np0.ipv4.addresses = [ |  | ||||||
|       { |       { | ||||||
|         address = "12.12.12.${ipSuffix}"; |         routeConfig = { | ||||||
|         prefixLength = 24; |           Gateway = "2001:da8:bf:300::1"; | ||||||
|  |           GatewayOnLink = true; | ||||||
|  |           Metric = 90; | ||||||
|  |         }; | ||||||
|       } |       } | ||||||
|     ]; |     ]; | ||||||
|   }; |   }; | ||||||
|  |   systemd.network.networks."10-eth1" = { | ||||||
|  |     matchConfig.Name = networkCfg.eth1Name; | ||||||
|  |     networkConfig = { | ||||||
|  |       DHCP = "yes"; | ||||||
|  |       IPv6AcceptRA = true; | ||||||
|  |     }; | ||||||
|  |   }; | ||||||
|  |   systemd.network.networks."10-eth2" = { | ||||||
|  |     matchConfig.Name = networkCfg.eth2Name; | ||||||
|  |     address = [ "12.12.12.${ipSuffix}/24" ]; | ||||||
|  |   }; | ||||||
|  |   networking.interfaces.eno1.wakeOnLan.enable = true; | ||||||
|   networking.extraHosts = '' |   networking.extraHosts = '' | ||||||
|     192.168.16.101 g1-nasp g1 |     192.168.16.101 g1-nasp g1 | ||||||
|     192.168.16.102 g2-nasp g2 |     192.168.16.102 g2-nasp g2 | ||||||
| @ -106,7 +125,7 @@ in | |||||||
|   }; |   }; | ||||||
|   networking.rxe = { |   networking.rxe = { | ||||||
|     enable = true; |     enable = true; | ||||||
|     interfaces = [ "enp2s0np0" ]; |     interfaces = [ "${networkCfg.eth2Name}" ]; | ||||||
|   }; |   }; | ||||||
|   ## packages and services |   ## packages and services | ||||||
|   nixpkgs.config.allowUnfree = true; |   nixpkgs.config.allowUnfree = true; | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user