Reputation: 3196
Host is Windows 8.1; provider is VirtualBox 4.3.4; Vagrant version is 1.3.5.
Host has just a single NIC, wired, with IP 192.168.1.100.
Vagrantfiles reads:
config.vm.box = "precise64"
config.vm.box_url = "http://cloud-images.ubuntu.com/vagrant/precise/current/precise-server-cloudimg-amd64-vagrant-disk1.box"
config.vm.network :forwarded_port, guest: 80, host: 8080
config.vm.provision :puppet do |puppet|
puppet.manifests_path = "puppet/manifests"
puppet.module_path = "puppet/modules"
puppet.manifest_file = "init.pp"
puppet.options="--verbose --debug"
However, following vagrant up
, the VM gets a completely wrong IP address. ifconfig
for the guest reads:
vagrant@vagrant-ubuntu-precise-64:~$ ifconfig
eth0 Link encap:Ethernet HWaddr 08:00:27:1a:b6:5e
inet addr:10.0.2.15 Bcast:10.0.2.255 Mask:255.255.25
inet6 addr: fe80::a00:27ff:fe1a:b65e/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:356 errors:0 dropped:0 overruns:0 frame:0
TX packets:239 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:38937 (38.9 KB) TX bytes:33157 (33.1 KB)
Why is Vagrant totally ignoring the port forwarding setting on the vagrantfile? IP address should be 192.168.1.x
and instead I get this random 10.0.2.15
. Any ideas?
Edit: Host can't even ping 10.0.2.15
. No response, even when the VM is up. Something is very broken.
Edit 2: Now I'm getting /sbin/ip addr flush dev eth1 2> /dev/null
on 2 different systems. Argh.
Upvotes: 5
Views: 3268
Reputation: 439
Ssh into the machine
Delete the file /etc/udev/rules.d/70-persistent-net.rules
Exit the machine
Do a "vagrant reload"
I think that does the trick =]
Upvotes: 9
Reputation: 932
port-forwarding means that packets received on mentioned port will be forwarded to the guest. in your example localhost:8080 should redirected to the vm's service listening on vm's 80 port.
Regarding "random" 10.0.2.15, usually this IP assigned to the guest if VM configured with NAT attachment, this mean that guest absolutely invisible from outside (except port-forward, but this access possible only via host). And of course you can't ping guest from the host only in opposite direction (from guest to host).
Upvotes: 1