Configure a route in windows to solve the problem that the Intranet and Internet are offline at the same time.
This is the most basic network knowledge, but I encountered this problem a few days ago and found that I almost forgot it. I will write it down here.
Basic Principles
First, the first two images
Set the Network Packet Flow under the correct route
There are two default route settings for the Network Packet Flow
When your computer is connected to the Intranet and Internet at the same time, it will send many network packets to different addresses. The first machine will cache a route table, and your network adapter will follow this route table, determine the next stop address of your network package.
Under normal circumstances, a route is set for accessing a special CIDR block address. For example, a packet destined for 10.11.12.0/24 must meet the routing conditions.
10.11.12.0 255.255.255.0 10.11.12.1
Therefore, it will be directed to the gateway address 10.11.12.1 and then find its own destination.
However, packets that do not meet the routing conditions will be routed to the default routing address, that is
0.0.0.0 0.0.0.0 192.168.1.1 (Default Gateway)
However, if your machine cache has two default network administrators, as shown in the figure below
Then there will be two routes for packages that could not be found, that is
0.0.0.0 0.0.0.0 192.168.1.1 ----- the path of Baidu Google can be found normally
0.0.0.0 0.0.0.0 10.11.12.1 ----- Baidu Google cannot be found
Therefore, when you access Baidu Google, some request packets go through 192.168.1.1, and some will go through another one.
The 192.168 package cannot return the result because the package is lost. The package that follows the other path directly enters the dead end and is directly lost.
Therefore, your network may be unstable. Because sometimes a batch of packages go through the 192.168 route, and you can access the Internet normally. After a batch of packages go wrong, you will not be able to access the Internet again.
Therefore, only one default route can be set on a computer, and this default route is a gateway that can access the Internet.
For access to the Intranet address, you only need to set an appropriate route for the Intranet CIDR block you want to access. Then, these routes will not go to the default network management because they cannot be found.
This is basically the truth.
Basic settings (in windows)
View local cache route table
Run in cmd
route print
There are two types of routes, temporary routes and permanent routes. The temporary routes disappear after you restart them, and the permanent route restarts the machine.
Add a route
Route add 10.11.12.0 (Network Address) mask 255.255.0 (subnet mask) 10.11.12.1 (gateway address)
Delete A route
Route delete 10.11.12.0 (network address)
Change a route
Route change <span style = "font-family: Arial, Helvetica, sans-serif;"> 10.11.12.0 (Network Address) mask 255.255.255.0 (subnet mask) 10.11.12.2 (gateway address)
Permanent Routing Problems
The route added above is a temporary route. If you want to change it to a permanent route, you can
The last use parameter-p of the route add command.
However, I do not recommend adding a permanent route here because it is troublesome to delete a permanent route. In addition, you can write the route you want to add into a batch file and double-click it to execute it.
However, if a permanent route already exists on your machine, you must delete it in the Registry
[HKEY_LOCAL_MACHINE \ SYSTEM \ CurrentControlSet \ services \ Tcpip \ Parameters \ PersistentRoutes]
[HKEY_LOCAL_MACHINE \ SYSTEM \ ControlSet001 \ services \ Tcpip \ Parameters \ PersistentRoutes]
[HKEY_LOCAL_MACHINE \ SYSTEM \ ControlSet002 \ services \ Tcpip \ Parameters \ PersistentRoutes]
Find the corresponding entry to delete.
In this way, I tried the experiment on the XP system, but I encountered some problems during the experiment on the Windows 7 system, and I was unable to delete the experiment smoothly.
Therefore, we do not recommend using permanent routes.