Archive. This is an archive of the Apple Support Community. Discussions are being restored and soon you will be able to read and post here again.

aggravation when trying to create 6in4 tunnels on macOS 27

I am unable to set up correctly configured 6in4 tunnels on macOS 27. It seems that the setup of the tunnel on gif0 occurs correctly, but route refuses to allow routing entries that use gif0, once it is set up. What's happening?

3 replies

When you observe the gif0 interface correctly plumbed but the route utility refusing to accept paths through it, you are encountering a modern macOS routing constraint. macOS heavily restricts traditional scoped routing over raw generic tunneling interfaces (gif) if there is no underlying IPv4 gateway affinity explicitly parsed by the XNU kernel routing daemon.


The Technical Cause

  • Interface Scoping Requirements: macOS enforces strict network interface scoping rules. When you try to append a standard IPv6 route using route add -inet6 default -interface gif0 or using the remote tunnel IPv6 endpoint, the BSD-layer routing table rejects it because it considers gif0 an un-scoped, disconnected link unless it explicitly resolves an on-link endpoint.
  • Missing Local IPv4 Bindings: If your local machine is behind a NAT (e.g., using a local IPv4 address like 192.168.1.X), binding the gif tunnel to your external IP will cause the routing configuration to fail. macOS requires the tunnel command to bind to an IP physically present on one of your local hardware interfaces (en0, en1, etc.).


How to Fix It

To satisfy the kernel's routing demands, you must define the IPv6 destination explicitly paired with the point-to-point interface parameters. Use the following structured sequence:


Correctly Bind the Tunnel (Using Local IP)

Ensure your gif0 interface is tunnel-configured using your local LAN IPv4 (not your public IP if you are behind a NAT): 

sudo ifconfig gif0 tunnel <YOUR_LOCAL_IPV4> <TUNNEL_BROKER_REMOTE_IPV4>


Assign the IPv6 Endpoints

Explicitly state the source and target IPv6 addresses on the interface, declaring a point-to-point link prefix length (prefixlen 128 or /128) to prevent routing path collisions:

sudo ifconfig gif0 inet6 <YOUR_ASSIGNED_CLIENT_IPV6> <TUNNEL_BROKER_REMOTE_IPV6> prefixlen 128


Overcome the route Refusal

Instead of pushing an abstract interface route, force the kernel to evaluate the interface by targeting the specific remote IPv6 gateway link as the next hop:

sudo route add -inet6 default <TUNNEL_BROKER_REMOTE_IPV6>


If it still throws a routing error, explicit scoping can sometimes be forced by appending the interface designation to the gateway command:

sudo route add -inet6 default -interface gif0


Alternative: Let macOS Manage 6to4 via System Settings (i.e., use 6to4 instead of 6in4)

If manual command-line configuration continues to drop or conflict with the macOS system configuration daemon (configd), you can allow macOS to handle the link encapsulation internally: 

  • Open System Settings > Network.
  • Click the Action (...) pop-up menu at the bottom-right of the interface list and choose Add Service.
  • Select 6to4 from the Interface dropdown menu.
  • Name the service and hit Create.
  • Go into its details to input your relay or broker addresses manually to let configd cleanly inject the required routes into the kernel


More info from Apple: Set up a 6to4 network port on Mac - Apple Support

Here’s are he.net setups (which I’ve not tested):


Is a router-based configuration an option here? Other potential alternatives might be a travel router, or a gateway capable of providing either IPv6 routing or of passing 6in4 traffic.


NB: 6to4 is flaky, and is generally considered deprecated.

@neuroanatomist, thanks. that is the exact method i've been using, and have used it for a while now, but something is messing with doing that way, as it continually ends up with problems regarding finding the route to use it, which didn't happen a couple macos versions ago, or so. Unfortunately, once that route for the tunnel is entered, it doesn't throw an error, but I am unable to route to it. I'm not sure what's going on, as it seems to be correctly done. I'm still trying, though.


@MrHoffman, and the user I no longer see in the thread, I'm currently using the 6to4 tunnel on my router. After looking at RFC 6343, I'm beginning to think that it may be problem with my ISP's implementation of their 6to4 gateway. RFC 6343, which is actually a discussion of widespread 6to4 problems experienced and a reiteration of the requirements imposed by other RFCs to the RFC that defines 6to4 and other known methods, mentions that they encountered a lot of ISPs that have misconfigured their 6to4 gateway, as well as a lot of os and router designs that are also causing problems with 6to4. I want to avoid those possible pitfalls. Trying to create a 6to4 tunnel on my mac using System Settings doesn't work, I suspect that my mac needs to have a public ip address to use the gateway configuration provide by macos system settings, but it is in private ip space.


Sorry for the delay in responding, and thank you for your help in exploring this further.