On a Windows 2016 Server, I need to set a custom route, so that connections to a specific destination ip address always use a specific source ip. But while the route add command allows me to specify the interface, it does not allow me to specify a source IP.

The server has one network interface with multiple IP addresses, e.g. both and are bound to this network interface, and the server is reachable by either IP:

Ethernet adapter myAdapter:
  IPv4 Address. . . . . :
  Subnet Mask . . . . . :
  IPv4 Address. . . . . :
  Subnet Mask . . . . . :
  Default Gateway . . . :

By default, all outgoing connections use as the source IP.

I need a route, so that all connections to one specific remote address ( always come from the second local ip (, because the device at is configured to only accept connections from, not from

c:>telnet 111
   This tcp connection should use as the origin IP

I can add a route with


However this does not change the source IP address Outgoing connections still originate from the IP

How can I specify which IP address the route should use, when both IPs have the same interface number?

Only connections to the IP should be affected by this route.
All other connections should continue to use the origin IP

Since this is a complicated legacy system mess, I am looking for a solution with minimal risk of affecting other connections, and without changes to existing software.

Therefore I would prefer not to change the global metrics for this interface, or split up the interfaces, if at all possible. A specific route affecting only ip would be ideal.

  • Routes are generally only refer to the destination address and gateway, not the source address. You would need to perform Network address translation (NAT) to make the desired configuration work. In particular, you want to utilize SNAT where the source address of an IP packet is being replaced. Windows server pretends to be capable of NAT (to be activated via Role->Remote Access->Routing), but it cannot perform SNAT in the way you want it. – Kevin K. Jul 18 '18 at 13:07

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Browse other questions tagged or ask your own question.