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.