Home > Operation and Maintenance > CentOS > How to solve the problem that centos bridge cannot access the Internet

How to solve the problem that centos bridge cannot access the Internet

WJ
Release: 2020-06-02 16:12:06
Original
2869 people have browsed it

How to solve the problem that centos bridge cannot access the Internet

How to solve the problem that centos bridge cannot access the Internet?

When I first installed the centos7 system, I changed the virtual machine to bridge and could not access the Internet. However, it was still fine under NAT. I checked for more than a day and most of them are configuring the ifcfg- file. In fact, I think the most important points are the following:

First: After just installing centos7, add the MAC address first, through ip addr or ifconfig. Ifcfg- (mine is ifcfg-eno16777736) add HWADDR=00:0c:29:ce:b9:1d (MAC address)

Second: Change ONBOOT in the ifcfg-file to yes , that BOOTPROTO can use the default dhcp (obtain IP automatically). If you want to set a static IP, you can change it to static, and then add a few lines of code (mine sometimes must be changed to static). If your dhcp does not work, you can try changing it to static. Try):

IPADDR0=192.168.11.128  #设置IP地址
PREFIXO0=24  #设置子网掩码
GATEWAY0=192.168.11.1 #设置网关
DNS1=8.8.8.8  #设置主DNS
DNS2=8.8.4.4  #设置备DNS
Copy after login

Note: The gateway (GATEWAY0) must be the same as your computer IP gateway (as shown below), and the set IP must be in the same network segment as the IP of your computer (host).

Then make sure that the virtual machine->Settings->Network Configuration and Edit->Virtual Network Editor are in the bridged state. Then restart the network: systemctl restart network.service

Sometimes I need to change the bridge in Edit->Virtual Network Editor bridge mode to other network cards, confirm and then change it to automatic and restart the network card (above) command).

If the networking sign in the upper right corner does not appear, you can execute:

systemctlstop NetworkManager

systemctl start NetworkManager (systemctl -f start NetworkManager)

Related references :centOS tutorial

The above is the detailed content of How to solve the problem that centos bridge cannot access the Internet. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template