In NAT mode, virtual machine network connections use NAT mode, and physical machine network connections use vmnet8. If not reset, set the & mdash; network adapter in the VM and select NAT mode for network connection. VM menu bar & mdash; edit & mdash; virtual network editor, select Vmnet8NAT mode, and cancel the UselocalDHCPservice check to fix IPSubn
Use NAT mode
The virtual machine network connection uses the NAT mode, and the physical machine network connection uses vmnet8. If it is not reset
In virtual machine settings-network adapter, select NAT mode for network connection.
On the VM menu bar, choose "edit"> "virtual network editor", select "Vmnet8 NAT", and deselect the Use local DHCP service check to fix the IP address.
The Subnet IP address is used to control the IP segment that the virtual machine wants. NAT Settings takes a look at the virtual machine gateway. here is 192.168.1.2.
After the settings are complete, click the application to exit.
Physical machine network connection VMNet8 manual setting IP address 192.168.1.1 subnet mask 255.255.255.0
The gateway and DNS address are 192.168.1.2 (that is, the virtual machine NAT gateway address)
Edit the configuration file of the linux Nic eth0
[Root @ HE1 ~] # Vi/etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE = eth0
BOOTPROTO = none
HWADDR = 00: 0c: 29: db: 2e: ff
IPV6INIT = no
NM_CONTROLLED = yes
ONBOOT = yes
TYPE = Ethernet
UUID = "14ce5db9-8038-4d39-a347-806d20608834"
USERCTL = no
IPADDR = 192.168.1.48
NETMASK = 255.255.255.0
GATEWAY = 192.168.1.2
DNS1 = 192.168.1.2
Set DNS1; otherwise, the DNS configured in resolv. conf is invalid.
Set the DNS address and run the command # vi/etc/resolv. conf.
# Generated by NetworkManager
Search localdomain
Nameserver 192.168.1.2
Restart the network service [root @ HE1 ~] #/Etc/init. d/network restart
After the instance is restarted, check the configured IP address in ifconfig. ping the IP address on the physical machine to test whether the IP address can be accessed.
If the network can be pinged but cannot access the Internet, it is likely that the DNS1 in the NIC is not set, resulting in the clearing of the nameserver set in resolv. conf after the network service is restarted.