PowerShell NetworkTransition module
The NetworkTransition module configures the IPv6 transition technologies built into Windows: the tunnels Teredo, 6to4, ISATAP and IP-HTTPS, and the translators DNS64 and NAT64. They let IPv6 traffic cross IPv4-only networks, or let IPv6-only clients reach IPv4-only servers.
233.1 Why is it used?
- Many ISPs, hotels and intranets are still IPv4-only while apps (e.g. DirectAccess) need IPv6.
- Tunnels wrap IPv6 inside IPv4; translators rewrite headers between IPv6 and IPv4.
- Every technology has Get/Set/Reset; IP-HTTPS, DNS64 and NAT64 also have New/Enable/Disable/Remove.
- With native IPv6, best practice is to disable the tunnels (-State Disabled).
233.2 Comparison: the transition technologies
| Technology | Method | Carried in | Typical place |
|---|---|---|---|
| Teredo | Tunnel | IPv6 in IPv4 UDP 3544 | Host behind a NAT, IPv4-only ISP |
| 6to4 | Tunnel | IPv6 in IPv4, protocol 41; prefix 2002::/16 from public IPv4 | Host with a public IPv4 |
| ISATAP | Tunnel | IPv6 in IPv4, protocol 41; router found via DNS name isatap | Company IPv4 intranet |
| IP-HTTPS | Tunnel | IPv6 inside HTTPS, TCP 443 | DirectAccess client behind a strict firewall |
| DNS64 + NAT64 | Translation | Synthesized AAAA (64:ff9b::/96) + IPv6->IPv4 header translation | IPv6-only clients reaching IPv4-only servers |
233.3 How the tunnels work
- Step 1
1.Laptop behind a NAT router, ISP gives only IPv4
- Step 2
2.Laptop qualifies with a Teredo server on UDP 3544
- Step 3
3.Gets a Teredo IPv6 address in 2001::/32
- Step 4
4.IPv6 packet is wrapped in IPv4 + UDP (NAT translates UDP easily)
- Step 5
5.Teredo relay strips the outer header and forwards to the IPv6 server 2001:db8::80
- Step 1
1.Hotel firewall allows only TCP 80/443
- Step 2
2.Teredo on UDP 3544 is blocked
- Step 3
3.IP-HTTPS puts the IPv6 packet inside a TLS session on TCP 443
- Step 4
4.Firewall sees normal HTTPS and lets it through
- Step 5
5.DirectAccess server unwraps it and forwards to the IPv6 office app
- 6to4: host with public IPv4 203.0.113.10 builds the prefix 2002:cb00:710a::/48 and sends IPv6 inside IPv4 protocol 41 to a 6to4 relay.
- ISATAP: office PC resolves the DNS name isatap (e.g. 192.168.10.1) and sends IPv6 in protocol 41 over the intranet to the ISATAP router.
233.4 What was run on Windows (read-only)
Get-Command -Module NetworkTransition | Measure-ObjectGet-Help Set-NetTeredoConfiguration$ Get-Command -Module NetworkTransition | Measure-ObjectCount : 34$ Get-Help Set-NetTeredoConfiguration (trimmed)Synopsis : Set-NetTeredoConfiguration [[-Type] <Type>] [[-ServerName] <string>] [[-RefreshIntervalSeconds] <uint32>] [[-ClientPort] <uint32>] [[-ServerVirtualIP] <string>] [[-DefaultQualified] <bool>] [[-ServerShunt] <bool>] [-IPInterface <CimInstance#MSFT_NetIPInterface>] [-PolicyStore <string>] [-GPOSession <string>] [-CimSession <CimSession[]>] [-ThrottleLimit <int>] [-AsJob] [-PassThru] [-WhatIf] [-Confirm] [<CommonParameters>]ModuleName : NetworkTransition- Even the Get cmdlets could show office DirectAccess server names, so only Get-Command and Get-Help were run.
233.5 Common parameters
| Parameter | What it does |
|---|---|
| -AsJob / -CimSession / -ThrottleLimit | Background job / remote computer / max concurrent operations |
| -Confirm / -WhatIf | Ask first / only show |
| -PolicyStore | PersistentStore, ActiveStore or a GPO: "Domain\GPOName" |
| -GPOSession | NetGPO session (not together with -PolicyStore) |
| -InputObject / -PassThru | Config object from the pipeline / return the result |
233.6 Teredo cmdlets
Get-NetTeredoState # Teredo not active: no objectGet-NetTeredoConfiguration # active store of the local computerSet-NetTeredoConfiguration -ServerName "Test"Set-NetTeredoConfiguration -Type Enterpriseclient -PolicyStore "Domain\GPOname"Reset-NetTeredoConfiguration # switches of the same names: not configured- -Type: Disabled, Client, Enterpriseclient (skips managed network detection), Server, Relay, Automatic, Default.
- -ServerName, -ClientPort, -RefreshIntervalSeconds, -ServerShunt; -DefaultQualified and -ServerVirtualIP work only on a GPO.
233.7 6to4 and ISATAP cmdlets
Get-Net6to4ConfigurationSet-Net6to4Configuration -RelayName "my6to4relay.com"Get-NetIPInterface -InterfaceIndex 14 | Get-NetIsatapConfigurationSet-NetIsatapConfiguration -Router superisatap $config = ( Get-NetIPInterface -InterfaceIndex 14 | Get-Net6to4Configuration )Reset-Net6to4Configuration -InputObject $configGet-NetIPInterface -InterfaceIndex 14 | Reset-NetIsatapConfiguration -Router- -State: Default, Enabled, Disabled, Automatic.
- 6to4: -RelayName, -RelayState, -ResolutionIntervalSeconds, -AutoSharing (forward the prefix with ICS).
- ISATAP: -Router takes a name or IPv4 (with an IPv4 no DNS is needed), -ResolutionState.
- Reset-* switches put each setting back to "not configured" in the GPO.
233.8 IP-HTTPS cmdlets
Get-NetIPHttpsState # IP-HTTPS not active: no objectGet-NetIPHttpsConfigurationNew-NetIPHttpsConfiguration -Profile "Redmond" ` -ServerURL "https://contoso.com:443/IPHTTPs" -PolicyStore "Domain\TestGPO"Set-NetIPHttpsConfiguration -Profile "Redmond" ` -ServerURL "https://da.com:443/IPHTTPs" -PolicyStore "Domain\TestGPO"Rename-NetIPHttpsConfiguration -Profile "Redmond" -NewName "Fareast"Enable-NetIPHttpsProfile -Profile "Redmond"Disable-NetIPHttpsProfile # disables the currently active profileRemove-NetIPHttpsConfiguration -Profile "Profile1" -PolicyStore "Domain\GPO"- -ServerURL: the client connects to it, a server listens on it; -Type Client or Server.
- -State OutsideEnabled: IP-HTTPS only when outside the corporate network.
- -AuthMode Certificates: require client certificates; -StrongCRLRequired defaults to False.
Add-NetIPHttpsCertBinding -IpPort "10.1.1.1:443" ` -CertificateHash "0102030405060708090A0B0C0D0E0F1011121314" ` -CertificateStoreName "My" -ApplicationId "{3F2504E0-4F89-11D3-9A0C-0305E82C3301}" ` -NullEncryption $falseRemove-NetIPHttpsCertBinding # all IP-HTTPS certificate bindings- -CertificateHash is a 20-byte SHA hash, -ApplicationId a GUID; -NullEncryption $true runs IP-HTTPS without SSL encryption.
233.9 How DNS64 + NAT64 work
- Step 1
1.Phone 2001:db8::10 asks DNS64 for AAAA example.com
- Step 2
2.DNS64 finds only A 93.184.216.34
- Step 3
3.It answers a synthesized AAAA 64:ff9b::5db8:d822 (93.184.216.34 = 5d.b8.d8.22)
- Step 4
4.Phone sends to 64:ff9b::5db8:d822; the packet reaches the NAT64 gateway
- Step 5
5.NAT64 translates the IPv6 header into IPv4, dst 93.184.216.34
- Step 6
6.Reply is translated back; the phone thinks it talks to an IPv6 server
Translation, not a tunnel: nothing is wrapped
233.10 DNS64 and NAT64 cmdlets
Get-NetDnsTransitionConfigurationGet-NetDnsTransitionMonitoring # successful / failed DNS64 queriesSet-NetDnsTransitionConfiguration -State Enabled -LatencyMilliseconds 400Enable-NetDnsTransitionConfigurationDisable-NetDnsTransitionConfigurationReset-NetDnsTransitionConfiguration -State -LatencyMilliseconds# default: Disabled, 300 ms, 64:FF9B::/96- -PrefixMapping "IPv6 prefix,IPv4 subnet", -ExclusionList (no synthesis), -OnlySendAQuery, -AlwaysSynthesize, -AcceptInterface, -SendInterface.
$nat64Prefix = "2009:1:2:3:4:5::/96"$prefixMapping = "$nat64Prefix,0.0.0.0/0"$portPool = "33.0.0.1,6000-10000"New-NetNatTransitionConfiguration -InstanceName "NAT64" -OutboundInterface "corpnet" ` -PrefixMapping $prefixMapping -IPv4AddressPortPool $portPoolGet-NetNatTransitionConfigurationGet-NetNatTransitionMonitoring # client IP and translated targetsEnable-NetNatTransitionConfiguration -InstanceName "NAT64"Disable-NetNatTransitionConfigurationRemove-NetNatTransitionConfiguration -InstanceName "NAT64"- -InboundInterface: IPv6 comes in; -OutboundInterface: IPv4 goes out.
- -IPv4AddressPortPool "IPv4,low-high"; -TcpMappingTimeoutSeconds min 1800, default 7200.
- Get-NetNatTransitionMonitoring -TransportProtocol: 6 TCP, 17 UDP, 58 IPv6-ICMP.
233.11 Linux lab
Tunnels: on Linux 6to4/ISATAP use the sit module. It is a loadable module and not loaded, so no tunnel was created (syntax only).
grep -cE '^(sit|ip6_tunnel) ' /proc/moduleszcat /proc/config.gz | grep -E 'SIT=|6_TUNNEL='# syntax only (ip-tunnel(8)), NOT run:# ip tunnel add NAME mode sit remote any local ADDR# ip tunnel add NAME mode isatap local ADDR[check] $ grep -cE '^(sit|ip6_tunnel) ' /proc/modules0[check] $ zcat /proc/config.gz | grep -E 'SIT=|6_TUNNEL='CONFIG_INET6_TUNNEL=mCONFIG_IPV6_SIT=mCONFIG_IPV6_TUNNEL=mDNS64: a real unbound resolver with the dns64 module, answering only the lab zone.
server: interface: 0.0.0.0 access-control: 192.168.254.0/24 allow do-ip6: no module-config: "dns64 iterator" dns64-prefix: 64:ff9b::/96 local-zone: "." refuse local-zone: "lab." transparentauth-zone: name: "lab." zonefile: "/etc/unbound/lab.zone" for-downstream: no for-upstream: yes fallback-enabled: no[dns] $ unbound-checkconf && unbound -c /etc/unbound/unbound.conf && sleep 1 && echo startedunbound-checkconf: no errors in /etc/unbound/unbound.confstarted[dns] $ grep -E 'IN (A|AAAA) ' /etc/unbound/lab.zonens IN A 192.168.254.53web.v4only IN A 192.168.254.80dual IN A 192.168.254.81dual IN AAAA fd00:233::81dig @192.168.254.53 +noall +answer A web.v4only.labdig @192.168.254.53 +noall +answer AAAA web.v4only.labprintf '%02x%02x:%02x%02x\n' 192 168 254 80dig @192.168.254.53 +noall +answer AAAA dual.labdig @192.168.254.53 AAAA example.com | grep statusweb.v4only.lab. 60 IN A 192.168.254.80web.v4only.lab. 58 IN AAAA 64:ff9b::c0a8:fe50c0a8:fe50dual.lab. 60 IN AAAA fd00:233::81;; ->>HEADER<<- opcode: QUERY, status: REFUSED, id: 57175- web.v4only.lab has only an A record, yet AAAA returns 64:ff9b::c0a8:fe50 (c0a8:fe50 = 192.168.254.80 in hex).
- dual.lab's real AAAA comes back unchanged; names outside the lab are REFUSED.
233.12 Common mistakes
- Calling NAT64 a tunnel: it translates headers; DNS64 only synthesizes AAAA.
- Expecting Teredo to work on a network that allows only TCP 443: use IP-HTTPS.
- Leaving tunnels enabled after native IPv6 is available.
- Running Set/Reset/New/Remove without an admin shell or against the wrong -PolicyStore.
233.13 Interview tips
- Three transition methods: dual stack, tunneling (6to4/ISATAP protocol 41, Teredo UDP 3544, IP-HTTPS TCP 443), translation (NAT64 + DNS64).
- DNS64 prefix 64:ff9b::/96 + IPv4 in hex = synthesized AAAA.
- Only TCP 443 open + DirectAccess = IP-HTTPS.
- Native IPv6 available: disable the tunnels.