Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use the windows native routing route command

2025-03-10 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This article will explain in detail how to use the route command for windows native routing. The editor thinks it is very practical, so I share it with you as a reference. I hope you can get something after reading this article.

Route is used to display, manually add and modify routing table items. Most hosts typically reside on a network segment connected to only one router. Because there is only one router, there is no question of which router to use to publish the packet to the remote computer, and the IP address of that router can be entered as the default gateway for all computers on that segment. However, when there are two or more routers on the network, you don't necessarily want to rely on the default gateway. In fact, you may want some of your remote IP addresses to be passed through a particular router, while other remote IP addresses may be passed through another router.

Route print-- this command is used to display the current items in the routing table, all of which are automatically added because the network card is configured with an IP address.

The route command is mainly used to manually configure static routing tables, and its parameters can be typed as route /? under cmd. To check it out. The following describes the use of its main commands:

The route add command adds routing items to the native routing table. For example, if you want to set a route to the destination network 210.98.32.33 through five router segments, first through a router on the local network with an IP of 202.16.123.5 and a subnet mask of 255.255.255.224, you should enter the following command:

Route add 210.98.32.33 mask 255.255.255.224 202.16.123.5 metric 5

Route change-- you can use this command to modify the routing of data, but you cannot use this command to change the destination of the data. The following example reroutes the data to another router, using a straighter path that contains three network segments:

Route change 210.98.32.33 mask 255.255.255.224 202.16.123.250 metric 3

Route delete-- uses this command to delete routes from the routing table. For example:

Route delete 210.98.32.33

It also has two important parameters, which are also useful.

-f

Clear all entries that are not primary routes (routes with a subnet mask of 255.255.255.255), loopback network routes (with a destination of 127.0.0.0 with a subnet mask of 255.255.255.0), or multicast routes (with a destination of 224.0.0.0, routes with a subnet mask of 240.0.0.0). If it is used in conjunction with one of the commands, such as Add, Change, or Delete, the table is cleared before running the command.

-p

When used with the Add command, the specified route is added to the registry and the IP routing table is initialized when the TCP/IP protocol is started. By default, added routes are not saved when the TCP/IP protocol is started, and when used with the Print command, a list of permanent routes is displayed. All other commands ignore this parameter. Permanent routes are stored in the registry at HKEY_LOCAL_MACHE\ SYSTEM\ CurrentControlSet\ Services\ Tcpip\ Parameters\ PersistentRoutes.

Note the example in the following figure:

There is no entry under persistent routers below. Add the / p parameter and see:

Network A (Internet) IP:59.40.77.13 subnet mask: 255.255.255.0 Gateway: 59.40.77.254

Network B (LAN): 192.168.0.1 Subnet Mask: 255.255.255.0 Gateway: 192.168.0.254

The specific settings are as follows:

1. Set up a fixed IP and gateway for network A (Internet) and a fixed IP for network B (local area network), leaving the gateway empty.

2. Set the gateway of network card An as the default gateway, that is, the hop of network card An is set to 1. (hop setting method: in the advanced properties of TCP/IP, remove the tick before "automatic hop count" in the lower part of the window and fill in 1)

3. Enter route print under CMD to view the default gateway

Default Gateway: 59.40.77.254

4. Add a route and open CMD to run:

Route-p add 192.168.0.0 mask 255.255.0.0 192.168.0.1 metric 30

(it means to forward the request for the address range 192.168 to 192.168.0.1. The parameter "mai Zhe p" represents a permanent write to the routing table. If this parameter is not added, the setting will be lost every time the machine is rebooted, so it needs to be reset. )

This is the end of this article on "how to use route commands for windows native routing". I hope the above content can be helpful to you so that you can learn more knowledge. if you think the article is good, please share it for more people to see.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report