hellwing 发表于 2007-6-15 10:05:05

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

我使用的是rh9,有两块网卡。
# 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
# route add default gw 192.168.1.1
# route del default gw 192.168.0.1
# service network restart
Shutting down interface eth0:                              
Shutting down interface eth1:                              
Shutting down loopback interface:                        
Disabling IPv4 packet forwarding:                        
Setting network parameters:                              
Bringing up loopback interface:                           
Bringing up interface eth0:                              
Bringing up interface eth1:                              
# 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上去了,设置几次了都是这样,请问这是为什么,该如何处理呢?

Axin 发表于 2007-6-20 14:42:52

在网卡配置文件里修改。

hew 发表于 2007-6-20 20:43:51

去掉eth1 的网关

qdzhuang 发表于 2007-6-21 15:58:00

rc.local加入

sccdyuebo 发表于 2007-7-23 11:32:46

U can modify /etc/sysconfig/network-scripts/ifcfg-eth0 file, add "GATEWAY=192.168.1.1" to it.
页: [1]
查看完整版本: 关于route命令的菜鸟问题,请各位大大指点。