diff --git a/man/systemd.network.xml b/man/systemd.network.xml
index 197e0dad1da..93c10b77558 100644
--- a/man/systemd.network.xml
+++ b/man/systemd.network.xml
@@ -1547,9 +1547,9 @@ Table=1234
For IPv4 route, defaults to host if Type= is
local or nat, and link if
- Type= is broadcast, multicast, or
- anycast. In other cases, defaults to global. The value
- is not used for IPv6.
+ Type= is broadcast, multicast,
+ anycast, or direct unicast routes. In other cases,
+ defaults to global. The value is not used for IPv6.
diff --git a/src/network/networkd-route.c b/src/network/networkd-route.c
index f0697a66af8..00e64978d45 100644
--- a/src/network/networkd-route.c
+++ b/src/network/networkd-route.c
@@ -2846,6 +2846,12 @@ static int route_section_verify(Route *route, Network *network) {
route->scope = RT_SCOPE_HOST;
else if (IN_SET(route->type, RTN_BROADCAST, RTN_ANYCAST, RTN_MULTICAST))
route->scope = RT_SCOPE_LINK;
+ else if (IN_SET(route->type, RTN_UNICAST, RTN_UNSPEC) &&
+ !route->gateway_from_dhcp_or_ra &&
+ !in_addr_is_set(route->gw_family, &route->gw) &&
+ ordered_set_isempty(route->multipath_routes) &&
+ route->nexthop_id == 0)
+ route->scope = RT_SCOPE_LINK;
}
if (route->scope != RT_SCOPE_UNIVERSE && route->family == AF_INET6) {
diff --git a/test/test-network/conf/25-route-static.network b/test/test-network/conf/25-route-static.network
index 8f242bd1fe5..6aa3ec66dcf 100644
--- a/test/test-network/conf/25-route-static.network
+++ b/test/test-network/conf/25-route-static.network
@@ -24,7 +24,6 @@ Gateway=fe80::222:4dff:ff:ff:ff:ff
[Route]
Destination=149.10.124.64
-Scope=link
[Route]
Gateway=149.10.124.64
diff --git a/test/test-network/systemd-networkd-tests.py b/test/test-network/systemd-networkd-tests.py
index 5613398757f..2207f36245a 100755
--- a/test/test-network/systemd-networkd-tests.py
+++ b/test/test-network/systemd-networkd-tests.py
@@ -2542,9 +2542,9 @@ class NetworkdNetworkTests(unittest.TestCase, Utilities):
self.assertIn('149.10.124.48/28 proto kernel scope link src 149.10.124.58', output)
self.assertIn('149.10.124.64 proto static scope link', output)
self.assertIn('169.254.0.0/16 proto static scope link metric 2048', output)
- self.assertIn('192.168.1.1 proto static initcwnd 20', output)
- self.assertIn('192.168.1.2 proto static initrwnd 30', output)
- self.assertIn('192.168.1.3 proto static advmss 30', output)
+ self.assertIn('192.168.1.1 proto static scope link initcwnd 20', output)
+ self.assertIn('192.168.1.2 proto static scope link initrwnd 30', output)
+ self.assertIn('192.168.1.3 proto static scope link advmss 30', output)
self.assertIn('multicast 149.10.123.4 proto static', output)
print('### ip -4 route show dev dummy98 default')