diff --git a/NEWS b/NEWS
index 8e5ae59119..04c45ecee6 100644
--- a/NEWS
+++ b/NEWS
@@ -305,6 +305,16 @@ CHANGES WITH 255 in spe:
link-local addressing if ip=link-local is specified on the kernel
command line.
+ * The prefix of the configuration files generated by the network
+ generator from the kernel command line is now prefixed with '70-',
+ to make them have higher precedence over the default configuration
+ files.
+
+ * Added -Ddefault-network=BOOL meson option, to make install more
+ default .network files, which match more generic setups, e.g.
+ 89-ethernet.network matches all Ethernet interfaces and enables both
+ DHCPv4 and DHCPv6 clients.
+
Changes in systemd-analyze:
* "systemd-analyze plot" has gained tooltips on each unit name with
diff --git a/man/systemd.link.xml b/man/systemd.link.xml
index 62578f48e4..b75dc7fcd4 100644
--- a/man/systemd.link.xml
+++ b/man/systemd.link.xml
@@ -40,8 +40,8 @@
/etc/systemd/network. All configuration files are collectively sorted and
processed in alphanumeric order, regardless of the directories in which they live. However, files
with identical filenames replace each other. It is recommended that each filename is prefixed with
- a number (e.g. 10-eth0.link). Otherwise, the default
- .link files or those generated by
+ a number smaller than 70 (e.g. 10-eth0.link). Otherwise, the
+ default .link files or those generated by
systemd-network-generator.service8
may take precedence over user configured files. Files in /etc/ have the
highest priority, files in /run/ take precedence over files with the same name
diff --git a/man/systemd.netdev.xml b/man/systemd.netdev.xml
index 3f1b18b2af..2d3e575a8b 100644
--- a/man/systemd.netdev.xml
+++ b/man/systemd.netdev.xml
@@ -46,8 +46,8 @@
/etc/systemd/network. All configuration files are collectively sorted and
processed in alphanumeric order, regardless of the directories in which they live. However, files
with identical filenames replace each other. It is recommended that each filename is prefixed with
- a number (e.g. 10-vlan.netdev). Otherwise, .netdev files
- generated by
+ a number smaller than 70 (e.g. 10-vlan.netdev). Otherwise,
+ .netdev files generated by
systemd-network-generator.service8
may take precedence over user configured files. Files in /etc/ have the
highest priority, files in /run/ take precedence over files with the same name
diff --git a/man/systemd.network.xml b/man/systemd.network.xml
index 55a5a2ec1c..ece60926c7 100644
--- a/man/systemd.network.xml
+++ b/man/systemd.network.xml
@@ -44,8 +44,8 @@
/etc/systemd/network. All configuration files are collectively sorted and
processed in alphanumeric order, regardless of the directories in which they live. However, files
with identical filenames replace each other. It is recommended that each filename is prefixed with
- a number (e.g. 10-eth0.network). Otherwise, the default
- .network files or those generated by
+ a number smaller than 70 (e.g. 10-eth0.network). Otherwise, the
+ default .network files or those generated by
systemd-network-generator.service8
may take precedence over user configured files. Files in /etc/ have the highest
priority, files in /run/ take precedence over files with the same name under
diff --git a/meson_options.txt b/meson_options.txt
index c31e3cd4d7..83b1f81214 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -130,6 +130,8 @@ option('homed', type : 'feature', deprecated : { 'true' : 'enabled', 'false' : '
description : 'install the systemd-homed stack')
option('networkd', type : 'boolean',
description : 'install the systemd-networkd stack')
+option('default-network', type : 'boolean', value : true,
+ description : 'install default .network files')
option('timedated', type : 'boolean',
description : 'install the systemd-timedated daemon')
option('timesyncd', type : 'boolean',
diff --git a/network/80-auto-link-local.network.example b/network/80-auto-link-local.network.example
index 7f6a14ac41..286b532496 100644
--- a/network/80-auto-link-local.network.example
+++ b/network/80-auto-link-local.network.example
@@ -16,6 +16,5 @@ Property=ID_NET_AUTO_LINK_LOCAL_ONLY=1
[Network]
LinkLocalAddressing=yes
-DHCP=no
IPv6AcceptRA=no
MulticastDNS=yes
diff --git a/network/80-container-ve.network b/network/80-container-ve.network
index d295d131aa..5e94041be6 100644
--- a/network/80-container-ve.network
+++ b/network/80-container-ve.network
@@ -27,4 +27,5 @@ DHCPServer=yes
IPMasquerade=both
LLDP=yes
EmitLLDP=customer-bridge
+IPv6AcceptRA=no
IPv6SendRA=yes
diff --git a/network/80-container-vz.network b/network/80-container-vz.network
index 7d902e78bd..a8b4d462a0 100644
--- a/network/80-container-vz.network
+++ b/network/80-container-vz.network
@@ -26,4 +26,5 @@ DHCPServer=yes
IPMasquerade=both
LLDP=yes
EmitLLDP=customer-bridge
+IPv6AcceptRA=no
IPv6SendRA=yes
diff --git a/network/80-vm-vt.network b/network/80-vm-vt.network
index 7979871e2c..a58f753cfc 100644
--- a/network/80-vm-vt.network
+++ b/network/80-vm-vt.network
@@ -26,4 +26,5 @@ DHCPServer=yes
IPMasquerade=both
LLDP=yes
EmitLLDP=customer-bridge
+IPv6AcceptRA=no
IPv6SendRA=yes
diff --git a/network/80-wifi-adhoc.network b/network/80-wifi-adhoc.network
index d7a341d018..fd3faca60c 100644
--- a/network/80-wifi-adhoc.network
+++ b/network/80-wifi-adhoc.network
@@ -17,3 +17,5 @@ WLANInterfaceType=ad-hoc
[Network]
LinkLocalAddressing=yes
+IPv6AcceptRA=no
+MulticastDNS=yes
diff --git a/network/80-wifi-ap.network.example b/network/80-wifi-ap.network.example
index 6ea1024312..09de9192d7 100644
--- a/network/80-wifi-ap.network.example
+++ b/network/80-wifi-ap.network.example
@@ -17,3 +17,5 @@ WLANInterfaceType=ap
Address=0.0.0.0/24
DHCPServer=yes
IPMasquerade=both
+IPv6AcceptRA=no
+IPv6SendRA=yes
diff --git a/network/80-ethernet.network.example b/network/89-ethernet.network.example
similarity index 100%
rename from network/80-ethernet.network.example
rename to network/89-ethernet.network.example
diff --git a/network/meson.build b/network/meson.build
index b6745298f6..b343bf6ad3 100644
--- a/network/meson.build
+++ b/network/meson.build
@@ -1,22 +1,41 @@
# SPDX-License-Identifier: LGPL-2.1-or-later
if conf.get('ENABLE_NETWORKD') == 1
- install_data('80-6rd-tunnel.network',
- '80-container-host0.network',
- '80-container-vb.network',
- '80-container-ve.network',
- '80-container-vz.network',
- '80-ethernet.network.example',
- '80-vm-vt.network',
- '80-wifi-adhoc.network',
- '80-wifi-ap.network.example',
- '80-wifi-station.network.example',
- install_dir : networkdir)
+ install_data(
+ '80-6rd-tunnel.network',
+ '80-container-host0.network',
+ '80-container-vb.network',
+ '80-container-ve.network',
+ '80-container-vz.network',
+ '80-vm-vt.network',
+ '80-wifi-adhoc.network',
+ install_dir : networkdir)
- if install_sysconfdir
- install_emptydir(sysconfdir / 'systemd/network')
+ example_network_files = files(
+ '80-auto-link-local.network.example',
+ '89-ethernet.network.example',
+ '80-wifi-ap.network.example',
+ '80-wifi-station.network.example',
+ )
+
+ if get_option('default-network')
+ foreach f : example_network_files
+ install_data(
+ f,
+ rename : fs.replace_suffix(f, ''),
+ install_dir : networkdir)
+ endforeach
+ else
+ install_data(
+ example_network_files,
+ install_dir : networkdir)
endif
+
endif
install_data('99-default.link',
install_dir : networkdir)
+
+if install_sysconfdir
+ install_emptydir(sysconfdir / 'systemd/network')
+endif
diff --git a/src/network/generator/main.c b/src/network/generator/main.c
index 3456fc4cf8..0439a9d769 100644
--- a/src/network/generator/main.c
+++ b/src/network/generator/main.c
@@ -33,7 +33,7 @@ static int network_save(Network *network, const char *dest_dir) {
if (asprintf(&p, "%s/%s-%s.network",
dest_dir,
- isempty(network->ifname) ? "91" : "90",
+ isempty(network->ifname) ? "71" : "70",
isempty(network->ifname) ? "default" : network->ifname) < 0)
return log_oom();
@@ -59,7 +59,7 @@ static int netdev_save(NetDev *netdev, const char *dest_dir) {
netdev_dump(netdev, f);
- if (asprintf(&p, "%s/90-%s.netdev", dest_dir, netdev->ifname) < 0)
+ if (asprintf(&p, "%s/70-%s.netdev", dest_dir, netdev->ifname) < 0)
return log_oom();
r = conservative_rename(temp_path, p);
@@ -86,7 +86,7 @@ static int link_save(Link *link, const char *dest_dir) {
if (asprintf(&p, "%s/%s-%s.link",
dest_dir,
- !isempty(link->ifname) ? "90" : !hw_addr_is_null(&link->mac) ? "91" : "92",
+ !isempty(link->ifname) ? "70" : !hw_addr_is_null(&link->mac) ? "71" : "72",
link->filename) < 0)
return log_oom();
diff --git a/test/test-network-generator-conversion/test-01-dhcp.expected/91-default.network b/test/test-network-generator-conversion/test-01-dhcp.expected/71-default.network
similarity index 100%
rename from test/test-network-generator-conversion/test-01-dhcp.expected/91-default.network
rename to test/test-network-generator-conversion/test-01-dhcp.expected/71-default.network
diff --git a/test/test-network-generator-conversion/test-02-bridge.expected/90-bridge99.netdev b/test/test-network-generator-conversion/test-02-bridge.expected/70-bridge99.netdev
similarity index 100%
rename from test/test-network-generator-conversion/test-02-bridge.expected/90-bridge99.netdev
rename to test/test-network-generator-conversion/test-02-bridge.expected/70-bridge99.netdev
diff --git a/test/test-network-generator-conversion/test-02-bridge.expected/90-bridge99.network b/test/test-network-generator-conversion/test-02-bridge.expected/70-bridge99.network
similarity index 100%
rename from test/test-network-generator-conversion/test-02-bridge.expected/90-bridge99.network
rename to test/test-network-generator-conversion/test-02-bridge.expected/70-bridge99.network
diff --git a/test/test-network-generator-conversion/test-02-bridge.expected/90-eth0.network b/test/test-network-generator-conversion/test-02-bridge.expected/70-eth0.network
similarity index 100%
rename from test/test-network-generator-conversion/test-02-bridge.expected/90-eth0.network
rename to test/test-network-generator-conversion/test-02-bridge.expected/70-eth0.network
diff --git a/test/test-network-generator-conversion/test-02-bridge.expected/90-eth1.network b/test/test-network-generator-conversion/test-02-bridge.expected/70-eth1.network
similarity index 100%
rename from test/test-network-generator-conversion/test-02-bridge.expected/90-eth1.network
rename to test/test-network-generator-conversion/test-02-bridge.expected/70-eth1.network
diff --git a/test/test-network-generator-conversion/test-03-issue-14319.expected/90-enp3s0.network b/test/test-network-generator-conversion/test-03-issue-14319.expected/70-enp3s0.network
similarity index 100%
rename from test/test-network-generator-conversion/test-03-issue-14319.expected/90-enp3s0.network
rename to test/test-network-generator-conversion/test-03-issue-14319.expected/70-enp3s0.network