大网数据广告活动
服务器运维问答

Accessing Network Share over specific Interface

· 52CE 我爱测

To make backups the server (windows) needs to be able to access a Network-Share from another windows server. In the firewall I have given permission to one of the interfaces to be able to do this access. However always when I try…

问题原文

原帖链接 · M.T · CC BY-SA 3.0

To make backups the server (windows) needs to be able to access a Network-Share from another windows server. In the firewall I have given permission to one of the interfaces to be able to do this access. However always when I try to open up the network share with \192.x.x.x\share$ it takes the other interface and the firewall would not allow it. Is there any way of forcing the server to take the other interface?

已采纳解答

原帖链接 · apocalysque · CC BY-SA 3.0

Windows does allow you the option of setting priority for network interfaces, but that will affect all traffic. To accomplish what you want Mike gave you the best solution.

If both interfaces on the source machine are on the same subnet, then you'll have to add a static/permanent route for both interfaces and give a LOWER metric for the interface that you prefer the traffic to use. Since the metric can be thought of as the "cost" of a route, the lower metric is chosen when routing.

> route ADD 157.0.0.0 MASK 255.0.0.0  157.55.80.1 METRIC 3 IF 2
         destination^      ^mask      ^gateway     metric^    ^
                                                     Interface^

For a routing entry for a single IP (host) you'll use a netmask for 255.255.255.255.

To get a list of your interfaces use:

netsh interface ipv4 show interfaces

The metric listed on this command is known as the default metric. The "Idx" is the interface "number" that you'll use when adding routes. If interface 1 has a default metric of 100 and interface 2 has a default metric of 200 and you want to force the traffic to use interface 2, then the routes you create must have a metric difference of 100+. For example you would add a route with a metric of 500 on interface 1 and a route with a metric of 10 on interface 2.

Use the -p switch to make a route permanent/persistent (survives a reboot).

E.g.;

route -p ADD 107.206.12.34 MASK 255.255.255.255 10.0.0.1 METRIC 300 IF 2

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2016-11-23)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 3.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。