QQ登录

只需一步,快速开始

 找回密码
 注册

QQ登录

只需一步,快速开始

查看: 2303|回复: 4

关于route命令的菜鸟问题,请各位大大指点。

[复制链接]
发表于 2007-6-15 10:05:05 | 显示全部楼层 |阅读模式
我使用的是rh9,有两块网卡。
[root@localhost root]# 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
192.168.0.0     0.0.0.0         255.255.255.0   U     0      0        0 eth1
169.254.0.0     0.0.0.0         255.255.0.0     U     0      0        0 eth1
127.0.0.0       0.0.0.0         255.0.0.0       U     0      0        0 lo
0.0.0.0         192.168.0.1     0.0.0.0         UG    0      0        0 eth1
[root@localhost root]# route add default gw 192.168.1.1
[root@localhost root]# route del default gw 192.168.0.1
[root@localhost root]# service network restart
Shutting down interface eth0:                              [  OK  ]
Shutting down interface eth1:                              [  OK  ]
Shutting down loopback interface:                          [  OK  ]
Disabling IPv4 packet forwarding:                          [  OK  ]
Setting network parameters:                                [  OK  ]
Bringing up loopback interface:                            [  OK  ]
Bringing up interface eth0:                                [  OK  ]
Bringing up interface eth1:                                [  OK  ]
[root@localhost root]# 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
192.168.0.0     0.0.0.0         255.255.255.0   U     0      0        0 eth1
169.254.0.0     0.0.0.0         255.255.0.0     U     0      0        0 eth1
127.0.0.0       0.0.0.0         255.0.0.0       U     0      0        0 lo
0.0.0.0         192.168.0.1     0.0.0.0         UG    0      0        0 eth1

eth0的网关是192.168.1.1,想把他作为默认路由,可是设置之后重新启动网络,查看route,默认路由又回到eth1的192.168.0.1上去了,设置几次了都是这样,请问这是为什么,该如何处理呢?
发表于 2007-6-20 14:42:52 | 显示全部楼层
在网卡配置文件里修改。
回复

使用道具 举报

发表于 2007-6-20 20:43:51 | 显示全部楼层
去掉eth1 的网关
回复

使用道具 举报

发表于 2007-6-21 15:58:00 | 显示全部楼层
rc.local加入
回复

使用道具 举报

发表于 2007-7-23 11:32:46 | 显示全部楼层
U can modify /etc/sysconfig/network-scripts/ifcfg-eth0 file, add "GATEWAY=192.168.1.1" to it.
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

GMT+8, 2024-4-19 22:43 , Processed in 0.077337 second(s), 15 queries .

© 2021 Powered by Discuz! X3.5.

快速回复 返回顶部 返回列表