---
title: "CentOS7安装无法访问外网"
author: "lam"
date: "2020-03-10T16:55:14Z"
tags: []
categories: ["操作系统"]
slug: "centos7"
draft: false
lastmod: "2020-03-10T17:17:54Z"
id: 2512916
url: "https://lam.iteye.com/blog/2512916"
---

今天在虚拟机安装了centos7后发现无法访问外网，ping外网也不通。

检查发现，ipv4虽然启动起来，ipv4有IP地址等信息，就是PING不通外网


找资料发现原来是centos7的network与NetworkManager有冲突  

只能停用掉NetworkManager

这里区分大小的
 #systemctl stop NetworkManager  //暂时关闭
 #systemctl disable NetworkManager  //永久关闭

查看地NetworkManager是否关闭状态
 #systemctl is-enabled NetworkManager.service

显示disabled

然后重启ipv4
# systemctl restart network

ipv4终于可以正常使用，外网也PING通了。


方法二（没有试验过）

在/etc/sysconfig/network-scripts/ifcfg-enXXX最后面添加一条

NM_CONTROLLED=no  # add this line