System Environment: CentOS Linux
network environments: two IP address, 192.168.0.10 and 10.10.30.2, the mask is 255.255.255.0,
gateway address these two subnets are 192.168.0.1 and 10.10.30.1 respectively.
- For the network card eth0 the ip address 192.168.0.10, the ip address for the network card is 10.10.30.2 eth1 configuration file:
/etc/sysconfig/network-scripts/ifcfg-eth0
/etc/sysconfig/network-scripts/ifcfg-eth1
- Configure the default gateway to any one. The default gateway interface system determines when the initiative to use the network, using.
Configuration file: / etc / sysconfig / network
Modify the following
NETWORKING=yes (表示系统是否使用网络,一般设置为yes。如果设为no,则不能使用网络)
HOSTNAME=centos (设置本机的主机名,这里设置的主机名要和/etc/hosts中设置的主机名对应)
GATEWAY=192.168.0.1 (设置本机连接的默认网关的IP地址。)
- Edit routing table
. A modified / etc / iproute2 / rt_tables, add content:
252 net2
251 net3
b. # / etc / rc.local add backtrack route
ip route flush table net2
ip route add default via 192.168.0.1 dev eth0 src 192.168.0.10 table net2
ip rule add from 192.168.0.10 table net2
ip route flush table net3
ip route add default via 10.10.30.1 dev eth1 src 10.10.30.2 table net3
ip rule add from 10.10.30.2 table net3