Host-only mode:
(1) Host-only mode is used to establish an internal network isolated from the outside world to improve network security and can only communicate with the host.
() Host-only mode (H) is NAT mode, removes the virtual NAT device, and then uses VMware Network Adapter The VMnet1 virtual network card connects to the VMnet1 virtual switch to communicate with the virtual machine. It is host-only isolated, making the virtual machine an independent system and only communicates with the host.
Experiment: node-1 and node-5 use vmnet4 host-only mode to communicate
node-1:172.16.1.1
node-5: 172.16.1.2
Result: The virtual machine can successfully ping the host machine, that is, ping the VMNet4, and the host machine can also ping the virtual machine successfully.
----
Add a network card to node-1
Select the CentOS virtual machine in the VMware main interface> right-click the mouse> select settings
Under the hardware options bar> Left-click the single-machine mouse to select the network adapter> Click on host-only mode> Finally click OK
Check VMNet4 with ipconfig /all on the host machine. It serves as a gateway. Represents the host in host-only mode, because it uses this gateway to communicate with the host, rather than using the gateway connected to the external network.
Temporary configuration:
[root@shaoping63 ~]# ifconfig ens38 172.16.2.1/24 //Restart Will be lost later
Permanent configuration:
A graphical interface configuration
[root@shaoping63 ~]# nmtui
B How to modify the configuration file
Note: Anything starting with ifcfg- will be considered a network card configuration file. If you need to back it up, be sure not to keep this part. For example, the backup is called ifcfg_bak-eth0
[root@shaoping63 network-scripts]# cp ifcfg-ens33 ifcfg-ens38
[root@shaoping63 network-scripts]# uuidgen ifcfg-ens38
ba8527c8-89ed-4a83- bd84-be7918fcc50d
[root@shaoping63 network-scripts]# ifdown ens38
[root@shaoping63 network-scripts]# ifup ens38
[root@client network-scripts]# vim ifcfg-ens37
[root@client network-scripts]# systemctl restart network //Restart the network card
Note: If you use remote tools to connect to a virtual machine in host-only mode and fail to connect successfully, it is very likely that It is affected by DNS, turn it off in the file /etc/ssh/sshd_config.
Test results show that the virtual machine can successfully ping the host machine, that is, ping the VMNet4, and the host machine can also ping the virtual machine successfully. The setting is successful!
The above is the detailed content of centos7 host only mode settings. For more information, please follow other related articles on the PHP Chinese website!