diff --git a/SOURCES/1012-prefer-IPv4-to-determine-the-hostname.patch b/SOURCES/1012-prefer-IPv4-to-determine-the-hostname.patch
new file mode 100644
index 0000000..55f6004
--- /dev/null
+++ b/SOURCES/1012-prefer-IPv4-to-determine-the-hostname.patch
@@ -0,0 +1,43 @@
+From 65ea6e97238a76386d0477abc0d22b2227f38d60 Mon Sep 17 00:00:00 2001
+From: Beniamino Galvani <bgalvani@redhat.com>
+Date: Thu, 17 Jun 2021 11:35:54 +0200
+Subject: [PATCH] policy: prefer IPv4 to determine the hostname
+
+When determining the hostname, it is preferable to evaluate devices in
+a predictable order to avoid that the hostname changes between
+different boots.
+
+The current order is based first on hostname priority, then on the
+presence of a best default route, and then on activation order.
+
+The activation order is not a very strong condition, as it is
+basically useless for devices that are autoactivated at boot.
+
+As we already prefer IPv4 over IPv6 within the same connection, also
+prefer it when 2 connections have the same priority and the same
+default route status, to achieve better predictability.
+
+https://bugzilla.redhat.com/show_bug.cgi?id=1970335
+https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/895
+(cherry picked from commit 637a45e25b58afd1ac22af8657121e0956093b61)
+(cherry picked from commit 21051dc6d8b87c48fafb44b5cde901633b0a7cd2)
+(cherry picked from commit b793925889a3137b77fa2b8679144b1e4948d246)
+---
+ src/core/nm-policy.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/src/core/nm-policy.c b/src/core/nm-policy.c
+index db4983f889..71aa1eceaf 100644
+--- a/src/core/nm-policy.c
++++ b/src/core/nm-policy.c
+@@ -652,6 +652,7 @@ device_hostname_info_compare(gconstpointer a, gconstpointer b)
+ 
+     NM_CMP_FIELD(info1, info2, priority);
+     NM_CMP_FIELD_UNSAFE(info2, info1, is_default);
++    NM_CMP_FIELD_UNSAFE(info2, info1, IS_IPv4);
+ 
+     return 0;
+ }
+-- 
+2.31.1
+
diff --git a/SPECS/NetworkManager.spec b/SPECS/NetworkManager.spec
index 555162f..71891c4 100644
--- a/SPECS/NetworkManager.spec
+++ b/SPECS/NetworkManager.spec
@@ -7,7 +7,7 @@
 %global epoch_version 1
 %global rpm_version 1.30.0
 %global real_version 1.30.0
-%global release_version 9
+%global release_version 10
 %global snapshot %{nil}
 %global git_sha %{nil}
 
@@ -198,6 +198,7 @@ Patch1008: 1008-manager-fix-active_connection_find.patch
 Patch1009: 1009-bond-support-tlb_dynamic_lb-in-balance-alb-mode.patch
 Patch1010: 1010-manager-delete-default-connection-when-veth-removed.patch
 Patch1011: 1011-don-t-touch-device-tc-config-by-default-rh1928078.patch
+Patch1012: 1012-prefer-IPv4-to-determine-the-hostname.patch
 
 # The pregenerated docs contain default values and paths that depend
 # on the configure options when creating the source tarball.
@@ -1162,6 +1163,9 @@ fi
 
 
 %changelog
+* Mon Jul 12 2021 Beniamino Galvani <bgalvani@redhat.com> - 1:1.30.0-10
+- core: prefer IPv4 to determine the hostname (rh #1970335)
+
 * Fri Jun 18 2021 Beniamino Galvani <bgalvani@redhat.com> - 1:1.30.0-9
 - core: don't touch device traffic control (TC) configuration by default (rh #1928078)