Browse Source

Merge pull request #165 from CodedInternet/IPv6

Fix IPv6 support on macOS and provide very basic documentation detailing how it can be used
Ettore Di Giacinto 1 year ago
parent
commit
6ab9ef6e79
2 changed files with 16 additions and 1 deletions
  1. 9 0
      docs/content/en/docs/Getting started/cli.md
  2. 7 1
      pkg/vpn/interface_darwin.go

+ 9 - 0
docs/content/en/docs/Getting started/cli.md

@@ -78,3 +78,12 @@ Note: Experimental feature!
 Automatic IP negotiation is available since version `0.8.1`.
 Automatic IP negotiation is available since version `0.8.1`.
 
 
 DHCP can be enabled with `--dhcp` and `--address` can be omitted. If an IP is specfied with `--address` it will be the default IP.
 DHCP can be enabled with `--dhcp` and `--address` can be omitted. If an IP is specfied with `--address` it will be the default IP.
+
+## IPv6 (experimental)
+
+Node: Very experimental feature! Highly unstable!
+
+Very provisional support for IPv6 is available using static addresses only. Currently only one address is supported per interface, dual stack is not available.
+For more information, checkout [issue #15](https://github.com/mudler/edgevpn/issues/15)
+
+IPv6 can be enabled with `--address fd:ed4e::<IP>/64` and `--mtu >1280`.

+ 7 - 1
pkg/vpn/interface_darwin.go

@@ -54,7 +54,13 @@ func prepareInterface(c *Config) error {
 
 
 	// Add the address to the interface. This is not directly possible with the `net` package,
 	// Add the address to the interface. This is not directly possible with the `net` package,
 	// so we use the `ifconfig` command.
 	// so we use the `ifconfig` command.
-	cmd = exec.Command("ifconfig", iface.Name, "inet", ip.String(), ip.String())
+	if ip.To4() == nil {
+		// IPV6
+		cmd = exec.Command("ifconfig", iface.Name, "inet6", ip.String())
+	} else {
+		// IPv4
+		cmd = exec.Command("ifconfig", iface.Name, "inet", ip.String(), ip.String())
+	}
 	err = cmd.Run()
 	err = cmd.Run()
 	if err != nil {
 	if err != nil {
 		return err
 		return err