https://my.oschina.net/7shell/blog/308887
Company business needs, a server, dual network card, the need to access both the extranet and intranet. In the setup process, colleagues reflect the original use of the intranet address (192.168.1.100) in the setting of the external network address changed bad, as long as the outside network that network card can be normal access to the intranet.
In fact, because you set up the intranet, and then set the external network, in the network after the gateway set up, because there is no default gateway, resulting in intranet IP will also take the gateway of the extranet, it is certainly not possible. All we have to do is let the intranet go through its own network card.
Intranet network card: eth0 192.168.1.100 Gateway: 192.168.1.100
External Network network card: eth1 119.222.222.222 Gateway: 119.222.222.1
First set the default gateway so that all IP packets are forwarded by default via 119.222.222.1:
Route add default GW 119.222.222.1
Then, separate for the intranet set forwarding special case, all 192.168 start, all go eth0
Route add-net 192.168.0.0 netmask 255.255.0.0 Dev eth0
The best route to add is to boot up
Vi/etc/rc.local
Another: the command to delete the default gateway is as follows:
Route del Default