Corrections problèmes réseaux

merge-requests/21/head
pigeonmoelleux 2025-06-25 16:57:50 +02:00
parent 89ae1f5475
commit 644216378f
No known key found for this signature in database
GPG Key ID: B3BE02E379E6E8E2
1 changed files with 24 additions and 46 deletions

View File

@ -72,18 +72,21 @@ in
};
config = mkIf cfg.enable {
networking =
{
networking = {
useDHCP = false;
firewall.enable = lib.mkDefault false;
nameservers = [ "172.16.10.128" ];
}
//
# Configuration du VLAN adm
interfaces =
lib.attrsets.mapAttrs'
(interface: conf: {
name = cfg."${interface}".interface;
value = conf;
})
(
if cfg.adm.enable then
{
interfaces."${cfg.adm.interface}" = {
lib.attrsets.filterAttrs (interface: _: cfg."${interface}".enable) {
# Configuration du VLAN adm
adm = {
ipv4.addresses = [
{
address = "172.16.10.1${cfg.id}";
@ -98,18 +101,9 @@ in
}
];
};
}
else
{ }
)
//
# Configuration du VLAN srv
(
if cfg.srv.enable then
{
firewall.enable = true;
interfaces."${cfg.srv.interface}" = {
# Configuration du VLAN srv
srv = {
ipv4 = {
addresses = [
{
@ -141,17 +135,9 @@ in
];
};
};
}
else
{ }
)
//
# Configuration du VLAN srv-nat
(
if cfg.srvNat.enable then
{
interfaces."${cfg.srvNat.interface}" = {
srvNat = {
ipv4 = {
addresses = [
{
@ -184,16 +170,9 @@ in
];
};
};
}
else
{ }
)
//
# Configuration du VLAN san
(
if cfg.san.enable then
{
interfaces."${cfg.san.interface}" = {
san = {
ipv4.addresses = [
{
address = "172.16.4.1${cfg.id}";
@ -209,8 +188,7 @@ in
];
};
}
else
{ }
);
};
};
}