CENTOS7 Network settings under virtual machine

Source: Internet
Author: User

Today the Linux, after the installation is complete, not even the internet,

Use the method under the Split line (article source: http://blog.chinaunix.net/uid-20846214-id-3202081.html),

The setting in the company was successful, but the home setting was not successful;

For the most of the day, I found that we should use the broadband connection to set up the share, not the local connection, the local connection of their home is not connected to the network

=====================================================================

Let's start by introducing VMware's network connectivity approach. Our host usually through the physical network card and LAN and the Internet connection, and the virtual machine has been called a virtual computer, the virtual network card also must exist, and if we want the virtual computer can connect to the local area network or the Internet, it must be the virtual network card and the host's real physical network card together. VMware provides three ways to bundle virtual and physical network cards-bridge mode, network address translation (transformation, NAT) mode, and host-only mode. In simple terms: Bridge mode directly adds the virtual machine to the local area network, making the virtual machine look like a real computer in the network, the virtual network card and the host physical network card does not have a nominal affiliation, and therefore need to have redundant IP address within the LAN to provide to the virtual machine network card, If the LAN is strictly assigned to each computer fixed IP, then this bridge mode is basically invalid. For example, to hang the network file system, but we are in Windows VM Virtual machine installed above the Linux system, you can use this way! In bridge mode, the virtual machine can either access the Internet or communicate with other real computers in the LAN, and the physical NIC hosted in NAT mode acts as a router or switch, and VMware provides many subset IPs for virtual machines based on the host's real IP , so that all virtual machines access the Internet through the host's network ports, but it seems that these virtual machines are legitimately accessing the local area network or the Internet, because their IP addresses appear to be legitimate after the NAT technology.Host only modevirtual machines can communicate with each other, but virtual machines cannot communicate directly with other real computers in the LAN, but it is possible to access the Internet through the host in this mode.                                  &NBS P                     bridging (bridge) mode                                 for network address translation (NAT) mode         &NB Sp               Main (Host only) mode  VM virtual network card can be set to the above three kinds of network connection mode, by default, VMnet0 is set to bridge mode, VMnet1 is set to host only mode, and VMnet8 's default connection mode is NAT mode. Vmnet2-vmnet7 and VMnet9 These seven virtual network card users can be customized, but in all the virtual network card only one block can be set to NAT mode, the default is VMnet8. Users can view this information in the VMware workstation->edit->virtual Network Editor. After knowing how the virtual network card connects to the network, you need to actually connect to the network. Choose a simpler Internet connection, Nat mode, first set "Network Connection" in "Virtual machine Settings" as Nat mode (see Figure 1). Open Win7 's network and Sharing Center, select change adapter settings, and if VMware Workstation is installed correctly, you should see both the VMNET1 and VMNET8 virtual network cards. Check the properties of the local area connection with the broadband connection, and, by the way, check the VMware Bridge protocol in the "This connection uses the following items" under the Network tab to use this protocol later when you choose Bridge mode. Under the Sharing tab, Internet connections are all"To allow other network users to connect through this computer's Internet connection (N)", select VMnet8 in Home network Connections (H). This sets the network access permissions for the host computer to be shared with VMnet8. VMnet1 and Vmne in                               network connection t8                                 &N Bsp           setting up a network shareThe following need to configure the IP address and mask of the VMnet8. First look at the network properties of the VMnet8, and in the same way, under the Network tab,This connection uses the following items"Check the VMware Bridge protocol for later use in bridge mode. Viewing the properties of the Tcp/ipv4, you can see that the IP address has been automatically changed to a fixed 192.168.137.1, the subnet mask is already 255.255.255.0, these let it set, for the moment no matter.

Next you need to configure VMNET8 IP properties in the VM 。 5, open the VMware workstation->edit->vmware Network Editor, select VMnet8, tick connect a host virtual Network adapter to this Netwo RK and use the local DHCP service to the distribute IP address to the VMs. The subset IP needs to be in the same address segment as the host VMnet8 IP, and the 192.168.137.0,subset mask should be the same as the VMnet8 subnet mask, that is, fill in the 255.255.255.0. Open the DHCP Settings, the inside of the start IP address fill in the 192.168.137.0,end IP address fill 192.168.137.255, you can automatically assign to the virtual computer IP addresses in this IP segment. In NAT settings, Getway IP is set to the VMnet8 IP in the host computer, which is 192.168.137.1.

The above setting summarizes that the physical network card of the host computer is shared with the VMnet8, VMNET8 acts as a router, and the virtual machines in the VM automatically obtain IP addresses within an IP segment via DHCP, which are all through the router (VMNET8) Connect the IP to the Internet connection on the physical network card.

After setting up this, start the CentOS in VMware, if normal should be able to ping the network, open Xwindow inside the browser should also be able to start surfing. If you are not connected to the Internet, you can log in to CentOS with the root user (other user does not have permission to modify the configuration file), and check the file system->etc->sysconfig->network-scripts-> The Bootproto in Ifcfg-eth0 is not DHCP, and if not, modify it to DHCP and then use the command service network restart to restart the network connection to connect to the network.

=========================================================================== Connect to the network, you can use the Yum-y install Vim Install VIM using the Baidu experience mentioned in:
    1. Under Linux, the GCC installation operation is as follows

      Installing the C compiler

      Yum Install GCC

    2. Installing the g++ Compiler

      Yum Install gcc-c++

      To complete the GCC compiler installation

Thank the original blogger, thank Baidu Experience

CENTOS7 Network settings under virtual machine

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.