1. First access to your gateway
Convenient to use the Select menu bar in the cento system configuration: edit->virtual Network Editor
Select VMnet8, click Nat settings to view the gateway address: The gateway IP here is 192.168.112.2
The next step is to get to the chase.
2. Set up a CentOS static IP:
Three configuration files are involved, namely:
/etc/sysconfig/network
/etc/sysconfig/network-scripts/ifcfg-ens33
/etc/resolv
.conf
A. First modify the/etc/sysconfig/network as follows:
Networking=yes
#此处可指定主机名
Hostname=namenode
gateway=192.168.112.2
Specifies the gateway address.
B. Then modify the/etc/sysconfig/network-scripts/ifcfg-eth33 as follows:
Type=ethernet
#此处改为虚拟机分配的MAC地址
Hwaddr=00:0c:29:61:0f:dd
Bootproto=static
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=d74c8bd7-e4c0-4afe-a5b6-2970a9c98359
Device=ens33
Onboot=yes
netmask=255.255.255.0
gatway=192.168.112.2
ipaddr=193.168.112.129
dns1=192.168.112.2
C. Restart the network: Service network restart
This is a simple few steps after the virtual machine's IP has been 192.168.112.129.
Once the IP is fixed, you can then set the host
Finally, this configuration must be configured to change the virtual machine configuration Network connection mode to NAT mode
Add: If you need to forward a virtual machine port to the host intranet, you can set up NAT forwarding:
CentOS set fixed IP in VMware virtual machines