Linux培训
达内IT学院
400-996-5531
首先# ping www.baidu.com发现报错未知此域名
# ping www.baidu.com
ping: unknown host www.baidu.com
之后# ping 8.8.8.8 -c 3 如果不通,则
查看域名服务器cat /etc/resolv.conf发现里面设置了谷歌的公共DNS服务(如果没有则需设置)
#cat /etc/resolv.conf
# Generated by NetworkManager
nameserver 8.8.8.8
查看网关问题:grep GATEWAY /etc/sysconfig/network-scripts/ifcfg-eth0
如果发现未设置,则增加默认网关:
如果报错:不能连接。加下面这条
# route add default gw 192.168.40.1 //
都设置好之后你会发现已经可以ping 通网络了
# ping www.baidu.com -c 3
NM_CONTROLLED=yes
PING # (103.235.46.39) 56(84) bytes of data.
64 bytes from 103.235.46.39: icmp_seq=1 ttl=44 time=348 ms
64 bytes from 103.235.46.39: icmp_seq=2 ttl=44 time=346 ms
64 bytes from 103.235.46.39: icmp_seq=3 ttl=44 time=348 ms
— # ping statistics —
3 packets transmitted, 3 received, 0% packet loss, time 2356ms
rtt min/avg/max/mdev = 346.636/347.584/348.094/0.670 ms
===================================================================================
附上一般网络配置文件所必须包含的东西/etc/sysconfig/network-scripts/ifcfg-eth0
# cat /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0
HWADDR=00:0C:29:BE:56:DB
TYPE=Ethernet
UUID=5c0c914d-01ac-4543-8ffb-71cfc8f4fc60
ONBOOT=yes
BOOTPROTO=static
IPADDR=192.168.1.11
填写下面表单即可预约申请免费试听! 怕学不会?助教全程陪读,随时解惑!担心就业?一地学习,可全国推荐就业!
Copyright © 京ICP备08000853号-56 京公网安备 11010802029508号 达内时代科技集团有限公司 版权所有
Tedu.cn All Rights Reserved