1. 程式人生 > 實用技巧 >centos7 ping: www.baidu.com: Name or service not known

centos7 ping: www.baidu.com: Name or service not known

最近配置在VMware虛擬機器上搭建Lamp 出現網路問題,做下筆記免得忘記

[[email protected] ~]# ping www.baidu.com
ping: www.baidu.com: Name or service not known

[[email protected] ~]#

1、網路配置檢視

2、檢視虛擬網路

記住NAT設定中的子網IP、子網掩碼、閘道器IP三項,接下來配置檔案主要是這三項。

3、編輯Linux中的網路配置檔案

[[email protected] ~]# vi /etc/sysconfig/network-scripts/ifcfg-ens33 #注 網路配置檔名可能會有不同,在輸入到ifcfg時,可以連續按兩下tab鍵,獲取提示,比如我的機器 為 ifcfg-ens33

4、DNS檔案配置

[[email protected] ~]# vi /etc/resolv.conf

[[email protected] ~]# cat /etc/resolv.conf
nameserver 8.8.8.8
nameserver 8.8.4.4

5、檢視網路配置

[[email protected] ~]# ip addr

6、重啟網路服務

[[email protected] ~]#  service network restart

7、測試