实现跳板机

1、实现跳板机,通过一台服务器可以同时配置多台服务器。方便统一配置和管理。(主机名为node1 node2 node3,实现在node1中统一配置三台服务器)

ssh-keygen  #创建信任密钥

ssh-copy-id -i /root/.ssh/id_rsa.pub root@192.168.1.148

ssh-copy-id -i /root/.ssh/id_rsa.pub root@192.168.1.144 #将公钥给目的主机

   vi /etc/hosts

        192.168.1.142 node1

192.168.1.148 node2

192.168.1.144 node3

   vi .bashrc

        alias han='for i in {1..3}; do'

   source .bashrc

测试

  han ssh node$i 'uname -n' ; done

原文地址:https://www.cnblogs.com/han1094/p/6351811.html