Home  >  Article  >  How to use both internal and external networks at the same time

How to use both internal and external networks at the same time

王林
王林Original
2019-10-25 16:43:3532915browse

How to use both internal and external networks at the same time

Step 1: Delete the default route

route delete 0.0.0.0

Note: Delete all 0.0.0.0 routes. This is the default route for accessing the external network

Step 2: Add static route

(Assume that the internal network segment is 192.168.10.x, the gateway is 192.168.10.1; the external network segment is 192.168.20. x, the gateway is 192.168.20.1)

Configure the intranet static route first:

route add 192.168.10.0 mask 255.255.255.0 192.168.10.1 -p

Note: It means that all data accessing the 192.168.10.0 network segment must pass through the gateway 192.168. 10.1, -p means permanent addition, it will still be valid after restarting

Configure external network static routing:

route add 0.0.0.0 mask 0.0.0.0 192.168.20.1 -p

Note: It means you can go to the external network and access all The data must pass through the external network gateway 192.168.20.1. -p means to add it permanently and it will still be valid after restarting.

Step 3: After the settings are completed, check again to see if the routing table has been modified.

Enter route print in the command window to display the local routing table.

Note: This method is suitable for multiple network cards, such as three network cards, four network cards, etc. But once the network card is disabled and then enabled, then the static settings we set The route will be lost. This method can be used if we want to clear static routes.

The above is the detailed content of How to use both internal and external networks at the same time. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn