redhat问题:能ping通网关和本网段的IP,但是不能ping通DNS,也不能上网
(2011-12-20 06:11:51)
标签:
上网
杂谈
redhat问题:能ping通网关和本网段的IP,但是不能ping通DNS,也不能上网查看路由的信息如下:
输入netstat -nr 后只显示如下信息
[root@machine1 /]$ netstat -nr
Kernel IP routing table
Destination Gateway Genmask Flags MSS
192.168.28.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
是不是路由设置不多还是什么,也没有看到default gateway
还请高手解答一下,谢谢!楼主是不是网卡没设置网关?[b]回复 [i]chenyx[/i] [/b]
我也不知道,怎么知道网卡是否设置了网关?
但是我ping网关是可以通的阿cat /etc/sysconfig/network-scripts/ifcfg-eth0
贴下
[b]回复 [i]chenyx[/i] [/b]
[root@S093 ~]# cat /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0
BOOTPROTO=none
BROADCAST=192.168.28.255
HWADDR=**
IPADDR=192.168.28.64
NETMASK=255.255.255.0
NETWORK=192.168.28.0
ONBOOT=yes
TYPE=Ethernet
USERCTL=no
IPV6INIT=no
PEERDNS=no
GATEWAY=192.168.28.1
DHCP_HOSTNAME=S093
[root@S093 ~]#DHCP_HOSTNAME=S093,去掉,重启下network服务看看
要是还没有,cat /etc/sysconfig/network,看看有没有GATEWAY的行[b]回复 [i]chenyx[/i]
[/b]
去掉了还是不行,在network里面加上GATEWAY=192.168.28.1也是不行挺奇怪的.
你试试用命令添加网关看看.
ip route add default gw 192.168.28.1[b]回复 [i]chenyx[/i] [/b]
不行,提示如下信息
[root@S093 ~]# ip route add default gw 192.168.28.1
Error: either "to" is duplicate,
or "gw" is a garbage.
[root@S093 ~]#ip route add default via 192.168.28.1
换这个[b]回复 [i]chenyx[/i] [/b]
还是不行
[root@S093 ~]# ip route add default gw 192.168.28.1
Error: either "to" is duplicate,
or "gw" is a garbage.
[root@S093 ~]#
[root@S093 ~]# ip route add 0.0.0.0/0 via 192.168.28.1
RTNETLINK answers: Invalid argument
[root@S093 ~]# ip route show
192.168.28.0/24 dev eth0proto kernelscope linksrc
192.168.28.64
[root@S093 ~]# ip route add 192.168.28.0/24 via 192.168.28.1
RTNETLINK answers: Invalid argument
[root@S093 ~]#
[root@S093 ~]# ip route add default via 192.168.28.1
RTNETLINK answers: Invalid argument
[root@S093 ~]#楼主service network restart重启下network服务看看
你的现象太诡异了[b]回复 [i]chenyx[/i] [/b]
可以上网了,折腾了一晚上,非常感谢chenyx!纪梵希!![b]回复 [i]lhm1003[/i] [/b]
怎么解决的,把解决过程写出来[b]回复 [i]chenyx[/i] [/b]
就是按照你说的service network restart重启下network服务就可以了[b]回复 [i]lhm1003[/i]
[/b]
如果是能ping通网关和本网段的IP,但是不能ping通DNS,也不能上网,
需要再service network restart重启下network服务就可以ping通DNS和上网了。
不知道这是为什么呢?不清楚.
楼主重启下系统,看看是否正常[b]回复 [i]chenyx[/i] [/b]
重启之后还是不能上网,必须service network restart后就可以上网了,不知道为什么?那确实挺诡异.
楼主检查下系统日志,看看网卡启动的时候有什么状况[b]回复 [i]chenyx[/i] [/b]
重启之后看boot.log里面的文件内容,好像看不出什么异常
May8 21:25:38 S093 cups-config-daemon: cups-config-daemon -TERM
succeeded
May8 21:25:38 S093 haldaemon: haldaemon -TERM succeeded
May8 21:25:38 S093 messagebus: messagebus -TERM succeeded
May8 21:25:38 S093 atd: atd shutdown succeeded
May8 21:25:38 S093 cups: cupsd shutdown succeeded
May8 21:25:38 S093 xfs: xfs shutdown succeeded
May8 21:25:38 S093 canna: Stopping Canna server: succeeded
May8 21:25:38 S093 gpm: gpm shutdown succeeded
May8 21:25:38 S093 sshd: sshd -TERM succeeded
May8 21:25:38 S093 sendmail: sendmail shutdown succeeded
May8 21:25:39 S093 sendmail: sm-client shutdown succeeded
May8 21:25:39 S093 smb: smbd shutdown succeeded
May8 21:25:39 S093 smb: nmbd shutdown succeeded
May8 21:25:39 S093 vsftpd: vsftpd shutdown succeeded
May8 21:25:39 S093 xinetd: xinetd shutdown succeeded
May8 21:25:39 S093 acpid: acpid shutdown succeeded
May8 21:25:39 S093 crond: crond shutdown succeeded
May8 21:25:39 S093 netfs: Unmounting SMB
filesystems:succeeded
May8 21:25:39 S093 nfslock: rpc.statd shutdown succeeded
May8 21:25:40 S093 irqbalance: irqbalance shutdown succeeded
May8 21:25:40 S093 portmap: portmap shutdown succeeded
May8 21:28:14 S093 syslog: syslogd startup succeeded
May8 21:28:14 S093 syslog: klogd startup succeeded
May8 21:28:14 S093 irqbalance: irqbalance startup succeeded
May8 21:28:14 S093 portmap: portmap startup succeeded
May8 21:28:15 S093 nfslock: rpc.statd startup succeeded
May8 21:28:15 S093 rpcidmapd: rpc.idmapd startup succeeded
May8 21:28:15 S093 netfs: Mounting other
filesystems:succeeded
May8 21:28:15 S093 rc: Starting lm_sensors:succeeded
May8 21:28:15 S093 autofs: automount startup succeeded
May8 21:28:15 S093 acpid: acpid startup succeeded
May8 21:28:15 S093 rc: Starting hpoj:succeeded
May9 05:27:17 S093 rc.sysinit: -e
May9 05:27:18 S093 start_udev: Starting udev:succeeded
May9 05:27:23 S093 rc.sysinit: -e
May9 05:27:28 S093 sysctl: net.ipv4.ip_forward = 0
May9 05:27:28 S093 sysctl: net.ipv4.conf.default.rp_filter =
1
May9 05:27:28 S093 sysctl:
net.ipv4.conf.default.accept_source_route = 0
May9 05:27:28 S093 sysctl: kernel.sysrq = 0
May9 05:27:28 S093 sysctl: kernel.core_uses_pid = 1
May9 05:27:28 S093 rc.sysinit: Configuring kernel
parameters:succeeded
May8 21:27:28 S093 date: Sun May8 21:27:28 CST 2011
May8 21:27:28 S093 rc.sysinit: Setting clock(localtime): Sun May8
21:27:28 CST 2011 succeeded
May8 21:27:28 S093 rc.sysinit: Loading default keymap
succeeded
May8 21:27:28 S093 rc.sysinit: Setting hostname
S093:succeeded
May8 21:27:28 S093 rc.sysinit: Checking root filesystem
succeeded
May8 21:27:28 S093 rc.sysinit: Remounting root filesystem in
read-write mode:succeeded
May8 21:27:28 S093 lvm.static: No volume groups found
May8 21:27:28 S093 rc.sysinit: Setting up Logical Volume
Management: succeeded
May8 21:27:28 S093 rc.sysinit: Checking filesystems succeeded
May8 21:27:28 S093 rc.sysinit: Mounting local
filesystems:succeeded
May8 21:27:28 S093 rc.sysinit: Enabling local filesystem
quotas:succeeded
May8 21:27:29 S093 rc.sysinit: Enabling swap space:succeeded
May8 21:27:29 S093 microcode_ctl: microcode_ctl startup
succeeded
May8 21:27:29 S093 sysstat: Calling the system activity data
collector (sadc):
May8 21:27:29 S093 sysstat:
May8 21:27:29 S093 rc: Starting sysstat:succeeded
May8 21:27:29 S093 readahead_early: Starting background
readahead:
May8 21:27:30 S093 rc: Starting readahead_early:succeeded
May8 21:28:10 S093 kudzu:failed
May8 21:28:10 S093 kudzu: Hardware configuration timed out.
May8 21:28:10 S093 kudzu: Run '/usr/sbin/kudzu' from the command
line to re-detect.
May8 21:28:10 S093 rc: Starting pcmcia:succeeded
May8 21:28:10 S093 sysctl: net.ipv4.ip_forward = 0
May8 21:28:10 S093 sysctl: net.ipv4.conf.default.rp_filter =
1
May8 21:28:10 S093 sysctl:
net.ipv4.conf.default.accept_source_route = 0
May8 21:28:10 S093 sysctl: kernel.sysrq = 0
May8 21:28:10 S093 sysctl: kernel.core_uses_pid = 1
May8 21:28:10 S093 network: Setting network
parameters:succeeded
May8 21:28:10 S093 network: Bringing up loopback
interface:succeeded
May8 21:28:14 S093 network: Bringing up interface
eth0:succeeded
May8 21:28:17 S093 cups: cupsd startup succeeded
May8 21:28:17 S093 sshd:succeeded
May8 21:28:18 S093 xinetd: xinetd startup succeeded
May8 21:28:18 S093 vsftpd: vsftpd vsftpd succeeded
May8 21:28:18 S093 sendmail: sendmail startup succeeded
May8 21:28:18 S093 sendmail: sm-client startup succeeded
May8 21:28:18 S093 gpm: gpm startup succeeded
May8 21:28:19 S093 iiim: htt startup succeeded
May8 21:28:20 S093 canna:succeeded
May8 21:28:20 S093 crond: crond startup succeeded
May8 21:28:21 S093 xfs: xfs startup succeeded
Ma
分享:
喜欢
0
赠金笔
加载中,请稍候......
评论加载中,请稍候...
发评论
登录名: 密码: 找回密码 注册记住登录状态
昵 称:
评论并转载此博文
发评论
以上网友发言只代表其个人观点,不代表新浪网的观点或立场。