linx下Ping不通192.168.1.1

包含网卡/无线网的网络问题和ADSL/校园网/宽带拨号支持及代理/共享等网络使用问题
回复
wohenghaoye
帖子: 4
注册时间: 2010-05-12 17:57

linx下Ping不通192.168.1.1

#1

帖子 wohenghaoye » 2012-01-13 0:34

存在的故障现象:安装了一个linux系统。安装完后ping 不通网关。能ping通自己(127.0.0.1);
在之前这个机子安装windows时候能用,可以PING通所有机子,和网关。
[root@localhost ~]# ping 192.168.1.1
PING 192.168.1.1 (192.168.1.1) 56(84) bytes of data.
From 192.168.1.1 icmp_seq=1 Destination Host Unreachable
...

--- 192.168.1.1 ping statistics ---
5 packets transmitted, 0 received, +3 errors, 100% packet loss, time 4002ms
, pipe 4

我输入netstat -nr

destination gateway genmask flags mss window irtt iface
192.168.1.0 0.0.0.0 255.255.255.0 u 0 0 0 eth0
169.254.0.0 ....... 255.255.0.0 ........................
0.0.0.0 192.168.1.1 0.0.0.0 ug ......................

traceroute 192.168.1.1
traceroute to 192.168.1.1 (192.168.1.1), 30 hops max, 46 byte packets

1 192.168.1.151 (192.168.1.151) 3001.101 ms !hicmp checksum is wrong icmp
checksun is wrong 3001.012 ms ! H 3001.034 ms !
原因:在linux中尚未设置dns所致。解决办法,把DNS设置成192.168.1.1(如果你的网关是这个
地址的话)即可。
PS:这是网上的贴子(http://www.028nz.com/?p=34),但是他没有说在哪里改DNS啊????????????????????????????
头像
32idea
帖子: 1251
注册时间: 2006-12-15 9:32
系统: linux

Re: linx下Ping不通192.168.1.1

#2

帖子 32idea » 2012-01-13 0:41

设置Ubuntu DNS
修改/etc/resolv.conf,在其中加入
nameserver DNS的地址1
nameserver DNS的地址2
完成。

用命令临时设定网络配置
1. 设置IP sudo ifconfig eth0 192.168.100.1 netmask 255.255.255.0 这样就算设置好了网卡eth0的IP地址和子网掩码
2. 设置网关 sudo route add default gw 192.168.1.1
onlylove
论坛版主
帖子: 5371
注册时间: 2007-01-14 16:23

Re: linx下Ping不通192.168.1.1

#3

帖子 onlylove » 2012-01-13 20:27

网关和DNS有半毛钱关系啊?如果你处在一个内网,没有dns服务器,你不用网络了?看不明白呢……
#include <stdio.h>
void main()
{
double world;
unsigned letter;
short stay;
long memories;
printf("I miss you.\n");
}
回复