Faber38
November 21, 2025, 7:49am
1
if I try to set up a VLAN10 in the configuration.nix …the enp14s0 always gets a DHCP when starting the system, although I think I have deactivated this … here the extract from the configuratio.nix
networking = {
# Hostname und Domain
hostId = "xxxxxxx"; # Eine beliebige 8-stellige Hex-ID
hostName = "nixos"; # Dein Hostname
domain = "xxxxxx"; # Deine Domain
# Verwende systemd-networkd, kein NetworkManager, kein DHCP
useNetworkd = true;
useDHCP = false; # Deaktiviert DHCP für alle Interfaces
# Netzwerkkonfiguration für enp14s0
interfaces.enp14s0.useDHCP = false;
interfaces.enp14s0.ipv4.addresses = [ ]; # Keine statische IP auf enp14s0
# VLAN-Definition für VLAN10 auf enp14s0
vlans = {
vlan10 = {
id = 10;
interface = "enp14s0";
};
};
# Statische IP-Adresse für VLAN10
interfaces.vlan10.ipv4.addresses = [{
address = "192.168.38.x"; # Statische IP für VLAN10
prefixLength = 24;
}];
# Default Gateway über VLAN10
defaultGateway = {
address = "192.168.38.xxx"; # Gateway-Adresse
interface = "vlan10";
};
# Nameserver (DNS)
nameservers = [ "192.168.38.xxx" ]; # Dein DNS-Server
after boot process the enp14s0 always has an IP.
the network is set right only when I start a script…
#!/usr/bin/env bash
Wenn nicht root, dann erneut mit sudo starten
[ “$EUID” -ne 0 ] && exec sudo “$0” “$@”
Variablen
IF=“enp14s0”
VLANIF=“vlan10”
IP=“192.168.38.x/24”
GW=“192.168.38.xxx”
DNS=“192.168.38.xxx”
NixOS-PATH ergänzen, damit “ip” gefunden wird
PATH=/run/current-system/sw/bin:$PATH
echo “[fix-vlan10] Starte Fix…”
VLAN neu setzen
ip addr flush dev “$IF” || true
ip addr flush dev “$VLANIF” || true
ip addr replace “$IP” dev “$VLANIF”
ip route replace default via “$GW” dev “$VLANIF”
DNS setzen
echo “nameserver $DNS” > /etc/resolv.conf
echo “[fix-vlan10] Fertig. $(date)”
what do I do wrong? I want it to work directly without script.
malloc
November 21, 2025, 9:55am
2
It could be an issue with the networking.* configurations. Have you tried using the systemd-networkd related configurations instead? You can find the integrations under systemd.network.*.
Something like should work:
...
systemd.network = {
networks = {
"10-enp14s0" = {
address = [
"192.168.38.x/24"
];
dns = [
"192.168.38.xxx"
];
routes = [
{ Gateway = "192.168.38.xxx" };
];
networkConfig = {
DHCP = "no";
};
matchConfig = {
Name = "enp14s0";
};
vlan = [
"vlan10"
];
};
};
netdevs = {
"20-vlan10" = {
netdevConfig = {
Kind = "vlan";
Name = "vlan10"
};
vlanConfig.Id = 10;
};
};
};
...
Resources
Good luck!
Faber38
November 21, 2025, 10:46am
3
mpfhh … this hasn’t worked… but to deepen the problem… boot new i have the following entries under ip a
[holger@nixos:~]$ ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host noprefixroute
valid_lft forever preferred_lft forever
2: enp14s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
link/ether 10:ff:e0:3f:08:d4 brd ff:ff:ff:ff:ff:ff
altname enx10ffe03f08d4
inet 192.168.38.145/24 metric 1024 brd 192.168.38.255 scope global dynamic enp14s0
valid_lft 86395sec preferred_lft 86395sec
inet6 fe80::12ff:e0ff:fe3f:8d4/64 scope link proto kernel_ll
valid_lft forever preferred_lft forever
3: wlp13s0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN group default qlen 1000
link/ether ec:91:61:26:81:2f brd ff:ff:ff:ff:ff:ff
altname wlxec916126812f
4: vlan10@enp14s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
link/ether 10:ff:e0:3f:08:d4 brd ff:ff:ff:ff:ff:ff
inet 192.168.38.4/24 brd 192.168.38.255 scope global vlan10
valid_lft forever preferred_lft forever
inet6 fe80::12ff:e0ff:fe3f:8d4/64 scope link proto kernel_ll
valid_lft forever preferred_lft forever
you see the enp14s0 also got an IP (automatic) … why? I run the script …see ip a as follows
[holger@nixos:~]$ ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host noprefixroute
valid_lft forever preferred_lft forever
2: enp14s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
link/ether 10:ff:e0:3f:08:d4 brd ff:ff:ff:ff:ff:ff
altname enx10ffe03f08d4
3: wlp13s0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN group default qlen 1000
link/ether ec:91:61:26:81:2f brd ff:ff:ff:ff:ff:ff
altname wlxec916126812f
4: vlan10@enp14s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
link/ether 10:ff:e0:3f:08:d4 brd ff:ff:ff:ff:ff:ff
inet 192.168.38.4/24 scope global vlan10
valid_lft forever preferred_lft forever
no matter what i do, in the configuration.nix…without ip it is right…
Faber38
November 21, 2025, 11:18am
4
every by new boot …
i want DHCP = no
# systemd-networkd Aktivierung
networking.networkmanager.enable = false;
systemd.network.enable = true;
# Netzwerkgeräte und VLAN10 Konfiguration
systemd.network = {
netdevs = {
"20-vlan10" = {
netdevConfig = {
Kind = "vlan"; # VLAN-Interface
Name = "vlan10"; # Interface-Name
};
vlanConfig.Id = 10; # VLAN-ID
};
};
# Netzwerkkonfiguration für VLAN10
networks = {
"30-enp14s0" = {
matchConfig.Name = "enp14s0";
# VLAN-Tagging für enp14s0
vlan = [ "vlan10" ];
# Stellen Sie sicher, dass DHCP für enp14s0 deaktiviert ist
networkConfig.DHCP = "no";
};
# Konfiguration für VLAN10
"40-vlan10" = {
matchConfig.Name = "vlan10";
# IP-Adresse für VLAN10 setzen
address = [ "192.168.38.4/24" ];
# Gateway für VLAN10
routes = [
{ Gateway = "192.168.38.146"; }
];
# DHCP für VLAN10 deaktivieren
networkConfig.DHCP = "no";
# Optional: DNS-Server für VLAN10
dns = [ "192.168.38.146" ];
};
};
};
malloc
November 21, 2025, 7:07pm
5
Try replacing instances of:
systemd.network.networks.<name>.networkConfig.DHCP = "no";
with
systemd.network.networks.<name>.DHCP = "no";
(( not sure why my e-mail replies not going through, wild ))
malloc
November 21, 2025, 3:14pm
6
Try replacing instances of:
systemd.network.networks.<name>.networkConfig.DHCP = "no";
with
systemd.network.networks.<name>.DHCP = "no";