diff --git a/man/systemd.network.xml b/man/systemd.network.xml
index ae82ae7e02..146401f6c9 100644
--- a/man/systemd.network.xml
+++ b/man/systemd.network.xml
@@ -1614,8 +1614,7 @@
RouteMetric=
- Set the routing metric for routes specified by the
- DHCP server.
+ Set the routing metric for routes specified by the DHCP server. Defaults to 1024.
@@ -1734,6 +1733,13 @@
+
+ RouteMetric=
+
+ Set the routing metric for routes specified by the DHCP server. Defaults to 1024.
+
+
+
RapidCommit=
diff --git a/src/network/networkd-ndisc.c b/src/network/networkd-ndisc.c
index 8af7b3c0c3..6de8428e1e 100644
--- a/src/network/networkd-ndisc.c
+++ b/src/network/networkd-ndisc.c
@@ -216,7 +216,7 @@ static int ndisc_router_process_default(Link *link, sd_ndisc_router *rt) {
route->family = AF_INET6;
route->table = link_get_ipv6_accept_ra_route_table(link);
- route->priority = link->network->dhcp_route_metric;
+ route->priority = link->network->dhcp6_route_metric;
route->protocol = RTPROT_RA;
route->pref = preference;
route->gw = gateway;
@@ -451,7 +451,7 @@ static int ndisc_router_process_onlink_prefix(Link *link, sd_ndisc_router *rt) {
route->family = AF_INET6;
route->table = link_get_ipv6_accept_ra_route_table(link);
- route->priority = link->network->dhcp_route_metric;
+ route->priority = link->network->dhcp6_route_metric;
route->protocol = RTPROT_RA;
route->flags = RTM_F_PREFIX;
route->dst_prefixlen = prefixlen;
@@ -512,6 +512,7 @@ static int ndisc_router_process_route(Link *link, sd_ndisc_router *rt) {
route->family = AF_INET6;
route->table = link_get_ipv6_accept_ra_route_table(link);
+ route->priority = link->network->dhcp6_route_metric;
route->protocol = RTPROT_RA;
route->pref = preference;
route->gw.in6 = gateway;
diff --git a/src/network/networkd-network-gperf.gperf b/src/network/networkd-network-gperf.gperf
index 2fc513fbad..4976c62c10 100644
--- a/src/network/networkd-network-gperf.gperf
+++ b/src/network/networkd-network-gperf.gperf
@@ -204,6 +204,7 @@ DHCPv6.AssignAcquiredDelegatedPrefixAddress, config_parse_bool,
DHCPv6.PrefixDelegationHint, config_parse_dhcp6_pd_hint, 0, 0
DHCPv6.WithoutRA, config_parse_bool, 0, offsetof(Network, dhcp6_without_ra)
DHCPv6.SendOption, config_parse_dhcp_send_option, AF_INET6, offsetof(Network, dhcp6_client_send_options)
+DHCPv6.RouteMetric, config_parse_uint32, 0, offsetof(Network, dhcp6_route_metric)
IPv6AcceptRA.UseAutonomousPrefix, config_parse_bool, 0, offsetof(Network, ipv6_accept_ra_use_autonomous_prefix)
IPv6AcceptRA.UseOnLinkPrefix, config_parse_bool, 0, offsetof(Network, ipv6_accept_ra_use_onlink_prefix)
IPv6AcceptRA.UseDNS, config_parse_bool, 0, offsetof(Network, ipv6_accept_ra_use_dns)
diff --git a/src/network/networkd-network.c b/src/network/networkd-network.c
index 2e8cba4ae2..b928f7585c 100644
--- a/src/network/networkd-network.c
+++ b/src/network/networkd-network.c
@@ -410,6 +410,7 @@ int network_load_one(Manager *manager, OrderedHashmap **networks, const char *fi
.dhcp_use_timezone = false,
.rapid_commit = true,
+ .dhcp6_route_metric = DHCP_ROUTE_METRIC,
.dhcp6_use_ntp = true,
.dhcp6_use_dns = true,
diff --git a/src/network/networkd-network.h b/src/network/networkd-network.h
index db325d0d3c..1d4b68d790 100644
--- a/src/network/networkd-network.h
+++ b/src/network/networkd-network.h
@@ -132,6 +132,7 @@ struct Network {
bool dhcp6_use_ntp;
bool dhcp6_without_ra;
uint8_t dhcp6_pd_length;
+ uint32_t dhcp6_route_metric;
char *dhcp6_mudurl;
char **dhcp6_user_class;
char **dhcp6_vendor_class;
diff --git a/test/fuzz/fuzz-network-parser/directives.network b/test/fuzz/fuzz-network-parser/directives.network
index faa38a1c1e..0b62420e0a 100644
--- a/test/fuzz/fuzz-network-parser/directives.network
+++ b/test/fuzz/fuzz-network-parser/directives.network
@@ -121,6 +121,7 @@ UserClass=
VendorClass=
AssignAcquiredDelegatedPrefixAddress=
SendVendorOption=
+RouteMetric=
[Route]
Destination=
Protocol=