diff --git a/lxc/remote.go b/lxc/remote.go
index <HASH>..<HASH> 100644
--- a/lxc/remote.go
+++ b/lxc/remote.go
@@ -5,6 +5,7 @@ import (
 	"net"
 	"net/url"
 	"os"
+	"strings"
 
 	"github.com/chai2010/gettext-go/gettext"
 	"golang.org/x/crypto/ssh/terminal"
@@ -93,6 +94,10 @@ func addServer(config *lxd.Config, server string, addr string, acceptCert bool, 
 		r_port = ""
 	}
 
+	if strings.Contains(r_host, ":") && !strings.HasPrefix(r_host, "[") {
+		r_host = fmt.Sprintf("[%s]", r_host)
+	}
+
 	if r_port != "" {
 		addr = r_scheme + "://" + r_host + ":" + r_port
 	} else {
Fix adding a remote by its IPv6 address