Under the Linux VMWare three network configuration process of Centos7

Under the Linux VMWare three network configuration process of Centos7

Environment:
Virtual software: VMWare 14.0
client: windows 10
virtual machines: centos 7


  • VMware three network connections

    • Bridge (bridging)
      all the virtual machine and the physical host to the same virtual network environment, the virtual machine assigned to different IP address and the host, the same mask and gateway, the host to the same network segment with the virtual machine (VM Join host belongs LAN). Such virtual machine network environment and can be seen as a physical machine.
    • Host-only (host only)
      using a virtual machine to a physical network adapter VMnet1 out a new virtual card, through the virtual network adapter to communicate with all the virtual machines using the Host-only connection to each other, but by default the virtual machine can not access the Internet , by sharing the shared physical network card physical host to virtual network adapter virtual machine to access the Internet.
    • NAT
      physical between the virtual machine and the network adapter using NAT connection VMnet8 virtual machine communication while using the physical NIC proxy NAT is performed outside the network to access the virtual machine, the virtual machine may access physical machine outside the network, the physical machine may be access the virtual machine outside the network, but the host outside the network can not access the virtual machine.

  • Bridged mode virtual machine network

    1, the physical host network environment is as follows:
    Snipaste_2019-09-09_20-09-54
    2, select "Edit" in the menu bar VMware software -> "Virtual Network Editor,"
    Snipaste_2019-09-09_19-30-13
    3, see the VMWare network configuration in the "Virtual Network Editor":
    Snipaste_2019-09-09_19-29-47
    4, select the "virtual machine "->" settings ", set to open the window:
    Snipaste_2019-09-09_19-33-14
    5, the virtual machine is provided for the connection mode" bridge ":
    Snipaste_2019-09-09_19-32-46
    6, the virtual machine is turned on, the login open terminal, the input terminal of the following command:

    vi /etc/sysconfig/network-scripts/ifcfg-ens33

    7, in the open configuration document card configured as follows (Note: insert mode input enters a vi editor document is modified, detailed usage can vi Baidu self learning):

    TYPE=Ethernet 
    PROXY_METHOD=none
    BROWSER_ONLY=no
    BOOTPROTO=static   #网卡IP地址获取方式,static为静态,dhcp为自动获取,或设置为none
    DEFROUTE=yes
    IPV4_FAILURE_FATAL=no
    IPV6INIT=yes
    IPV6_AUTOCONF=yes
    IPV6_DEFROUTE=yes
    IPV6_FAILURE_FATAL=no
    IPV6_ADDR_GEN_MODE=stable-privacy
    NAME=ens33 
    UUID=dec5a00c-b441-408f-bd65-f6b7a59b5d6f
    DEVICE=ens33
    ONBOOT=yes  #重启后自动激活网卡
    IPADDR=10.10.86.210  #设置IP,不可与网段内其他主机重复,桥接模式下需要与物理主机处于同一网段
    NETMASK=255.255.255.0 #子网掩码,与物理主机相同
    GATEWAY=10.10.86.1   #网关地址,与物理主机相同

    8, save the configuration:
    Type ESC to enter the vi editor line mode (command mode), enter ": wq" command to save and exit
    9, restart the card:

    systemctl restart network

    10, the ping command tests
    were used to ping 127.0.0.1, the local IP, gateway ping test, as shown:
    ping loopback address 127.0.0.1 #ping

    Note: CTRL+ Cend of ping command

    Snipaste_2019-09-09_20-20-56
    ping 10.10.86.210 #ping the IP address of
    Snipaste_2019-09-09_20-21-06
    ping 10.10.86.1 #ping gateway
    Snipaste_2019-09-09_20-21-24
    11 is configured DNS address:

    vi /etc/resolv.conf

    Configuration is as follows:

    nameserver 202.106.46.151   #主域名服务器地址
    nameserver 114.114.114.114  #备用域名服务器地址

    Snipaste_2019-09-09_20-25-27
    12, after the restart card (ibid.), Ping domain test configuration:
    Snipaste_2019-09-09_20-30-15


  • Host mode only virtual machine network

    1, the physical machine network environment as follows:
    Snipaste_2019-09-09_22-07-55.png
    2, select "virtual machine" -> "Settings", open settings window:
    Snipaste_2019-09-09_19-33-14
    3, the connection mode setting virtual machine "Host Only Mode ':
    Snipaste_2019-09-09_21-46-59
    4, the virtual machine is turned on, open the terminal login , enter the following command in the terminal:

    vi /etc/sysconfig/network-scripts/ifcfg-ens33

    5, open the document, set the network card configuration:

    TYPE=Ethernet 
    PROXY_METHOD=none
    BROWSER_ONLY=no
    BOOTPROTO=static   #网卡IP地址获取方式,static为静态,dhcp为自动获取,或设置为none
    DEFROUTE=yes
    IPV4_FAILURE_FATAL=no
    IPV6INIT=yes
    IPV6_AUTOCONF=yes
    IPV6_DEFROUTE=yes
    IPV6_FAILURE_FATAL=no
    IPV6_ADDR_GEN_MODE=stable-privacy
    NAME=ens33 
    UUID=dec5a00c-b441-408f-bd65-f6b7a59b5d6f
    DEVICE=ens33
    ONBOOT=yes  #重启后自动激活网卡
    IPADDR=192.168.102.210  #设置IP,不可与网段内其他主机重复,仅主机模式下需要与VMNet1虚拟网卡处于同一网段
    NETMASK=255.255.255.0  #子网掩码,与VMNet1的掩码相同
    GATEWAY=192.168.102.1  #网关地址,为VMnet1的IP地址
    DNS1=114.114.114.114   #主DNS服务器地址
    DNS2=8.8.8.8           #备用DNS服务器地址

    6, save the configuration:
    Type the line mode ESC to enter the vi editor (command mode), enter ": wq" command to save and exit
    7, restart the card:

    systemctl restart network

    . 8, the ping command tests
    were used to ping 127.0.0.1, the local IP, gateway ping test, as shown:
    ping loopback address 127.0.0.1 #ping
    Snipaste_2019-09-10_08-37-48
    ping 192.168.102.210 #ping the IP address of
    Snipaste_2019-09-10_08-37-26
    ping 192.168.102.1 #ping virtual NIC physical machine address
    Snipaste_2019-09-10_08-36-56
    ping 182.61.200.7 #ping external IP address
    Snipaste_2019-09-10_16-17-16
    test can be seen, Host-only mode, the virtual machine can not connect to external networks by default, the virtual card and communication physical machine

  • Host-only way to make use of shared virtual machine to access the Internet

    1, open the windows in the "Settings" in "Network and Internet", select "Change adapter options" in the pop-up "Network Connections" window, right-click the connection is being used, select "Properties" option:
    Snipaste_2019-09-10_16-23-41
    2. Select " sharing "connection sharing allows selection, and to specify the shared virtual NIC VMnet1
    Snipaste_2019-09-10_16-23-12
    3 into the VMWare" virtual network "editor" of "
    Snipaste_2019-09-10_16-36-03
    4, only the network segment in the modified host (host-only) mode as follows (if used need to be modified dhcp dhcp assigned address range)
    Snipaste_2019-09-10_16-28-51
    5, modify the network card in the virtual machine configuration file (process supra)

    vi /etc/sysconfig/network-scripts/ifcfg-ens33
    

    6, in an open document, set the network card configuration (do not forget to configure the DNS):
    Snipaste_2019-09-10_16-29-39
    7, reboot and test the card:

    systemctl restart network
    

    Snipaste_2019-09-10_16-42-25
    Snipaste_2019-09-10_16-42-12


  • NAT connect to the network configuration mode

    1, the physical host network environment is as follows:
    Snipaste_2019-09-10_16-52-25
    2, select "Edit" in the menu bar VMware software -> "Virtual Network Editor,"
    Snipaste_2019-09-09_19-30-13
    3, see the VMWare NAT mode network configuration in the "Virtual Network Editor" and check the DHCP configuration (note the gateway IP address):
    Snipaste_2019-09-10_16-46-11
    Snipaste_2019-09-10_16-46-26
    4, selecting "virtual machine" -> "settings", set to open the window:
    Snipaste_2019-09-09_19-33-14
    5, the virtual machine is provided for the connection mode "the NAT":
    Snipaste_2019-09-10_16-47-12
    . 6, modify the network card in the virtual machine configuration file:

    vi /etc/sysconfig/network-scripts/ifcfg-ens33
    

    7, open the card configuration documentation configured as follows:

    TYPE=Ethernet 
    PROXY_METHOD=none
    BROWSER_ONLY=no
    BOOTPROTO=static   #网卡IP地址获取方式,static为静态,dhcp为自动获取,或设置为none
    DEFROUTE=yes
    IPV4_FAILURE_FATAL=no
    IPV6INIT=yes
    IPV6_AUTOCONF=yes
    IPV6_DEFROUTE=yes
    IPV6_FAILURE_FATAL=no
    IPV6_ADDR_GEN_MODE=stable-privacy
    NAME=ens33 
    UUID=dec5a00c-b441-408f-bd65-f6b7a59b5d6f
    DEVICE=ens33
    ONBOOT=yes  #重启后自动激活网卡
    IPADDR=192.168.10.210  #设置IP,不可与网段内其他主机重复,NAT模式下需要与VMNet8处于同一网段
    NETMASK=255.255.255.0 #子网掩码,与物理主机相同
    GATEWAY=192.168.10.2   #网关地址,为NAT的DHCP配置中设置的网关地址
    

    8, save the configuration:
    Type ESC to enter the vi editor line mode (command mode), enter ": wq" command to save and exit
    9, restart the card:

    systemctl restart network
    

    10, view the card information
    Snipaste_2019-09-10_16-50-45
    . 11, the ping command tests
    were used to ping 127.0.0.1, the local IP, gateway ping test, as shown:
    ping 192.168.10.2 #ping gateway
    Snipaste_2019-09-10_16-50-28
    ping www.baidu.com #ping Baidu test extranet connectivity
    Snipaste_2019-09-10_16-50-11
    physical NIC ping 10.10.86.68 #ping physical host (if desired also be a physical machine and the virtual machine is, in turn communicate with the network segment address of the physical network adapters by sharing manner)
    Snipaste_2019-09-10_16-51-12
    on the physical host VMNet8 ping 192.168.10.1 #ping virtual LAN
    Snipaste_2019-09-10_17-04-18

Guess you like

Origin www.cnblogs.com/lastyear/p/11502861.html