Chinaunix

标题: route命令添加路由出现错误(急) [打印本页]

作者: heroooooo    时间: 2006-06-17 07:33
标题: route命令添加路由出现错误(急)
[root@localhost ~]# ifconfig
eth0      Link encap:Ethernet  HWaddr 00:04:61:AC:1E:9E
          inet addr:192.168.1.38  Bcast:192.168.1.255  Mask:255.255.255.0
          inet6 addr: fe80::204:61ff:feac:1e9e/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:4 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:524 (524.0 b)  TX bytes:0 (0.0 b)
          Interrupt:18 Base address:0x2000

lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:71 errors:0 dropped:0 overruns:0 frame:0
          TX packets:71 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:5099 (4.9 KiB)  TX bytes:5099 (4.9 KiB)

[root@localhost ~]#
________________________________________________________________________________
[root@localhost ~]# route
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
192.168.1.0     *               255.255.255.0   U     0      0        0 eth0
169.254.0.0     *               255.255.0.0     U     0      0        0 eth0

[root@localhost ~]#
(这个是我用ctrl+c强行结束的 ,等了半天没有反应)





找了点资料,还有和我已安装的虚拟机下的route返回结果相比较,看到route少了一条"default 192.168.1.1 0.0.0.0 UG 0 0 0 eth0",
____________________________________

可是我尝试添加路由,用命令"route add default gw 192.168.1.1"时,不能成功,出现错误"SIOCADDRT 文件已存在",baidu,google了半天也没有找到解决的办法.. 望各位高手帮我解决,谢谢了..
PS:这个 问题搞了我好几天了..
作者: strongzgy    时间: 2006-06-17 10:18
标题: 回复 1楼 heroooooo 的帖子
出现这个siocaddrt file exists, 表示你添加了一个已经存在的路有选项
SIOADDRT is an error message ADDing a RouTe.
SIODELRT is an error message DELeting a RouTe
SIOCADDRT: File exists
means:
You are adding a route that exists already.

作者: heroooooo    时间: 2006-06-17 11:49
可是我现在上不了网啊..你说的这个问题该怎么解决呢??我在线等..
作者: kenduest    时间: 2006-06-17 13:05
route -n 貼一下 routing table 資訊。

==
作者: heroooooo    时间: 2006-06-17 13:25
[root@localhost ~]# 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.1     0.0.0.0         UG    0      0        0 eth0
[root@localhost ~]#
作者: skyy23    时间: 2006-06-17 15:59
原帖由 heroooooo 于 2006-6-17 13:25 发表
0.0.0.0         192.168.1.1     0.0.0.0         UG    0      0        0 eth0


这不已经是默认路由了..
作者: heroooooo    时间: 2006-06-17 16:21
那怎么还上不了网呢??
作者: kenduest    时间: 2006-06-17 16:56
原帖由 heroooooo 于 2006-6-17 16:21 发表
那怎么还上不了网呢??


1. arping 192.168.1.1 有回應嗎 ?

2. iptables-save 執行結果為何 ?

==
作者: skyy23    时间: 2006-06-17 16:59
service iptables stop (不知道你装的什么版本)

ping 一下网关,看通不通

随便ping一个网站,看地址能不能解析

linux dns设置, /etc/resolv.conf

[ 本帖最后由 skyy23 于 2006-6-17 17:02 编辑 ]
作者: heroooooo    时间: 2006-06-17 17:33
原帖由 kenduest 于 2006-6-17 16:56 发表


1. arping 192.168.1.1 有回應嗎 ?

2. iptables-save 執行結果為何 ?

==


arping 192.168.1.1也没有会应.

iptables-save 没有结果显示出来.我用了service iptables stop
作者: heroooooo    时间: 2006-06-17 17:36
原帖由 skyy23 于 2006-6-17 16:59 发表
service iptables stop (不知道你装的什么版本)

ping 一下网关,看通不通

随便ping一个网站,看地址能不能解析

linux dns设置, /etc/resolv.conf



这个是设置DNS吧?我设置了两个,和WIN下一样
作者: skyy23    时间: 2006-06-17 19:08
你ping了吗?域名能解析吗?
作者: kenduest    时间: 2006-06-17 19:16
原帖由 heroooooo 于 2006-6-17 17:33 发表
arping 192.168.1.1也没有会应.
iptables-save 没有结果显示出来.我用了service iptables stop


网路卡坏了吗?还是你挂错 nic module 甚至线路没接好?

你用哪种型号网路卡 ? 你是挂入哪种 nic kernel module ? 你执行 mii-tool 可以查阅 eth0 的状态吗 ?

==
作者: 扫净缘客    时间: 2006-06-18 21:37
首先你要确定你的192.168.1.1的ip掩码是/24.否则你是不会通的

既然你说你用的是虚拟机.那你安装虚拟机的网段是多少呢?

既然有了默认路由.那你ping 192.168.1.1应该是有回应的

除非你的虚拟机网卡设置的不是桥式

另外你的DNS是否写了?

/etc/resolv.conf

还有/etc/sysctl.conf中是否将nat打开了呢?

问题很多种.另外就是你在安装linux时.模式是把firewall开放还是关闭?

问题比较多.你说的也不清楚.你再找找问题吧
作者: 55388863    时间: 2006-06-23 16:14
我也出现了这个问题,DNS已经配了,可以解析域名,防火墙开了,怎么解决,请高手帮下




欢迎光临 Chinaunix (http://bbs.chinaunix.net/) Powered by Discuz! X3.2