macOS Machines on a Free /48: networksetup, ndp and Testing
Disclosure up front: I run IPYE, a company that leases IP space. Most of this article is practical how-to; IPYE appears where a free /48, LOA, or ROA helps you try the work, with a short call to action at the end.
Most IPv6 guides assume a Linux server, but a lot of real networks have Macs on them: build machines, a Mac mini running services in a closet, or the laptops of everyone who will test what you deploy. macOS has a solid IPv6 stack, a command-line tool for persistent settings, and BSD-style utilities for inspection. This guide puts Macs on a LAN numbered from a free IPv6 /48 from IPYE. The examples use 2001:db8:100:10::/64 with the router at 2001:db8:100:10::1.
Automatic configuration first
On a LAN where your router sends router advertisements, macOS configures itself by SLAAC with no changes. Check what it picked:
networksetup -listallnetworkservices networksetup -getinfo "Ethernet" ifconfig en0 inet6 -getinfo shows the configured method and address. ifconfig lists every IPv6 address on the interface: a link-local fe80:: address, a stable address in your /64, and usually one or more temporary addresses marked temporary. Temporary addresses are used for outgoing connections by default, which is good for privacy on laptops but confusing when you are reading server logs.
A static address for a Mac that serves things
A Mac mini running a service should have an address that does not change. Set one persistently with networksetup:
sudo networksetup -setv6manual "Ethernet" 2001:db8:100:10::40 64 2001:db8:100:10::1 networksetup -getinfo "Ethernet" The arguments are the service name, address, prefix length and router. The service name is the label from -listallnetworkservices, not the BSD interface name, and names containing spaces need quotes. To go back to automatic configuration later, use sudo networksetup -setv6automatic "Ethernet".
Set DNS servers on the same service:
sudo networksetup -setdnsservers "Ethernet" 2001:db8:100:53::53 Temporary extra addresses
For a test you sometimes need a second address. ifconfig can add an alias that lasts until the next reboot or network change:
sudo ifconfig en0 inet6 2001:db8:100:10::41 prefixlen 64 alias sudo ifconfig en0 inet6 2001:db8:100:10::41 delete This is useful for testing a service that binds to a specific address, but do not rely on it for anything permanent. macOS network configuration can reapply the service settings at any time.
Inspecting neighbours and routes
The BSD tools are slightly different from Linux equivalents:
ndp -an netstat -rn -f inet6 route -n get -inet6 default ndp -an lists the neighbour cache, the IPv6 equivalent of the ARP table. If the router's link-local address is missing or stuck in an incomplete state, the Mac cannot reach it at layer 2, and no amount of routing configuration will help. netstat -rn -f inet6 prints the IPv6 routing table, and route get tells you which route and interface a destination actually uses.
Testing reachability
ping6 -c 3 2001:db8:100:10::1 traceroute6 2001:db8:100:20::10 curl -6 -v https://example.com/ Recent macOS versions also accept ping -6, but ping6 and traceroute6 remain the most portable names. When curl -6 fails while ping6 works, the problem is usually a firewall on TCP or path MTU, not addressing.
Choosing the source address
To test from a specific address, for instance the static one rather than a temporary address, pass it explicitly:
ping6 -S 2001:db8:100:10::40 2001:db8:100:20::10 curl --interface 2001:db8:100:10::40 https://example.com/ If temporary addresses make logs hard to read on a server-like Mac, you can disable them with sudo sysctl -w net.inet6.ip6.use_tempaddr=0. The setting does not survive a reboot, and on laptops you usually want to leave it enabled. A Mac that serves something is better given its static address as the source in the service's own configuration, which leaves the system default untouched.
The firewall
The macOS application firewall applies equally to IPv4 and IPv6. If a service on the Mac is reachable over IPv4 but not over IPv6, check that the service itself listens on IPv6 with lsof -nP -iTCP -sTCP:LISTEN, and look for an address-specific bind in its configuration.
The prefix behind the LAN
All of this assumes a router in front of the Macs that routes part of the /48 to their LAN. If you are setting up that router yourself, the LOA from the IPYE client portal is what upstreams ask for, and IPYE creates the ROA for the /48 automatically.
Next step
Claim your free /48 and give your Macs real IPv6 addresses, using networksetup -setv6manual for any Mac that serves something. Questions: ipye@turnel.com.
About IPYE
IPYE (https://ipye.com) leases IPv4, IPv6 and ASN space with instant setup. Your first IPv6 /48 is free for the first year, a real allocation you can announce on your own ASN, with a LOA from the portal and the ROA created automatically. ASN and region changes apply automatically. IPv4 /24 to /22 leases include LOA, ROA and per-/24 rDNS; WHOIS is editable on IPv6 /44 and larger. Locations: Los Angeles, New York, Ashburn, Salt Lake City, London, Amsterdam, Frankfurt. Claim your free /48: https://my.ipye.com/products/ipv6-rental. Questions: ipye@turnel.com.
Disclosure: I run IPYE
原文:https://www.a8q9.cn/en/article/macos-machines-on-a-free-48-networksetup-ndp-and-testing-37f415.html