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
https://www.packer.io/docs/builders/virtualbox-iso.html#ssh_skip_nat_mapping

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

On Nov 2, 2017 17:06, "rhys.james.campbell via Packer" <
packer-tool@googlegroups.com> wrote:

> 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
>
> --
> 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+unsubscr...@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
> <https://groups.google.com/d/msgid/packer-tool/d8c86c06-27a0-4e3e-8dc1-5e53871831b7%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/packer-tool/CALz9Rt8s%2BQd3ggnfrnDAxqA1X73UO%2Bfkg6c6uNTaEWRM5Oe8Lg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to