Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

The method of Network setting of VMware Virtual Machine CentOS system

2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)05/31 Report--

This article introduces the relevant knowledge of "the method of network setting of VMware virtual machine CentOS system". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!

1 vmware network card

Vmware installs three network cards by default, as shown below (click Edit at the top-- > Virtual Network Editor).

Vmnet0: "bridged Network" vmnet1: "Host Virtual Network only" vmnet8: "nat Network"

Where vmnet0 is the host physical network card, the rest is virtual network card. In fact, vmware supports a total of 10 (virtual) network cards in vmnet0~vmnet9. For each virtual network card, you can only choose any network attribute at the same time, among which multiple virtual network cards can have "host network only" characteristics, but only one virtual network card can have "nat network" attribute at the same time.

2 vmware simplified network topology

Simplified network topology (picture from network) vmnet0 (bridging): virtual machines and external network computers can access each other vmnet1 (hosts only): virtual machines and external network computers cannot access each other vmnet8 (nat): virtual machines access external network computers while external network computers cannot access virtual machines

For details, please refer to:

3 Virtual machine Internet settings

3.1 Test environment

Host system: windows 8.1

Virtual machine software: vmware workstation 12

Virtual machine system image: centos-6.5-x86_64-bin-dvd1

3.2 allow virtual machines to access the Internet 3.2.1 nat mode

(1) Open cmd-- > enter ipconfig, and you can see the following information about the local wifi:

Physical machine network information

(2) Open the virtual network editor (top edit menu) and turn on the dhcp service (used to obtain ip addresses automatically)

(3) Top-> Virtual Machine-- > Settings

Set nat mode

(4) Network testing

Ping physical host-- > physical machine ping virtual machine-- > ping Baidu test network

As a result, only the physical machine can not ping the virtual machine, and in theory, the virtual machine and the physical machine can visit each other in nat mode. You can also leave a message if you understand it.

3.2.2 bridging mode

Set the same nat mode, note that "directly connect to the physical network" in the "bridge mode" means to reassign an ip address, while "copy the physical network connection status" is a common network card for the virtual machine and the local computer, so there is no need to reassign the ip address for the virtual machine to access the Internet.

Bridging mode

3.3 static ip configuration involves three profiles, which are:

/ etc/sysconfig/network

/ etc/sysconfig/network-scripts/ifcfg-eth0

/ etc/resolv.conf

Five network information addresses are involved, namely: subnet ip, subnet mask, gateway ip, static ip address, dns server ip

(1) Virtual machine network mode setting

Open cmd-- > ipconfig to view the network information; open the virtual network editor and fill in the nat settings, and set the network mode of the virtual machine to nat mode

Nat mode setting shuts down the dhcp service

The previous network settings enable the dhcp auto-assign ip service. You must turn off the dhcp service before setting the static ip.

(2) modify / etc/sysconfig/network

Networking=yes # activate networked hostname=developer # hostname gateway=192.168.xxx.xxx # gateway address at startup

(3) modify / etc/sysconfig/network-scripts/ifcfg-eth0

Device= "eth0" # device name bootproto= "static" # Startup Type dhcp | staticipaddr=192.168.xxx.xxx # ip address Note that the netmask=255.255.xxx.xxx # subnet mask hwaddr= "xx:xx:xx:xx:xx:xx" # hardware mac address ipv6init= "no" # turn off ipv6nm_controlled= "yes" # device eth0 must be in the same network segment as the physical machine. Onboot = "yes" # whether the network card type= "ethernet" # network type uuid= "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" is activated when the system starts. # Global unique identifier dns1=8.8.8.8 # ip address of the free dns server provided by google dns2=8.8.4.4 # ip address of the free dns server provided by google

Note: dns1 must be set here, otherwise domain name resolution cannot be performed.

(4) modify / etc/resolv.conf

# generated by networkmanagernameserver 8.8.8.8nameserver 8.8.4.4

In fact, this step can be omitted, the system will automatically modify the configuration file after setting the address of dns server.

(5) restart the network card

Service network restart

When the Nic is restarted, information about reconfiguring ip may appear in the shell in the shell.

(6) Network testing

Ping Gateway

Ping Baidu

This is the end of the content of "VMware virtual machine CentOS system network setting method". Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report