diff --git a/lib/config.py b/lib/config.py
index 2b30e608bc8196d67d393619d77f3d135f448049..3fd8dc57f1330b5e03b353472eefd91aca1119c6 100644
--- a/lib/config.py
+++ b/lib/config.py
@@ -820,8 +820,15 @@ class ConfigWriter:
       nodelist.remove(myhostname)
     except ValueError:
       pass
-
-    result = rpc.RpcRunner.call_upload_file(nodelist, self._cfg_file)
+    # we can skip checking whether _UnlockedGetNodeInfo returns None
+    # since the node list comes from _UnlocketGetNodeList, and we are
+    # called with the lock held, so no modifications should take place
+    # in between
+    address_list = [self._UnlockedGetNodeInfo(name).primary_ip
+                    for name in nodelist]
+
+    result = rpc.RpcRunner.call_upload_file(nodelist, self._cfg_file,
+                                            address_list=address_list)
     for node in nodelist:
       if not result[node]:
         logging.error("copy of file %s to node %s failed",
diff --git a/lib/rpc.py b/lib/rpc.py
index 096699d51e39fa0b01a8aed278a2182f35237626..dab37f8ad17924b833da22297bc0890fcc892b56 100644
--- a/lib/rpc.py
+++ b/lib/rpc.py
@@ -666,7 +666,7 @@ class RpcRunner(object):
     return c.GetResults().get(node, False)
 
   @staticmethod
-  def call_upload_file(node_list, file_name):
+  def call_upload_file(node_list, file_name, address_list=None):
     """Upload a file.
 
     The node will refuse the operation in case the file is not on the
@@ -674,6 +674,14 @@ class RpcRunner(object):
 
     This is a multi-node call.
 
+    @type node_list: list
+    @param node_list: the list of node names to upload to
+    @type file_name: str
+    @param file_name: the filename to upload
+    @type address_list: list or None
+    @keyword address_list: an optional list of node addresses, in order
+        to optimize the RPC speed
+
     """
     fh = file(file_name)
     try:
@@ -684,7 +692,7 @@ class RpcRunner(object):
     params = [file_name, data, st.st_mode, st.st_uid, st.st_gid,
               st.st_atime, st.st_mtime]
     c = Client("upload_file", params)
-    c.ConnectList(node_list)
+    c.ConnectList(node_list, address_list=address_list)
     c.Run()
     return c.GetResults()