交流


交流趋使世界文明进步。(请使用谷歌浏览器/Please use CHROME browser)
https://twitter.com/nankezhou
各位作者原创之文章已经注明各自之作者,均各自获得其著作权与版权保护。

Translate

著作权和版权声明

Creative Commons LicenseThis work is licensed under a Creative Commons Attribution 4.0 International License. Chinese (CC BY 4.0) .

2019年的春节时间是下月5日 Today Developer Calendar

2018年2月2日 星期五

IPV6访问的关键“服务”设定



这里是一个研究模式的多项选择的服务设定指导,并非单一选项的安装说明。





检查命令:

netstat -a -n -y -s -q -x -b

netsh int ipv6 show teredo state

netsh int ipv6 show teredo

netsh int ipv6 show route

netsh int ipv6 show int

netsh int ipv6 show prefix

netsh int ipv6 show address



IPV6访问的关键四个“服务”设定:
登陆——本地系统账户——确定

必须同时打开服务中的
RemoteAccess
Routing and Remote Access
设置为:自动启动



PNRP Machine Name Publication Service
(PNRPAutoReg)


Peer Name Resolution Protocol
(PNRPsvc)

Peer Networking Grouping
(p2psvc)

Peer Networking Identity Manager
(p2pimsvc)


LocalServicePeerNet
PNRPSvc
p2pimsvc
p2psvc
PnrpAutoReg



二,注册表修改:

它们的启动项位于注册表:svchost 必须修改值为:

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Svchost] "LocalServicePeerNet"=hex(7):50,00,4e,00,52,00,50,00,53,00,76,00,63,00,00,00, 70,00,32,00,70,00,69,00,6d,00,73,00,76,00,63,00,00,00,70,00,32,00,70,00,73, 00,76,00,63,00,00,00,50,00,6e,00,72,00,70,00,41,00,75,00,74,00,6f,00,52,00, 65,00,67,00,00,00,00,00

三,关联“服务”PNRP

要想启动此服务,必须开启PNRP对等网络服务:

默认情况下,PNRP 并不安装于 Windows XP 之上。要进行安装,请启动控制面板中的“添加/删除程序”小程序,选择“添加/删除 Windows 组件”,然后选择“网络服务”。接下来,单击“详细信息”按钮,然后选中“对等网络”复选框并选择“确定”/“下一步”。这些步骤会安装几个 P2P Windows 服务(PNRP 是其中的一个),但不会将其配置为自动启动。要启动 PNRP,请转到“服务控制管理器”并启动“对等网络”服务。这也会启动 PNRP 服务。
P2P 应用程序可以注册许多具有 PNRP 服务的节点,PNRP 网格中的每个节点均由一个 P2P 名称和一个 PRNP ID 组成。一般说来,“P2P 名称”表示一个网格名称(如 PeerChannel 应用程序中的网格名)并由 P2P 应用程序指定,而 PNRP ID 则是由 PNRP 基础结构分配给注册节点的。PNRP 网格旨在用于定向消息传送,并使用 PNRP ID 来构建网格。



虽然 PNM 包含一个可执行程序,但是若要利用其功能,需要另外一个应用程序。下面的方案说明了 PictureViewer 如何使用 PNM 来提供协作功能:



  1. Tom 在其运行 Windows Vista 的新笔记本式计算机上安装 PictureViewer。安装者使用 PNM 注册 PictureViewer。
  2. Tom 携带着笔记本式计算机来到一家咖啡店,然后登录至 PNM。在他登录时,p2phost.exe 开始在 PNM 网格中查找其他节点。
  3. Harry 也安装了 PictureViewer,并且也携带着他的笔记本式计算机来到这家咖啡店。在 Harry 登录至 PNM 时,他的 p2phost.exe 实例开始在 PNM 网格中查找其他节点。
  4. Harry 和 Tom 是高中同学,彼此已经多年没有见过面。他们在屋内认出了对方,并开始交谈。Harry 试图向 Tom 展示其家人的照片。
  5. 当正在搜索照片时,Harry 意识到他还没有将其家人最新拍摄的照片从相机上下载下来,因此他希望以后再给 Tom 看这些照片。
  6. Tom 决定请 Harry 看一看他的家人的一些照片,于是启动了 PictureViewer。由于 PictureViewer 是与 PNM 相集成的,因此他邀请 Harry 通过 PictureViewer 来欣赏其家人的照片。
  7. Tom 向 Harry 发出邀请之后,Harry 在任务栏上收到了一个 Tom 邀请他启动 PictureViewer 的通知。
  8. Harry 接受了邀请,随后 PNM 启动 PictureViewer。PictureViewer 启动完毕之后,Tom 家人的照片便显示在 Harry 的 PictureViewer 实例之上。
  9. Harry 答应以后通过 PictureViewer 向 Tom 展示其家人的照片。为此,Harry 通过选择 PictureViewer 中的菜单项,将 Tom 加入到他的联系人列表中。而 Tom 也以同样的方式将 Harry 加入到自己的联系人列表中。
  10. 后来有一天,Harry 和 Tom 去不同的城市出差。Harry 登录到 PNM 并打开 PictureViewer。他立即发现 Tom 也已登录到 PNM。
  11. 因为 Harry 已经下载了他家人最近拍摄的照片,因此邀请 Tom 通过 PictureViewer 来欣赏这些照片。
  12. Tom 收到并接受了 Harry 的邀请。在 Tom 接受邀请之后,PNM 即开始启动 PictureViewer 应用程序。PictureViewer 启动完毕之后,Tom 便看到了期待已久的 Harry 家人的照片。
  13. 尽管 PictureViewer 可能不是共享照片的最有效方式,但是这个故事充分地说明了 PNM 的情况。在这些步骤的每一个步骤中,PictureViewer 都利用了 PNM API 的不同部分。


四,6to4

设置6to4 中继名称解析间隔

IPV6的几种客户端类型:

client: 启用 Teredo 客户端。 
enterpriseclient: 跳过受管理的网络检测。 
natawareclient: 启用 Teredo 客户端并标识 NAT 类型。 
server: 启用 Teredo 服务器。 
default: 默认状态为 client。

                        
(1)
set state type=natawareclient 

nat aware client =natawareclient 
enterprise client=enterprise client

命令行工具(依次敲入的cmd命令。可以复制为.BAT):

IPV6服务类型:
--------------------------------------
netsh 
interface 
teredo
set state type=natawareclient
----------------------------------------------
/OR/
set state type=enterpriseclient
/OR/
set state type=server
----------------------------------------------

IPV6服务类型通讯端口设置:

netsh 
interface 
teredo
set state clientport=443
----------------------------------------------
/OR/
其它端口
----------------------------------------------


DOS配置微软IPV6命令:teredo+6to4



netsh 
interface 
teredo
set state natawareclient win10.ipv6.microsoft.com. 60 443
..
6to4
set relay 6to4.ipv6.microsoft.com enabled
set routing routing=enabled sitelocals=enabled
set state state=enabled undoonstop=disabled



----------------------------------------------
类型和端口同时设置命令:
netsh 
interface 
teredo
set state clientport=443
set state type=natawareclient 


servername=terdoServerName (win10.ipv6.microsoft.com etc.....







用法: set state [[type]=disabled|client|enterpriseclient|natawareclient|server|default]
             [[servername=]<hostname>|<IPv4 address>|default]
             [[refreshinterval=]<integer>|default]
             [[clientport=]<integer>|default]
             [[servervirtualip=]<IPv4 address>|default]

参数:

       标记                值
       type              - 为以下值之一:
                           disabled: 禁用 Teredo 服务。
                           client: 启用 Teredo 客户端。
                           enterpriseclient: 跳过受管理的网络检测。
                           natawareclient: 启用 Teredo 客户端并标识 NAT 类型。
                           server: 启用 Teredo 服务器。
                           default: 默认状态为 client。
       servername        - Teredo 服务器的名称或 IPv4 地址。
       refreshinterval   - 客户端刷新间隔(以秒计)。
       clientport        - 客户端 UDP 端口(或者由系统选择)。
       servervirtualip   - 服务器虚拟 IP 的 IPv4 地址。
                           如果以 teredo 客户端的身份运行则不适用。

备注: 设置 Teredo 状态。
      参数的值 "default" 可将其设置为系统默认值。
      "type=server" 选项仅适用于服务器 SKU。

示例:

       set state disable
       set state client teredo.ipv6.microsoft.com. 60 34567




CMD命令:

netsh 
int 
teredo 
set state default
..
6to4 set state default
..
int

isatap 
set state default
..
ipv6 
set teredo natawareclient
..
int ter 
set state natawareclient win10.ipv6.microsoft.com. 60 443
..
int 
6to4 set state enable 
set relay 6to4.ipv6.microsoft.com enabled

或者 netsh int 6to4 set state automatic





五,工具:

微软提供

IP Translation Configuration Service - Windows 10 Service

http://batcmd.com/windows/10/services/ipxlatcfgsvc/


如何在Windows中启用或者禁用IPv6或其组件

https://support.microsoft.com/en-us/help/929852/how-to-disable-ipv6-or-its-components-in-windows

六,安全问题
--------------------------------------------------------------------------------------
IPV6加强安全服务的注册表值:
https://msdn.microsoft.com/en-us/library/ff648853.aspx

IPv4和IPv6可配置注册表设置
https://msdn.microsoft.com/en-us/library/dn167252.aspx
--------------------------------------------------------------------------------------

七,关于IP转发的注册表修改:

Windows中IP路由转发功能缺省是关闭的。 

关闭的话

1) 打开注册表编辑器。 

2) 在注册表编辑器中,定位以下注册表项: 

HKEY_LOCAL_MACHINE/SYSTEM/CurrentControlSet/ Services/Tcpip 

/Parameters 

选择下面的项目: 

IPEnableRouter:REG_DWORD:0xff 

正确的值应为0xff。 

3) 要对该计算机安装和使用的所有网络连接都启用 IP 转发,请指定值为 1。 

   要对该计算机安装和使用的所有网络连接都关闭 IP 转发,请指定值为 0。 

 



注:必须以管理员或管理组成员的身份登录才能完成该过程。 默认情况下,将禁用 IP 转发。 

根据:https://support.microsoft.com/en-us/help/929852/how-to-disable-ipv6-or-its-components-in-windows


八,优先IPV6前缀问题
netsh int ipv6 sho prefix
访问:
https://support.microsoft.com/en-us/help/929852/how-to-disable-ipv6-or-its-components-in-windows

--------------------------------------------------------------------------------------

隧道适配器 isatap.{3880EF05-203A-4D72-91B4-83DB18E30893}:

   连接特定的 DNS 后缀 . . . . . . . :
   描述. . . . . . . . . . . . . . . : Microsoft ISATAP Adapter
   物理地址. . . . . . . . . . . . . : 00-00-00-00-00-00-00-E0
   DHCP 已启用 . . . . . . . . . . . : 否
   自动配置已启用. . . . . . . . . . : 是
   本地链接 IPv6 地址. . . . . . . . : fe80::5efe:192.168.1.103%23(首选)
   默认网关. . . . . . . . . . . . . :
   DHCPv6 IAID . . . . . . . . . . . : 385875968
   DHCPv6 客户端 DUID  . . . . . . . : 00-01-00-01-21-FD-7F-87-50-E5-49-AB-F0-A6
   DNS 服务器  . . . . . . . . . . . : 2001:4860:4860::8888
                                       2001:4860:4860::8844
                                       8.8.8.8
                                       8.8.4.4
  隧道适配器 isatap. TCPIP 上的 NetBIOS  . . . . . . . : 已禁用



IPV6的IPV4地址服务器PING通

C:\WINDOWS\system32>ping 171.**.***.**

正在 Ping 171.***.***.** 具有 32 字节的数据:
来自171.***.***.**的回复: 字节=32 时间=1ms TTL=64
来自171.***.***.** 的回复: 字节=32 时间<1ms TTL=64
来自171.***.***.**的回复: 字节=32 时间<1ms TTL=64
来自171.***.***.** 的回复: 字节=32 时间=1ms TTL=64

171.125.***.**的 Ping 统计信息:
    数据包: 已发送 = 4,已接收 = 4,丢失 = 0 (0% 丢失),
往返行程的估计时间(以毫秒为单位):
    最短 = 0ms,最长 = 1ms,平均 = 0ms


C:\WINDOWS\system32>


九,IP help IPV6地址转换服务宕机问题


第一步先了解你的windows版本和型号:

把下列代码存为BAT文件运行,看到版本显示即可进行下一步。

title APP AUTO TOOL
@echo off
cls
color 0a


chcp 65001 > nul
set PYTHONIOENCODING=utf-8
set font=Lucida Console
set LINE=Some localized OEM text
set FILE=test.txt

@chcp 65001 > nul
@set PYTHONIOENCODING=utf-8
set LINE=Some localized OEM text
set FILE=test.txt
CHCP 65001|>>%FILE% Echo %LINE%&CHCP 936
(for /f "delims=" %%a in  ('type utf8.txt') do echo.%%a
)>oem.txt


第二步:

IP Translation Configuration Service 

请访问微软官方下载解决方案软件:https://support.microsoft.com/en-us/help/929852/how-to-disable-ipv6-or-its-components-in-windows


win10解决方案——配置  IpxlatCfgSvc

@echo off
sc config IpxlatCfgSvc start= Auto
sc config IpxlatCfgSvc start= Auto
exit

Start C:\Windows\System32\svchost.exe sc config IpxlatCfgSvc start= Auto
svchost.exe sc config IpxlatCfgSvc start= Auto
sc config IpxlatCfgSvc start= Auto


sc ("service control") will do that; 
note the space between "start=" and the option
Automatic start:
sc config <ServiceName> start= auto
Manual start:
sc config <ServiceName> start= demand
Disabled:
sc config <ServiceName> start= disabled




配置  IpxlatCfgSvc

C:\WINDOWS\system32>svchost.exe sc config IpxlatCfgSvc start= Auto

--------------------------------------------------------------------------
C:\WINDOWS\system32>



一种配置:跳过受管理的网络检测

sc config IpxlatCfgSvc start= Auto  
netsh interface teredo set state enterpriseclient server=default

另一种配置:启用 Teredo 客户端并标识 NAT 类型。

sc config IpxlatCfgSvc start= Auto  

netsh interface teredo set state natawareclient server=default



enterpriseclient: 跳过受管理的网络检测。 

natawareclient: 启用 Teredo 客户端并标识 NAT 类型。

--------------------------------------------------------------------------
类型                    : natawareclient /OR/ enterpriseclient
服务器名称              : ×××.×××.×××.com. (Group Policy)
客户端刷新间隔          : 30 秒  (Group Policy)
客户端端口                : ×××× (Group Policy)
状态                    : qualified
客户端类型              : teredo client
网络                    : managed
NAT                     : restricted (port)
NAT 特殊行为   : UPNP: 否,PortPreserving: 是
本地映射           : 192.168.1.103:443

外部 NAT 映射    : ×××.×××.×××.×××:443


--------------------------------------------------------------------------


描述:
        在注册表和服务数据库中修改服务项。
用法:
        sc <server> config [服务名称] <option1> <option2>...

选项:
注意: 选项名称包括等号。
      等号和值之间需要一个空格。
      要删除依赖关系,请使用单个“/”表示依赖关系值。
 type= <own|share|interact|kernel|filesys|rec|adapt|userown|usershare>
 start= <boot|system|auto|demand|disabled|delayed-auto>
 error= <normal|severe|critical|ignore>
 binPath= <.exe 文件的 BinaryPathName>
 group= <LoadOrderGroup>
 tag= <yes|no>
 depend= <依赖关系(以 / (正斜杠)分隔)>
 obj= <AccountName|ObjectName>
 DisplayName= <显示名称>
 password= <密码>


C:\WINDOWS\system32>

--------------------------------------------------------------------------

c:\windows\system32\iphlpsvc.dll
%SystemRoot%\System32\iphlpsvc.dll"
HKLM\System\CurrentControlSet\Services\IpxlatCfgSvc",
IP Translation Configuration Service
Configures and enables translation from v4 to v6 and vice c:\windows\system32\ipxlatcfg.dll
%SystemRoot%\System32\IpxlatCfg.dll

HKLM\System\CurrentControlSet\Services",

--------------------------------------------------------------------------



(R=Running, S=Stopped, 0=Boot, 1=System, 2=Auto, 3=Demand, 4=Disabled


十:更换IP


netsh
interface ipv6
set privacy enabled

ping -t bt.neu6.edu.cn

每隔2分钟切换临时IP
netsh int ipv6 set privacy maxpreferredlifetime=120s maxrandomtime=1s store=active

激活IP更换
netsh int ipv6 set privacy maxpreferredlifetime=1d maxrandomtime=10m store=active


参考:
https://en.wikipedia.org/wiki/IPv6_address








十一,一些误读和存疑的再解读:以微软官方公布技术答案为准。


这里很正规
https://support.microsoft.com/en-us/help/929852/how-to-disable-ipv6-or-its-components-in-windows


mportant Internet Protocol version 6 (IPv6) is a mandatory part of Windows Vista and later versions of Windows. We do not recommend that you disable IPv6 or its components. If you do, some Windows components may not function. Additionally, system startup will be delayed for 5 seconds if IPv6 is disabled by incorrectly, setting the DisabledComponents registry setting to a value of 0xfffffff. The correct value should be 0xff. 


上面的0xff值与下面的说法保持矛盾。以微软官方的公布为主。因而忽略以下说法。

How to back up and restore the registry in Windows

1. Click Start , type regedit in Start Search Bar and hit Enter.

Note: If you are prompted for an administrator password or confirmation, type your password or click Continue.

2. Locate and then click the following registry subkey:

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\TCPIP6\Parameters

3. Check whether DisabledComponents registry key exists. If yes, let's proceed to the next step.

4. Double click the DisabledComponents registry key and modify the value to 0 .

If the DisabledComponents entry is unavailable, you must create it. To do this, follow these steps:

   1. In the Edit menu, point to New , and then click DWORD (32-bit) Value .
   2. Type DisabledComponents , and then press ENTER.
   3. Double-click DisabledComponents .

Type 0 to enable all IPv6 components.

5. Exit Registry Editor, and then restart the computer.