Temp-Example of simultaneous Intranet and Internet access

Source: Internet
Author: User

 

@ Echo off


Rem // network administrators of many companies try to solve the problem of dual NICs. I will explain in detail how to use dual NICs at the same time so as to ensure the security of the Intranet, it can also solve the problem of computer access to the Internet. I hope you will like it.
Rem // first, your machine must have two NICs connected to the two switches respectively,
Rem // Internet address: 192.168.1.8, subnet mask: 255.255.255.0, Gateway: 192.168.1.1
Rem // intranet address: 172.23.1.8, subnet mask: 255.255.255.0, Gateway: 172.23.1.1
Rem // 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.
Rem // network destination netmask Gateway Interface Metric
Rem // 0.0.0.0 0.0.0.0 192.168.1.1 192.168.1.8
Rem // 0.0.0.0 0.0.0.0 172.23.1.1 172.23.1.8
Rem // that is, there are two gateways pointing to 0.0.0.0, so there will be a route conflict and neither of them can be accessed.
Rem // how can I access two networks at the same time? The route command is used.
Rem // Step 1: Route Delete 0.0.0.0 "delete all 0.0.0.0 routes"
Rem // Step 2: Route add 0.0.0.0 mask 0.0.0.0 192.168.1.1 "add 0.0.0.0 network route", which means you can access the Internet.
Rem // Step 3: Route add 172.23.0.0 mask route 0.0.0 172.23.1.1 "add 172.23.0.0 network route". Note that the mask is 255.0.0.0 rather than 255.255.255.0, so that multiple internal network segments are available.
Rem // 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?
Rem // route add-P adds 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.

Rem // set the local route table during startup
Rem // use NotePad to write the following command into a bat (that is, the extension is. bat batch files), run it at startup (or add a shortcut key to the startup Item to enable the computer to run automatically at each startup)
Rem // route add [Intranet network address] Mask [Intranet mask] [gateway to intranet] metric 1
Rem // route add 0.0.0.0 mask 0.0.0.0 [gateway to the Internet] metric 1
You need to change the content in rem // [] to a parameter suitable for your network ([] not retained after modification ).
Rem // This method does not disable any network adapter. The two networks are still working at the same time, but the packet delivery direction has changed, after this setting, you can ensure that the data to be sent to the financial network is not sent to the Internet, and the data to be sent to the financial network is not sent to the financial network!


@ Echo on
Route Delete 0.0.0.0 10.181.157.254
Route add 0.0.0.0 mask 0.0.0.0 192.168.191.1
Route add 10.181.0.0 mask 255.255.0.0 10.181.157.254

Ipconfig/all

Pause

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: 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.