Linux网络配置及排错的一般流程
*转载自运维派
# ping www.baidu.com
ping: unknown host www.baidu.com
之后# ping 8.8.8.8 -c 3 如果不通,则
#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 www.a.shifen.com (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
— www.a.shifen.com 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
本文转发自如下链接:
http://dianel.blog.51cto.com/12170393/1906988
推荐阅读:
运维常说的 5个9、4个9、3个9 的可靠性,到底是什么鬼?