If NCCL_SOCKET_IFNAME points to the correct interface, it should be fine even if the hostname resolves to wrong address, as the latter is a fallback of the former.
And as it has already reached the broadcast op in DDP, I would assume the rendezvous in init_process_group was successful. Could you please confirm this by adding the following code right after init_process_group and see if it also hang at this allreduce?
print("rendezvous done")
tmp = torch.ones(2, 2)
torch.distributed.all_reduce(tmp)
print(tmp)

Another thing that we could try is to set the following env vars and see if there is any NCCL logs that stand out.
export NCCL_DEBUG=INFO
export NCCL_DEBUG_SUBSYS=ALL