On Windows 7 I have been using the command route add to add routing entries with a gateway. I now want to add a routing entry with no gateway, where the route is directly reachable.

Windows 7 calls such routes "on-link". I have tried creating on-link routes using the route add command and omitting the gateway entry, but that hasn't worked.

How can I create an on-link route in Windows 7?


You need to put in the gateway entry to create an "on-link" route.

For example, enter the following command in cmd.exe or bash:

route add mask

  • Please describe steps required to do it. – gronostaj Jul 2 '13 at 14:46
  • 2
    how do I specify the interface? – Jroonk Feb 5 '19 at 2:49
  • What's the on-link for IPV6? – Shayan Nov 23 '19 at 21:27

You can add an interface using the command

route add mask IF <26>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.