linux添加静态路由(rhel5.4)

来源:互联网 发布:魔兽世界优化 编辑:程序博客网 时间:2024/05/22 05:25

环境:rhel5.4

目的:如题

结果如下:

[root@localhost network-scripts]# route -n
Kernel IP routing table
Destination     Gateway            Genmask              Flags Metric Ref    Use  Iface
192.168.1.0     0.0.0.0               255.255.255.0       U         0        0        0       eth0
169.254.0.0     0.0.0.0               255.255.0.0           U          0        0        0       eth0
0.0.0.0             192.168.1.10    0.0.0.0                    UG        0        0        0       eth0

中间那条169.254.0.0非我所愿,原因待查

参考如下博客中的第一种方法

http://tilt.lib.tsinghua.edu.cn/node/659

vi /etc/sysconfig/network-scripts/route-eth0

192.168.1.0/24 dev eth0
0.0.0.0/0 via 192.168.1.10 dev eth0

service network restart

ping 163.com


/* the end */

原创粉丝点击