Remember to maintain security and privacy. Do not share sensitive information. Procedimento.com.br may make mistakes. Verify important information. Termo de Responsabilidade

How to Add a Static Route in Windows Using the \route add\ Command

The "route add" command is a useful tool in Windows for network administrators who need to manually manipulate the routing table. This command allows you to add static routes, which can direct network traffic through specific paths. This is particularly useful in complex network environments where traffic needs to be controlled or rerouted for performance or security reasons.

Examples:

  1. Basic Route Addition:

    To add a basic static route, you would use the following command in the Command Prompt (CMD):

    route add 192.168.1.0 mask 255.255.255.0 192.168.0.1

    In this example:

    • 192.168.1.0 is the destination network.
    • mask 255.255.255.0 specifies the subnet mask for the destination.
    • 192.168.0.1 is the gateway through which the traffic should be routed.
  2. Persistent Route:

    If you want the route to persist after a reboot, you can add the -p flag:

    route -p add 192.168.1.0 mask 255.255.255.0 192.168.0.1

    The -p flag ensures that the route remains in the routing table even after the system is restarted.

  3. Specifying a Metric:

    You can also specify a metric for the route, which determines the priority of the route. Lower metrics have higher priority:

    route add 192.168.1.0 mask 255.255.255.0 192.168.0.1 metric 1

    Here, metric 1 sets the priority of this route to be higher than routes with a higher metric value.

  4. Removing a Route:

    To remove a static route, you would use the route delete command:

    route delete 192.168.1.0

    This command removes the route to the 192.168.1.0 network from the routing table.

Note: It is important to run these commands in an elevated Command Prompt (Run as Administrator) to ensure you have the necessary permissions to modify the routing table.

To share Download PDF

Gostou do artigo? Deixe sua avaliação!
Sua opinião é muito importante para nós. Clique em um dos botões abaixo para nos dizer o que achou deste conteúdo.