Some corporate network is divided into internal network and external networks, general network can not access the Internet, but do not provide external network, there is a demand on their own outside the network, it may be useful dual LAN, wireless LAN or wired LAN + Wired + wired. . .
This article is to solve this problem, the main approach is to modify the windows routing table.
Suppose (external network card) internet address: 192.168.43.56, Subnet Mask: 255.255.255.0, Gateway: 192.168.43.1
Internal (network card) Company website address: 10.180.121.68, Subnet Mask: 255.255.255.128, Gateway: 10.180.121.126
Note: your address card you can type ipconfig to see the corresponding card address information in CMD
If you set ip address and gateway of each card according to the normal setting method, and then use cmd'll see when the next route print view
Network Destination Netmask Gateway Interface Metric
0.0.0.0 0.0.0.0 192.168.43.1 192.168.43.56
0.0.0.0 0.0.0.0 10.180.121.126 10.180.121.68
However, this is a conflict because the two address points to the destination address is 0.0.0.0 but the next hop address is not the same, the only all high-priority card to access no priority higher than the line card wireless card.
Solve the problem
First fixed address what your external network card, network card does not need fixing
Step 1: Mount external network card ip
In the CMD command line
Step two: route delete 0.0.0.0 "delete all routes of 0.0.0.0"
The third step: route -p add 0.0.0.0 mask 0.0.0.0 192.168.43.1 metric 1 if 11 // external routes - means p add a permanent route, are not lost restart, metric priority, the priority of the external network It is set to 1, the highest priority
第四步:route -p add 10.0.0.0 mask 255.0.0.0 10.180.121.126 metric 2 if 8 // 内网路由 , 这样写包含的地址比较多,,内网10段的都可以访问 ,外网路由优先级设为2 ,优先级其次可以根据自己情况写掩码(如route -p add 10.180.0.0 mask 255.255.0.0 10.180.121.126 metric 2 if 8,就只能访问内网的10.180段了),if 是对应的端口好 route print可以看到
注意这里metric值很重要,优先的设为1, 其次的设为2最合适,不要乱设置,不然重启后还是上不了网。
加好永久路由的效果
这样设置重启也没事,内网外网都可以用!
测试结果: