[Dos] [net] use the route command to solve the problem of dual-network access on one machine

Source: Internet
Author: User
Use the route command to enable dual-network access for one machine

We often encounter the need for a computer to access two networks at the same time (one is the Internet and the other is the enterprise intranet ).
Take this unit as an example: the address is fictitious ^_^
The machine has two NICs connected to the two switches.
Internet address: 218.22.123.123, subnet mask: 255.255.255.0, Gateway: 218.22.123.254
Intranet address: 10.128.123.123, subnet mask: 255.255.255.0, Gateway: 10.128.123.254
If you set the IP address and gateway of each network card according to the normal setting method, you will see it when you use Route print in cmd.
Network destination netmask Gateway Interface Metric
0.0.0.0 0.0.0.0 218.22.123.254 218.22.123.123 20
0.0.0.0 0.0.0.0 10.128.123.254 10.128.123.123 1
That is, there are two gateways pointing to 0.0.0.0, so there will be a route conflict and both networks will not be accessible. To access two networks at the same time, you must use the route command.
Step 1: Route Delete 0.0.0.0 "delete all 0.0.0.0 routes"
Step 2: Route add 0.0.0.0 mask 0.0.0.0 218.22.123.254 "add 0.0.0.0 network route"
Step 3: Route add 10.0.0.0 mask route 0.0.0 10.128.123.254 "add 10.0.0.0 network route"
In this case, you can access the two networks at the same time. However, if you encounter a problem, the route added using the above command will be automatically lost after the system restarts. How can you save the existing route table?
In Win2000, you can use Route add-P to add a static route. After restart, the route will not be lost. Note: remove the gateway that is connected to the NIC of the enterprise intranet in the TCP/IP settings before use.
If you do not have the-p Parameter in Win98, you can save the preceding command to A. BAT file and then call it at startup.

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: info-contact@alibabacloud.com 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.