On Windows Vista and Windows Server 2008, the route metric specified in the dwForwardMetric1 member of the MIB_IPFORWARDROW structure pointed to by pRoute parameter represents a combination of the route metric added to the interface metric specified in the Metric member of the MIB_IPINTERFACE_ROW structure of the associated interface. So the dwForwardMetric1 member of the MIB_IPFORWARDROW structure should be equal to or greater than Metric member of the associated MIB_IPINTERFACE_ROW structure. If an application would like to set the route metric to 0, then the dwForwardMetric1 member of the MIB_IPFORWARDROW structure should be set equal to the value of the interface metric specified in the Metric member of the associated MIB_IPINTERFACE_ROW structure. An application can retrieve the interface metric by calling the GetIpInterfaceEntry function.
很多人没有注意MSDN中专门强调的这段话。
本文详细解释了在Windows Vista及Windows Server 2008中如何正确设置路由度量值。特别是dwForwardMetric1成员与接口度量之间的关系,以及如何通过调用GetIpInterfaceEntry函数来获取接口度量。

被折叠的 条评论
为什么被折叠?



