路由配置:
1、路由转发配置
net.ipv4.ip_forward = 1 (要想路由生效需配置路由转发)
2、添加临时路由
route add -host 192.168.1.2 dev eth0
route add -host 10.20.30.148 gw 10.20.30.40
route add -net 10.20.30.48 netmask 255.255.255.248 gw 10.20.30.41
route add default gw 192.168.1.1 添加默认路由
route del -host 192.168.1.2 dev eth0 删除一条路由
2、添加永久路由
vim /etc/sysconfig/network-scripts/route-em1
172.30.149.176/28 via 10.119.33.97 dev em1
10.1.93.231/32 via 10.122.165.254 dev em1 metric 501