does packer 1.1.3 support bridged mode ?

51 views
Skip to first unread message

qq93...@gmail.com

unread,
Jan 22, 2018, 1:44:44 AM1/22/18
to Packer
  i was creating vm with existing ova,   my template is as below:
....................................................................................................................
 "builders"                 : [{
      "type"                 : "virtualbox-ovf",
      "name"                 : "vboxOvfBuilder",
      "vboxmanage"           : [
        [ "modifyvm", "{{.Name}}", "--memory", "{{user `memSize`}}"],
        [ "modifyvm", "{{.Name}}", "--cpus",   "{{user `cpuCount`}}" ],
        [ "modifyvm", "{{.Name}}", "--bridgeadapter1", "eno1"]
      ],
      "source_path"          : "{{user `diskImg`}}",
      "format"               : "{{user `diskFmt`}}",
      "headless"             : true,
      "vrdp_bind_address"    : "0.0.0.0",  
      "output_directory"     : "images-{{timestamp}}",
      "ssh_port"             : 22,
      "ssh_username"         : "root",
      "ssh_password"         : "welcome1",
      "ssh_wait_timeout"     : "1500s",
      "vm_name"              : "oraclelinux7u4-vbox",
      "shutdown_command"     : "shutdown -P now"
    }
  ],

during builder,  ssh conection failed.
...........................................................................................................................................................................................................................................................
2018/01/22 14:31:35 packer: 2018/01/22 14:31:35 [DEBUG] TCP connection to SSH ip/port failed: dial tcp 127.0.0.1:2349: getsockopt: connection refused
2018/01/22 14:31:40 packer: 2018/01/22 14:31:40 [DEBUG] TCP connection to SSH ip/port failed: dial tcp 127.0.0.1:2349: getsockopt: connection refused
2018/01/22 14:31:45 packer: 2018/01/22 14:31:45 [DEBUG] TCP connection to SSH ip/port failed: dial tcp 127.0.0.1:2349: getsockopt: connection refused
2018/01/22 14:31:50 packer: 2018/01/22 14:31:50 [DEBUG] TCP connection to SSH ip/port failed: dial tcp 127.0.0.1:2349: getsockopt: connection refused
2018/01/22 14:31:55 packer: 2018/01/22 14:31:55 [DEBUG] TCP connection to SSH ip/port failed: dial tcp 127.0.0.1:2349: getsockopt: connection refused
2018/01/22 14:32:00 packer: 2018/01/22 14:32:00 [DEBUG] TCP connection to SSH ip/port failed: dial tcp 127.0.0.1:2349: getsockopt: connection refused
2018/01/22 14:32:05 packer: 2018/01/22 14:32:05 [DEBUG] TCP connection to SSH ip/port failed: dial tcp 127.0.0.1:2349: getsockopt: connection refused
...........................................................................................................................................................................................................................................................
hence i'm doubt whether packer support bridged mode ? 

i have tried to set ssh_skip_nat_mapping  to true, it still failed. 


Alvaro Miranda Aguilera

unread,
Jan 22, 2018, 2:26:29 AM1/22/18
to packe...@googlegroups.com
the nat mode will use the host networking to reach the network, why you need bridge?

bridge mode will work, just not sure if will be able to get the IP of the guest dinamically, so may fail to connect automagically

if you can share the requirements perhaps will be easier to help

alvaro

--
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/43c2e6f0-bf7c-4704-98ff-dd6cf7250be1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Alvaro

Rickard von Essen

unread,
Jan 22, 2018, 2:33:11 AM1/22/18
to packe...@googlegroups.com
Bridge mode works, but as Alvaro said packer can't know the IP of the guest. So either you run with a fixed IP or you add the bridge network but also keep the nat if. 

jerry wang

unread,
Jan 22, 2018, 2:35:06 AM1/22/18
to packe...@googlegroups.com
thanks for your reply.
my requirement is :
1) Currently it's mandatory for me  to use bridge to configure guest os due my software limitation. 
2) the ip of guest os was using dhcp .
3) can you share the tech that host machine connect to guest os ( just as you said, not sure packer are able to get the IP of the guest dinamically )  ?  in other word, how to avoid the connection issue if using bridged ?

Thanks in advancd.


You received this message because you are subscribed to a topic in the Google Groups "Packer" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/packer-tool/g2-n5syCxe8/unsubscribe.
To unsubscribe from this group and all its topics, 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/CAHqq0ezuL028CymtnRGP81ZDb3zhKJG-_sBHFz_EWzVzdCbGMw%40mail.gmail.com.

Alvaro Miranda Aguilera

unread,
Jan 22, 2018, 4:11:22 AM1/22/18
to packe...@googlegroups.com
couple of options.

but first, move from something that works, to add incremental steps. so get a packer + os + nat to install without network/internet requirement.



As rickard suggestion, add a 2nd interface, that is on the bridge network and test it works.

You need this after OS install, after reboot, so OS intall should be done first, also, you can look this in 2 steps.

use say virtualbox-iso to just install the OS and create a base box. nat is fine since no internet is needed

then use virtualbox-ovf to create a VM from the base VM and do the network part.


If I had to do this in one shot, then I would try to  get a fixed IP from the network and use it .





For more options, visit https://groups.google.com/d/optout.



--
Alvaro

JerryWang

unread,
Jan 24, 2018, 5:58:17 AM1/24/18
to Packer
I have tried the following options:

1) change the only (first)  bridged nic from dhcp to static ip, packer can be successful. but it was valueless for my configuration, we need bridged nic with dhcp.
2) add the second nic to nat (keep the first as bridged), failed.
3) change the first  bridged nic to NAT , add the second nic to be as bridged. packer can be successful. 
   but we need manually add config info for nic 2, otherwise nic can't get dhcp ip. this is a little difficult if we want to automate considering the  types of host machine/guest os.
   
4) will try the fourth option, 

  a)first change the only (first)  bridged nic to NAT. 
  b)do some provioner script operation
  c) poweroff the guest machine
  d) add a script to change  the only (first)  bridged nic to NAT. 
  e) export the vm to ova.
  
  Hi guys, is it possible to add stepd  between c and e ? 
To unsubscribe from this group and stop receiving emails from it, send an email to packer-tool...@googlegroups.com.



--
Alvaro

--
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 a topic in the Google Groups "Packer" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/packer-tool/g2-n5syCxe8/unsubscribe.
To unsubscribe from this group and all its topics, send an email to packer-tool...@googlegroups.com.

--
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...@googlegroups.com.



--
Alvaro

Alvaro Miranda Aguilera

unread,
Jan 24, 2018, 10:01:41 PM1/24/18
to packe...@googlegroups.com
for 3:

3) change the first  bridged nic to NAT , add the second nic to be as bridged. packer can be successful. 
   but we need manually add config info for nic 2, otherwise nic can't get dhcp ip. this is a little difficult if we want to automate considering the  types of host machine/guest os.
   

network --bootproto=dhcp

--device= - specifies the device to be configured (and eventually activated in Anaconda) with the network command.
 you should always specify a --device= for every network command.


use floppy to pass the kickstart, and in the kicstart configure the networks as you need

you can add multiples, say first one dhcp for packer
and 2nd for your network wirh dhcp or fixed



for the last q:



i still wonder why not doing this in 2 steps

first step install OS from iso

second step with intermediate box, do the os update and software installation


alvaro

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/9b5779c1-ac78-483f-82c7-b2eccada4cfb%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.



--
Alvaro

Reply all
Reply to author
Forward
0 new messages