TCP Connection to SSH ip/port failed

876 views
Skip to first unread message

rhys.jame...@googlemail.com

unread,
Nov 2, 2017, 12:06:03 PM11/2/17
to Packer
Hello,

I'm trying out packer for the first time. I am having difficulty getting ssh to work. I have run packer in debug mode and the following lines are output explaining why I cannot ssh to my target;

2017/11/02 16:51:20 packer: 2017/11/02 16:51:20 [DEBUG] TCP connection to SSH ip/port failed: dial tcp 192.168.47.110:4439: getsockopt: connection refused
2017/11/02 16:51:25 packer: 2017/11/02 16:51:25 [DEBUG] TCP connection to SSH ip/port failed: dial tcp 192.168.47.110:4439: getsockopt: connection refused
2017/11/02 16:51:30 packer: 2017/11/02 16:51:30 [DEBUG] TCP connection to SSH ip/port failed: dial tcp 192.168.47.110:4439: getsockopt: connection refused

The ip address is correct but the port is wrong. I have set ssh_host to  192.168.47.110 and ssh_port to 22. Is ssh_port being ignored or is it not intended for this?

Here is my packet file edited for understanding...

{
 
"variables": {
   
...
   
"ip_address": "192.168.47.110",
   
...
 
},
 
"builders": [{
     
"boot_command": [
       
"..."
     
],
       
....
     
"ssh_host": "{{ user `ip_address` }}",
     
"ssh_username": "{{ user `ssh_username` }}",
     
"ssh_password": "{{ user `ssh_password` }}",
     
"ssh_port": 22,
     
....
     
"vboxmanage": [
           
[
             
"modifyvm",
             
"{{.Name}}",
             
"--nic1",
             
"hostonly",
             
"--hostonlyadapter1",
             
"vboxnet0"
           
]
       
]
 
}]
}

I have verified I can ssh into my host with...

ssh 192.168.47.110

Cheers,

Rhys

Rickard von Essen

unread,
Nov 2, 2017, 2:53:36 PM11/2/17
to packe...@googlegroups.com
VirtualBox network is a bit quirky. By default packer sets up nat for ssh. So by default it ssh to 127.0.0.1:<random port> where this is NAT'ed to the guest IP port 22. If you want to suppress this see

But if you are just learning Packer I would recommend that you instead remove ssh_address and let packer handle that. 

--
This mailing list is governed under the HashiCorp Community Guidelines - https://www.hashicorp.com/community-guidelines.html. Behavior in violation of those guidelines may result in your removal from this mailing list.
 
GitHub Issues: https://github.com/mitchellh/packer/issues
IRC: #packer-tool on Freenode
---
You received this message because you are subscribed to the Google Groups "Packer" group.
To unsubscribe from this group and stop receiving emails from it, send an email to packer-tool+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/packer-tool/d8c86c06-27a0-4e3e-8dc1-5e53871831b7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

rhys.jame...@googlemail.com

unread,
Nov 3, 2017, 9:48:58 AM11/3/17
to Packer
Removing ssh_address didn't work. I guess this is because I am settign a fix ip address. Settings ssh_skip_nat_mapping did the trick though.

Thanks,

Rhys 



Reply all
Reply to author
Forward
0 new messages