问题原文
原帖链接 · Richard Rublev · CC BY-SA 4.0
I prepared a cluster of 4VM's with this Vagrantfile.
hosts = {
"n1" => "192.168.77.10",
"n2" => "192.168.77.11",
"n3" => "192.168.77.12",
"n4" => "192.168.77.13"
}
Vagrant.configure("2") do |config|
# always use Vagrants insecure key
config.ssh.insert_key = false
# forward ssh agent to easily ssh into the different machines
config.ssh.forward_agent = true
check_guest_additions = false
functional_vboxsf = false
config.vm.box = "ubuntu/bionic64"
hosts.each do |name, ip|
config.vm.define name do |machine|
machine.vm.network :private_network, ip: ip
machine.vm.provider "virtualbox" do |v|
v.name = name
end
end
end
end
Now I have four running virtual machines. After vagrant ssh n4,my next step is to ssh to other machines,but I can not manage. I tried this
vagrant ssh [email omitted]
The machine with the name '[email omitted]' was not found configured for
this Vagrant environment.
I already posted question regarding denied permission
ssh [email omitted]
[email omitted]: Permission denied (publickey).
This example is from Mastering Kubernetes book.(Gigi Sayfan) I am not sure if I have permissions problem or something else. I can not find similar examples.
I tried then
vagrant@ubuntu-bionic:~$ vagrant ssh vagrant@n1
The machine with the name 'vagrant@n1' was not found configured for
this Vagrant environment.
This does not work either
vagrant@ubuntu-bionic:~$ ssh vagrant@n1
ssh: Could not resolve hostname n1: Temporary failure in name resolution
I really do not understand what is going on.
My config
vagrant ssh-config
Host n1
HostName 127.0.0.1
User vagrant
Port 2222
UserKnownHostsFile /dev/null
StrictHostKeyChecking no
PasswordAuthentication no
IdentityFile /home/miki/.vagrant.d/insecure_private_key
IdentitiesOnly yes
LogLevel FATAL
ForwardAgent yes
Host n2
HostName 127.0.0.1
User vagrant
Port 2200
UserKnownHostsFile /dev/null
StrictHostKeyChecking no
PasswordAuthentication no
IdentityFile /home/miki/.vagrant.d/insecure_private_key
IdentitiesOnly yes
LogLevel FATAL
ForwardAgent yes
Host n3
HostName 127.0.0.1
User vagrant
Port 2201
UserKnownHostsFile /dev/null
StrictHostKeyChecking no
PasswordAuthentication no
IdentityFile /home/miki/.vagrant.d/insecure_private_key
IdentitiesOnly yes
LogLevel FATAL
ForwardAgent yes
Host n4
HostName 127.0.0.1
User vagrant
Port 2202
UserKnownHostsFile /dev/null
StrictHostKeyChecking no
PasswordAuthentication no
IdentityFile /home/miki/.vagrant.d/insecure_private_key
IdentitiesOnly yes
LogLevel FATAL
ForwardAgent yes
If I try
ssh -vvv vagrant@n1
OpenSSH_7.6p1 Ubuntu-4ubuntu0.3, OpenSSL 1.0.2n 7 Dec 2017
debug1: Reading configuration data /home/vagrant/.ssh/config
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *
debug2: resolving "n1" port 22
ssh: Could not resolve hostname n1: Temporary failure in name resolution
Gerald suggested this
vagrant ssh n1
Output
The machine with the name 'n1' was not found configured for
this Vagrant environment.
已采纳解答
原帖链接 · Justin Chou · CC BY-SA 4.0
In your
vagrant upfolder, usevagrant ssh n1It seems that you are using the default ssh key with
config.ssh.insert_key = falsesetting, then usessh [email omitted] -i ~/.vagrant.d/insecure_private_keymight work for you.
摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。
