Configure a route in windows to solve the problem that the Intranet and Internet are offline at the same time.

Source: Internet
Author: User

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 must meet the routing conditions.

Therefore, it will be directed to the gateway address 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 (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 ----- the path of Baidu Google can be found normally ----- Baidu Google cannot be found

Therefore, when you access Baidu Google, some request packets go through, 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 (Network Address) mask 255.255.0 (subnet mask) (gateway address)

Delete A route

Route delete (network address)
Change a route

Route change <span style = "font-family: Arial, Helvetica, sans-serif;"> (Network Address) mask (subnet mask) (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.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.