Foreword
This article mainly introduces you to the relevant content of the Centos 7 system virtual machine bridging mode, and share it for your reference and study. I won't say much below, let's take a look at the detailed introduction.
**The host cannot ping through the ip of the virtual machine centos7 system for the following reasons: **
1、 The host corresponds to the centos7ip segment (the key is that the gateway and the dns server have a one-to-one correspondence, see the following for specific operations)
2、 If the correspondence still fails, you can turn off the host and cenos7 firewall. The default firewall of centos7 is firewall, which is different from centos6
Related commands:
systemctl stop firewalld.service #Stop firewall
systemctl disable firewalld.service #Prohibit firewall startup
3、 After all the above settings are still not working, you can enter arp -a in the cmd of the host to check whether the mac ip bound to the gateway is the same as the ip you set in the virtual machine. Modify the ip address in the virtual machine to ping
The configuration of connecting to the external network in the virtual machine centos7
1. First, set the virtual machine connection method to bridge
Open the virtual machine, click "Edit"-"Virtual Network Editor" and click "Change Settings" to see the bridge mode. There are several options for bridge mode. Here you can choose between Ethernet-based or wireless LAN. The ip address of the virtual machine must correspond to the ip segment of the Ethernet or wireless network you selected (ie: the first three parts of the ip address must be consistent).
Click "Virtual Machine"-"Settings" and select "Bridge Mode" in "Network Adapter".
2. Enter the centos7 system of the virtual machine and modify the ip of centos7
1、 cd /etc/sysconfig/network-scripts/
2、 ls Ifcfg-ens33 appears here, it may be different for different machines.
3、 vi ifcfg-ens33
Host: ip: 192.168.111.46 Gateway: 192.168.111.1
4、: wq save and exit
5、 systemctl restart network.service restart network
6、 At this time, you can test whether the host can ping the virtual machine and the virtual machine can ping the external network.
3. If the above is not connected to the Internet, please configure dns
1、 nmcli connection show displays the currently connected network
If it is not displayed, it means that there is no network connection currently, and ens33 needs to be activated up
2、 Modify the DNS server corresponding to the current network connection, where the network connection can be identified by name or UUID
nmcli con mod ens33 ipv4.dns "114.114.114.114 8.8.8.8" here 114.114.114.114 and 8.8.8.8 are commonly used in China, but if it is a corporate LAN dns may be different, you can open the "Network Sharing Center" in the host ,
Click on the connected Ethernet or wireless network, open "Detailed Information", there will be "IPv4 DNS Server" and replace the copy in the above command
114.114.114.114 and 8.8.8.8
3、 Take DNS configuration into effect nmcli con up ens33
4、 systemctl restart network.service restart network
Then you can connect to the external network.
to sum up
The above is the entire content of this article. I hope that the content of this article has a certain reference value for your study or work. If you have any questions, you can leave a message and exchange. Thank you for your support to ZaLou.Cn.
Recommended Posts