歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
Linux教程網 >> Linux綜合 >> 學習Linux >> CentOS 7 下實現多虛擬機互信

CentOS 7 下實現多虛擬機互信

日期:2017/3/6 9:28:16   编辑:學習Linux

CentOS 7 下實現多虛擬機互信


CentOS 7 下實現多虛擬機互信


假設CentOS 7三台虛擬機A(10.139.8.82)、B(10.139.8.83)、C(10.139.8.84),需要保證三台虛擬機之間網絡的連通性。

操作步驟:

一、在A機上配置

①以root用戶登錄,更改ssh配置文件 /etc/ssh/sshd_config
RSAAuthentication yes #啟用rsa認證
PubkeyAuthentication yes #啟用公鑰私鑰配對認證方式
AuthorizedKeysFile .ssh/authorized_keys #公鑰文件路徑

[root@localhost /]#systemctl restart sshd //重啟ssh服務

②生成公鑰私鑰對
[root@localhost /]#ssh-keygen -t rsa
系統在/root/.ssh下生成id_rsa、id_rsa.pub

③把A機下的id_rsa.pub發送到B、C機
[root@localhost /]#ssh-copy-id -i /root/.ssh/id_rsa.pub 10.139.8.83
[root@localhost /]#ssh-copy-id -i /root/.ssh/id_rsa.pub 10.139.8.84

二、B、C機采用步驟一中相同的方法,要記得改變ip地址

三、實現ssh多機互信
以A機為例
[root@localhost /]#ssh 10.139.8.83 //登錄B機
[root@localhost /]#ifconfig //檢查是否成功登錄
[root@localhost /]#exit //退出ssh登錄,返回本機

http://xxxxxx/Linuxjc/1145124.html TechArticle

Copyright © Linux教程網 All Rights Reserved