Home >Common Problem >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!