Portal: http://blog.csdn.net/zhangatle/article/details/77417310
In fact, this blogger's blog is the most suitable for beginners to learn, stepping on the pit let me step on a step, impressive
First, configure the NAT networking mode
First, view the host host's IP, mainly view the host host's VMnet8 IPv4 address, subnet mask, etc.
1, for example, the IPv4 address of the VMnet8 of this machine is: ipv4-192.168.159.1, the subnet mask is 255.255.255.0
2. Open the Virtual network editor
(Here I choose the network of NAT), note: In this way, the host host is the equivalent of a router, to assign IP addresses to the virtual machine, so to ensure that both IP in the same network segment
Set subnet IP to: 192.168.159.0
Subnet mask is: 255.255.255.0
Then make NAT settings: 192.168.159.2
Second, the next operation of CentOS, all operations will be done in the terminal, it is best to operate as root, to avoid frequent password verification, or VI operation failed
To open a terminal: Configure the NIC information
Cd/etc/sysconfig/network-scripts
Switch to the root user and enter the password
Su-p
Formally edit the NIC information
Vim Ifcfg-ens33
Enter edit mode by letter I, edit related information, change the way of acquiring IP from DHCP to static, mainly modify the following parts: bootproto,ipaddr,broadcast,netmast,gateway,dns,nm_ Controlled,onboot
Note:
Bootproto the way to get the IP
IPADDR set to the IP address you want, primarily set the last one, do not conflict with host host
Broadcast is the primary broadcast address, the last one is 255
Netmask as Subnet mask
Gateway is the default, consistent with the NAT settings of the Virtual network editor
DNS must be set up, otherwise the domain name cannot be parsed and can only be accessed via IP
Type="Ethernet"Bootproto="Static"ipaddr=192.168.159.159Broadcast=192.168.159.255NETMASK=255.255.255.0GATEWAY=192.168.159.2DNS1=8.8.8.8DNS2=8.8.4.4nm_controlled="No"Defroute="Yes"Peerdns="Yes"peerroutes="Yes"Ipv4_failure_fatal="No"Ipv6init="Yes"ipv6_autoconf="Yes"Ipv6_defroute="Yes"Ipv6_peerdns="Yes"ipv6_peerroutes="Yes"Ipv6_failure_fatal="No"Ipv6_addr_gen_mode="stable-privacy"NAME="Ens33"UUID="aefa69d7-c33b-43b3-9c03-aa51b5d31172"DEVICE="Ens33"Onboot="Yes"
After the configuration is complete, close save, press the ESE key on the keyboard, and then enter the following command to save and exit
: Wq
To restart the network:
sudo restart Network.service
Shutting down the firewall
Prevent firewall from booting up
View firewall status, not running is a firewall off state
Firewall-cmd--state
Restarting the firewall
sudo restart Firewalld.service
Turn off SELinux
View SELinux status, shown as disabled is off
/usr/sbin/sestatus-v
or enter the following command to view the SELinux status
Getenforce
Permanently close SELinux
Vim /etc/selinux/config
Change Selinux=enforcing to Selinux=disabled
Add the configuration of the bridging mode
Add a bridging approach to the networking configuration, which is similar to the above NAT mode, mainly changing the following aspects:
1, First: The cmd mode to view the local IP address (input ipconfig), mainly to see the host host is now in what network segment, such as
The local host host is in a 96 network segment
2, next open the Virtual network editor, the bridge mode configuration, will bridge to: change to the physical web of the host, this step is very important
3, next open the virtual machine, the connection mode to bridge, the replication physical network connection status is optional, on-demand selection
4, the last step, the virtual machine in the CentOS network configuration, the main changes in the following aspects: Ipaddr,broadcast,gateway, there is a point to note that the last of IPAddr is a custom, but must not be in the same network with other people in the environment of conflict, In order to avoid this problem, you can first ping this address in the host host, if the ping is not available, then this address is idle, you can use
Type="Ethernet"Bootproto="Static"ipaddr=192.168.96.159Broadcast=192.168.96.255NETMASK=255.255.255.0GATEWAY=192.168.96.2DNS1=8.8.8.8DNS2=8.8.4.4nm_controlled="No"Defroute="Yes"Peerdns="Yes"peerroutes="Yes"Ipv4_failure_fatal="No"Ipv6init="Yes"ipv6_autoconf="Yes"Ipv6_defroute="Yes"Ipv6_peerdns="Yes"ipv6_peerroutes="Yes"Ipv6_failure_fatal="No"Ipv6_addr_gen_mode="stable-privacy"NAME="Ens33"UUID="aefa69d7-c33b-43b3-9c03-aa51b5d31172"DEVICE="Ens33"Onboot="Yes"
Last step: Restart the network
sudo restart Network.service
At this point, the setup of the static IP access network for CentOS in the virtual machine has been completed, and the ping virtual Host in the host host has been able to access it normally .
after shutting down the host host's firewall, you can ping the virtual machine.
Transferred from: Zhangatle's blog: http://blog.csdn.net/zhangatle/article/details/77417310
Go: CentOS in VMware configuration static IP for network access (NAT mode and bridging mode)