Long time no update blog, sin Sin, and found recently some sites are always stealing my open source Chinese blog content, despise!
Business:
Business needs, a server, dual network cards, need to access both the external network and intranet. In the setup process, colleagues reflect the original use of the intranet address (192.168.1.100) in the setting of the Sisu network address after the bad, as long as the external network network card to stop the intranet can be normal access.
In fact, because you set up the intranet, and set up the outside network, after the gateway to the external network settings, because there is no default gateway, resulting in the intranet IP will also go outside the network gateway, it is certainly not possible. All we have to do is let the intranet go to their network card
Intranet network card: eth0 192.168.1.100 Gateway:192.168.1.100
External network card: eth1 119.222.222.222 Gateway:119.222.222.1
First, set the default gateway so that all IP packets are forwarded via 119.222.222.1 by default:
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 be added to the boot
Vi/etc/rc.local
Another: the command to delete the default gateway is as follows:
Route del Default
Linux Dual Network Interface (intranet) using Routing settings