假设CentOS缺省网关是74.86.49.129,通常做法
# vi /etc/sysconfig/network # /etc/init.d/networking restart 也可以通过setup程序设置网卡的缺省网关,但在有多块网卡的情况下,www.linuxidc.com总是最后一块网卡的缺省网关有效,有时候这并不符合我们的期望。 根据网卡设置路由的方法是编辑 /etc/sysconfig/network-scripts/route-eth* 文件, Open /etc/sysconfig/network and append GATEWAY=eth0.gateway.IP.address Open /etc/sysconfig/network-scripts/route-eth1 and add routing for eth1 and restart it. For example: 202.54.1.2/29 via 202.54.2.254 Also, set static route for /etc/sysconfig/network-scripts/route-eth0: 10.1.2.3/8 via 10.10.38.95 Do not add gateway entries to /etc/sysconfig/network-scripts/ifcfg-eth1 and /etc/sysconfig/network-scripts/ifcfg-eth0 (责任编辑:IT) |