diff --git a/src/accelerate/commands/config/cluster.py b/src/accelerate/commands/config/cluster.py
index 65c0e56b2..9b14aeaed 100644
--- a/src/accelerate/commands/config/cluster.py
+++ b/src/accelerate/commands/config/cluster.py
@@ -38,6 +38,7 @@ def get_cluster_input():
     main_process_ip = None
     main_process_port = None
     rdzv_backend = "static"
+    same_network = True
     if distributed_type in [DistributedType.MULTI_GPU, DistributedType.MULTI_CPU]:
         num_machines = _ask_field(
             "How many different machines will you use (use more than 1 for multi-node training)? [1]: ",
@@ -57,9 +58,16 @@ def get_cluster_input():
                 "What is the port you will use to communicate with the main process? ",
                 lambda x: int(x),
             )
-            rdzv_backend = _ask_field(
-                "What rendezvous backend will you use? ('static', 'c10d', ...)", default="static"
+            same_network = _ask_field(
+                "Are all the machines on the same network? [YES/no]: ",
+                _convert_yes_no_to_bool,
+                default=True,
+                error_message="Please enter yes or no.",
             )
+            if not same_network:
+                rdzv_backend = _ask_field(
+                    "What rendezvous backend will you use? ('static', 'c10d', ...): ", default="static"
+                )
 
     if distributed_type == DistributedType.NO:
         use_cpu = _ask_field(
@@ -328,4 +336,5 @@ def get_cluster_input():
         fsdp_config=fsdp_config,
         use_cpu=use_cpu,
         rdzv_backend=rdzv_backend,
+        same_network=same_network,
     )
diff --git a/src/accelerate/commands/config/config_args.py b/src/accelerate/commands/config/config_args.py
index e78aad181..68da64963 100644
--- a/src/accelerate/commands/config/config_args.py
+++ b/src/accelerate/commands/config/config_args.py
@@ -138,6 +138,7 @@ class ClusterConfig(BaseConfig):
     main_process_ip: Optional[str] = None
     main_process_port: Optional[int] = None
     rdzv_backend: Optional[str] = "static"
+    same_network: Optional[bool] = False
     main_training_function: str = "main"
 
     # args for deepspeed_plugin
diff --git a/src/accelerate/commands/launch.py b/src/accelerate/commands/launch.py
index fcc80bb7f..491ea5ad3 100644
--- a/src/accelerate/commands/launch.py
+++ b/src/accelerate/commands/launch.py
@@ -375,15 +375,21 @@ def simple_launcher(args):
 def multi_gpu_launcher(args):
     num_processes = getattr(args, "num_processes")
     num_machines = getattr(args, "num_machines")
+    main_process_ip = getattr(args, "main_process_ip")
+    main_process_port = getattr(args, "main_process_port")
     if num_machines > 1:
         setattr(args, "nproc_per_node", str(num_processes // num_machines))
         setattr(args, "nnodes", str(num_machines))
-        setattr(args, "node_rank", str(args.machine_rank))
-        setattr(args, "rdzv_endpoint", f"{args.main_process_ip}:{args.main_process_port}")
+        setattr(args, "node_rank", int(args.machine_rank))
+        if getattr(args, "same_network"):
+            setattr(args, "master_addr", str(main_process_ip))
+            setattr(args, "master_port", str(main_process_port))
+        else:
+            setattr(args, "rdzv_endpoint", f"{main_process_ip}:{main_process_port}")
     else:
         setattr(args, "nproc_per_node", str(num_processes))
-        if args.main_process_port is not None:
-            setattr(args, "master_port", str(args.main_process_port))
+        if main_process_port is not None:
+            setattr(args, "master_port", str(main_process_port))
 
     if args.module and args.no_python:
         raise ValueError("--module and --no_python cannot be used together")



Discussion: body: _The documentation is not available anymore as the PR was closed or merged._