Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiple NICs on virtualbox #1040

Open
nettucu opened this issue Mar 6, 2015 · 1 comment
Open

Multiple NICs on virtualbox #1040

nettucu opened this issue Mar 6, 2015 · 1 comment

Comments

@nettucu
Copy link
Contributor

nettucu commented Mar 6, 2015

Hi,

I wanted to be able to build a virtualbox vm and have 4 NICs attached to it. It turned out you can not by default do that because of the way VBox assigns IPs to NAT. If the NIC to get NAT is eth0 all is well and it works, but if it's eth3 it doesn't work anymore because veewee serves the kickstart on the wrong IP.
I managed to get it working by changing lib/veewee/provider/virtualbox/box/helper/ip.rb:

diff --git i/lib/veewee/provider/virtualbox/box/helper/ip.rb w/lib/veewee/provider/virtualbox/box/helper/ip.rb
index 3791a8b..fef85ec 100644
--- i/lib/veewee/provider/virtualbox/box/helper/ip.rb
+++ w/lib/veewee/provider/virtualbox/box/helper/ip.rb
@@ -5,7 +5,12 @@ module Veewee

         # http://www.virtualbox.org/manual/ch09.html#idp13716288
         def host_ip_as_seen_by_guest
-          "10.0.2.2"
+          # as per definition in virtualbox 
+          # we need to add 1 because vboxmanage starts counting from 1 for display,
+          # but counts from 0 when actually assigning the IP
+          host_ip = "10.0.#{self.natinterface.to_i + 1}.2"
+          return host_ip # "10.0.2.2"
+          #"10.0.2.2"
         end

The idea is that VBox has a bad habbit of counting eth0, eth1, eth2 when it assigns the IP address from 10.0.x.2 and the webserver is launched on the wrong ip

@mpapis
Copy link
Collaborator

mpapis commented Mar 6, 2015

please open a pull request with this change, did you had chance to test it in more configurations?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants