虚拟机环境准备

1.下载centos7.6镜像,并安装

https://archive.kernel.org/centos-vault/7.6.1810/isos/x86_64/
image

2.网卡1选择nat

image
网卡配置文件
image

enp0s3

DEVICE=enp0s3
TYPE=Ethernet
ONBOOT=yes
NM_CONTROLLED=yes
BOOTPROTO=dhcp

并配置虚拟机的端口转发
image

3.宿主机关闭防火墙

image

4.虚拟机关闭selinux及防火墙

image

5.虚拟机sshd优化,关闭dns解析

vim /etc/ssh/sshd_config

GSSAPIAuthentication no
UseDNS no

systemctl restart sshd.service
完整sshd_config配置文件

[root@localhost ~]# cat /etc/ssh/sshd_config | grep -v '^#' | sed '/^$/d'
HostKey /etc/ssh/ssh_host_rsa_key
HostKey /etc/ssh/ssh_host_ecdsa_key
HostKey /etc/ssh/ssh_host_ed25519_key
SyslogFacility AUTHPRIV
AuthorizedKeysFile	.ssh/authorized_keys
PasswordAuthentication yes
ChallengeResponseAuthentication no
GSSAPIAuthentication no
GSSAPICleanupCredentials no
UsePAM yes
X11Forwarding yes
UseDNS no
AcceptEnv LANG LC_CTYPE LC_NUMERIC LC_TIME LC_COLLATE LC_MONETARY LC_MESSAGES
AcceptEnv LC_PAPER LC_NAME LC_ADDRESS LC_TELEPHONE LC_MEASUREMENT
AcceptEnv LC_IDENTIFICATION LC_ALL LANGUAGE
AcceptEnv XMODIFIERS
Subsystem	sftp	/usr/libexec/openssh/sftp-server

6.关闭NetworkManager

systemctl stop NetworkManager
systemctl disable NetworkManager

7.连接虚拟机

image

posted @ 2021-11-01 21:25  SpecialSpeculator  阅读(59)  评论(0编辑  收藏  举报