如何实现虚拟机和宿主的SSH通信

1.宿主用xp,虚拟机用redhat5,因为在不开STARTX的情况下vm不好操作,所以要在宿主机上用putty连接虚拟主机练习

2.网络用NAT,安装完虚拟机后发现宿主机上未发现VMware Network Adapter VMnet8这个虚拟网卡,在VM的安装目录中运行vmnetcfg.exe,如下图设置

3.在宿主和虚拟机上ping对方都能通后,确认是否安装SSH服务

开启ssh服务:

service sshd start


关闭ssh服务:
service sshd stop


重启ssh服务:

servcie sshd restart


SSH服务开机自动启动:
chkconfig sshd on


取消开机自启动:

chkconfig sshd off


开启服务后,检查服务状态:
service sshd status

ssh username@localhost测试(前提必须安装了Linux下得ssh客户端软件包)


或者在Windows机器上,利用putty等ssh客户端工具远程连接。


若能成功登入,说明SSH服务已经可用。

若不能成功登入,请检查防火墙设置。


查看防火墙状态:
/etc/init.d/iptables status

service iptables status


关闭防火墙:
/etc/rc.d/init.d/iptables stop

service iptables stop
或永久性关闭防火墙:
chkconfig iptables off


打开防火墙:
/etc/rc.d/init.d/iptables srart

service iptables start
或永久性关闭防火墙:
chkconfig iptables on


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值