Time can be amazing in this way. People tend to think that computer technology is a high technology, but TCP/IP has appeared in various forms over the past thirty years and is ubiquitous. Therefore, the TCP/IP protocol has time to become more mature and more stable and reliable. However, when it comes to computers, things are not that simple. When a route package passes through the network, an error may occur. In this case, it is very helpful to be familiar with the Windows route table. The route table determines the destination of data packets from faulty machines. In this article, I will show you how to view the Windows route table and how to make the data contained in the Windows route table meaningful.
View Windows route tables
The route table is an important part of the Windows TCP/IP protocol stack. However, the route table is not displayed to common users in Windows. If you want to see the ROUTE table, you must open a command prompt dialog box and enter the "route print" command. Then, you will see A graph similar to the one shown in Figure.
Figure A: the appearance of the Windows route table
Before I discuss this route table in depth, we recommend that you enter another command in the command prompt dialog box. This command is: IPCONFIG/ALL
The reason why I suggest you use the IPCONFIG/ALL command is that this command shows how the TCP/IP protocol is actually set on the machine. Indeed, you can carefully check the TCP/IP protocol on the NIC properties page. However, if you obtain this information from IPCONFIG, this information will be more reliable. In the past few years, I have encountered such examples that the information reported by IPCONFIG is completely different from the information displayed on the TCP/IP protocol settings screen on the machine. This is not common, but if this error occurs, you will encounter this mismatch. Frankly speaking, the information on the TCP/IP properties page reflects the TCP/IP protocol you want Windows to set for the selected network. The information provided by IPCONFIG shows the Protocol actually set in Windows.
Even if you haven't encountered some strange Windows errors, getting your configuration information from IPCONFIG is still very useful. If a machine has multiple NICs, it is very difficult to remember the settings bound to each Nic. IPCONFIG lists the various settings of each Nic shown in B, which is easy to read.
Figure B: IPCONFIG/ALL shows the TCP/IP settings for each Nic on this machine
Check Route table
When this article is about route tables, you may be wondering why I want you to execute the IPCONFIG/ALL command. The reason for this is that you generally never look at the route table unless your machine has a problem. If you encounter a problem, the best way to diagnose the fault is to compare the information provided by IPCONFIG with the information stored in the routing table.
As you can see in Figure B, the IPCONFIG/ALL screen displays some basic TCP/IP information, such as IP addresses and default gateways. However, the route table is not so easy to understand. Therefore, I have to spend some time discussing how to read the route table and what the information in the route table represents.
To understand the meaning of the information in these columns, you need to know a little about how the router works. The router works to coordinate the communication between one network and the other. Therefore, a vro contains multiple NICs, each of which is connected to different CIDR blocks.
When a user sends a data packet to a different network segment outside the local machine, the data packet will be sent to the router. The router will decide which network segment the data packet should be forwarded. It does not matter if the router is connected to two or more network segments. The decision-making process is the same, and the decision-making process is based on the route table.
If you want to view the content displayed on the screen after executing the "Route Print" command, you will find that the Route table is divided into five columns. The first column is the destination network address. Lists all the CIDR blocks connected to the vro. The netmask column provides the subnet mask of the network segment, rather than the subnet mask of the network adapter connected to the network segment. This basically allows the router to determine the destination network address class.
The third column is the gateway. Once the vro determines the destination network to which the packet will be forwarded, The vro will view the gateway list. The gateway table tells the router which IP address the packet should be forwarded to achieve the destination network.
The interface column tells the vro which Nic is connected to the appropriate destination network. Technically, the interface column only tells the IP address assigned to the NIC by the router. The network adapter connects the router to the destination network. However, the router is very smart and knows which physical Nic the address is bound.
The last column is the measurement. Measurement itself is a science. However, I will try to explain to you briefly what they do. One of the best ways I have heard of interpreting this is to use the airport vocabulary. Imagine that I need to fly from Garot, North Carolina to Miami, Florida. Because Garot airport is very large, I have many options to go to Miami. I can take a flight from Northwest Airlines. The flight took me to Detroit in Michigan and then flew from Detroit to Miami. I can also fly to Houston on a continental airline flight and then to Miami. Another option is to fly directly to Miami on an American Airline plane. Which line should I choose?
In real life, there are many factors worth considering, such as the plane ticket price and departure time. However, let's assume that everything is the same. If the flights are the same except for the routes, I will select the least stopover flights. It will make me reach the destination at the fastest speed. Due to the small number of stays, there will be fewer opportunities for problems in connection, and problems such as lost luggage will also be reduced.
Routing works in the same way. In many cases, a vro has many ways to send a data packet. In this case, it is meaningful to send data packets in the shortest (or the most reliable) path. This is where measurement plays a role. Windows generally does not view measurement columns unless there are many paths to a destination. If there are multiple paths, Windows will view the measurement column to determine the shortest path. This is a very simple explanation. However, this explanation illustrates the key points.
Additional Route Selection
I introduced the "Route Print" Command earlier. However, you can use the "Route" command to actually do many things. The parameters of the "Route" command are as follows:
ROUTE [-f] [-p] [command [destination] []
-The F switch is optional. This switch tells Windows to clear all gateway input records in the route table. If this-F switch is used with other commands, all gateway input records will be cleared before other commands in this command are executed.
The-p switch keeps the specified route unchanged. Generally, when the server is restarted, any ROUTE you specify using the "ROUTE" command will be deleted. The-p switch tells Windows to retain this route, even if the system restarts.
The command section of the "ROUTE" command parameter is relatively simple. This command set contains four options: PRINT, ADD, DELETE, and CHANGE. I have introduced the "ROUTE PRINT" command to you. This command contains other options. For example, you can use wildcards with this command. For example, if you only need to output a ROUTE related to the 192. x subnet, you can use this command: "route print 192 *".
The "route delete" command works very similar to "route print. Simply enter the "route delete" command, and then enter the destination address and gateway you want to DELETE from the routing table. For example, if you want to DELETE the 192.0.0.0 gateway, you can enter this command: "route delete 192.0.0.0 ".
The basic parameters of the "route change" and "route add" commands are the same. When you enter this command, you must specify the destination, subnet mask, and gateway. You can also specify a measurement and an interface. However, this is optional. For example, if you want to ADD a destination using the lowest parameter, you can enter the following command: route add 147.0.0.0 255.0.0.0 148.100.100.100
In this command, 147.0.0.0 is your newly added destination address. 255.0.0.0 is the subnet mask of the destination address, and 148.100.100.100 is the gateway. You can use the METRIC and IF parameters to expand the functionality of this command. Example: route add 147.0.0.0 255.0.0.0 148.100.100.100 METRIC 1 IF 1
You can choose to measure this parameter. However, it specifies the number of measurement or route hops. The IF parameter indicates which Nic is used by Windows. In this special case, Windows uses the NIC bound to Windows as interface 1. IF you do not use the IF parameter, Windows will search for the best available Nic.
Conclusion
In this article, I explained how to use the "ROUTE" command to display Windows ROUTE tables, and how to modify these ROUTE tables if necessary. If you need some extra help, enter "ROUTE /?" Command to get more parameter examples.
Translation: Dongyuan