First, we need to declare that it is impossible for a computer with two NICs to have two gateways, because the default gateway can only be one.
Server Security
Install two NICs and set different IP addresses and gateways (intranet and Internet) respectively. access from the Internet through the Internet Nic. access from the Intranet through the Intranet Nic seems easy to implement, but in fact it's hard, because
The default gateway can only be one!
The solution is:
1. Set a network card (such as the Internet) to the default gateway;
2. manually add a static route so that the data of another network segment (Intranet) passes through the second network card. Use the route command. The command example is as follows, hoping to help some comrades with a little effort.
Reference command:
Example 1: Route add-P 10.0.0.0 mask 255.255.255.0
10.40.4.200 (enable 10.0.0.1 access to the network adapter 10.40.4.200, And the subnet mask is next to the mask)
Example 2: Route
Add-P 10.0.0.0 mask 255.0.0.0 10.40.4.200
Example 3: Route add-P
0.0.0.0 mask 0.0.0.0 10.40.4.200 (needless to say, let all the access go through 10.40.4.200)
Note:
1. With the-p Parameter added, the added route is a permanent route and will not be initialized because the computer restarts. 10.40.4.200 is the IP address of my computer Nic. Enter route
You can get more help.
2. If your computer already has two gateways (for example, using SoftEther), use Route
Print can see two 0.0.0.0 routes. You can delete the 0.0.0.0 route and then add it again.
Route Delete
0.0.0.0 "delete all 0.0.0.0 routes"
Appendix: when searching for information on the Internet, you may often find someone asking similar questions.
It can be seen that you are unfamiliar with routing knowledge. The following information is provided for your reference:
1, the interpretation of the route command http://www.kpcn.org/news/Read.asp? Newsid= 8527
2,
Learn Windows Network commands route command small files http://www.kpcn.org/news/Read.asp? Newsid= 8528
========== The content of another article ==============
A computer often needs to access two networks at the same time.
Network (Internet, enterprise intranet) requirements. Take this unit as an example: the address is fictitious ^_^
The machine has two NICs connected to the two switches.
Internet location
Address: 218.22.123.123, subnet mask: 255.255.255.0, Gateway: 218.22.123.254
Enterprise Intranet location
Address: 10.128.123.123, subnet mask: 255.255.255.0, Gateway: 10.128.123.254
If you set each network according to the normal setting method
The IP address and gateway of the card. 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.
First
Step: 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"
Third
Step: Route add 10.0.0.0 mask route 0.0.0 10.128.123.254 "add 10.0.0.0
Network routing"
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 that you need to remove the gateway that is connected to the NIC of the enterprise intranet in the TCP/IP settings before use.
==================Configure the route table for dual-Gateway network interfaces in Linux
==================
Http://hi.baidu.com/xibeihuohu/blog/item/a54d27fd18b8bf1f08244d1a.html
Due to the interconnection between China Telecom and China Netcom, many people choose dual-line data centers,
The so-called dual-line data center has two outlets, one for China Telecom and one for China Netcom. I recently tested a server in a dual-line data center and intend to use it as the database server of the Forum. The server operating system is
Linux. We plan to configure Dual IP addresses and dual domain names so that viewers can access the server through both the Telecom and China Netcom lines. When configuring the network
By default, there is only one gateway in Linux. After a long query on the network, I found a solution, so I sorted it out. Thanks to the original author jac003ke.
Server Operation System
RedHat Linux 9 and set two route tables
1. VI/etc/iproute2/rt_tables, adding two route tables: China Netcom and China Telecom
251
Tel Telecom route table
252 CNC Netcom route table
2. Bind two addresses to the network card for two lines: China Telecom and China Netcom.
IP ADDR
Add 192.168.0.2/24 Dev eth0
Ip addr add 10.0.0.2/24 Dev eth1
3,
Set the route table of China Telecom and China Netcom respectively
China Telecom route table:
# Make sure to find the local subnet
IP Route add 192.168.0. 0/24
Via 192.168.0.2 Dev eth0 table Tel
# Internal loopback network
IP Route add
127.0.0.0/8 Dev lo table Tel
#192.168.0.1 is the default gateway address of the Telecom Network
IP Route add
Default via 192.168.0.1 Dev eth0 table Tel
China Netcom route table:
# Make sure to find the local subnet
IP
Route add 10.0.0.0/24 Via 10.0.0.2 Dev eth1 table CNC
# Internal loopback network
IP
Route add 127.0.0.0/8 Dev lo table CNC
#10.0.0.1 is the default gateway of China Netcom.
IP Route
Add default via 10.0.0.1 Dev eth1 table CNC
4. China Telecom and China Netcom have their own route tables and policies,
Let the response packet of 192.168.0.2 go through the route table of China Telecom, and the response packet of 10.0.0.2 goes through the route table of China Netcom.
IP rule add from
192.168.0.1 table Tel
IP rule add from 10.0.0.1 table CNC