Vmware virtual machine centos fixed IP host SHH can be connected and accessed

Requirements such as the title: Vmware virtual machine centos set a fixed IP address SHH can connect access

1. Virtual machine settings

2. Virtual network card settings

The IP address in the above picture is set according to the content in the first picture.

3. Configuration file settings

cd /etc/sysconfig/network-scripts/

The file name of each virtual machine configuration is generally different. Find the file that starts with ifcfg and has no suffix name for editing: for example: ifcfg-ens33 or ifcfg-ens0, specifically 33 or 0 or other, you can view it through ifconfig.

vim ifcfg-ens33
BOOTPROTO=static        #开机协议,有dhcp及static;
ONBOOT=yes              #设置为开机启动;
DNS1=114.114.114.114    #这个是国内的DNS地址,是固定的;
IPADDR=192.168.220.10   #你想要设置的固定IP,理论上192.168.220.3-255之间都可以,请自行验证;
NETMASK=255.255.255.0   #子网掩码,不需要修改;
GATEWAY=192.168.220.2   #网关,第一张图里有网关。

4. Restart the network

service network restart

At this point, the fixed IP of the vmware virtual machine is set, the virtual machines can be accessed, and the host can access the virtual machine through ssh.

 

question

After changing the ip, ssh accesses the virtual machine, and the connection freezes, and the following appears:

Solution:

vi /etc/ssh/sshd_config

 

Guess you like

Origin blog.csdn.net/chengshiruxia/article/details/112475094