I have a RHEL image already preconfigured, I don't know how it was originally setup. By default, it is configured with a local network interface on the ip 192.168.50.50. What I am trying to do is configure its ip from the Vagrant script.
This doesn't seem to do anything:
config.vm.network "private_network", ip: "192.168.50.10"
This does change the ip:
sudo nmcli con mod bond0 ipv4.addresses 192.168.50.10/24
service network restart
But after that apparently Vagrant doesn't automatically detect the ip to connect to, so I need to add:
config.ssh.host = LOCAL_IP
But here's the problem: on the first time, the ip is the default one (.50.50). So I can't already set config.ssh.host
to my desired ip. If I omit the config.ssh.host
line, it runs the first time but not after, and vagrant ssh
fails as well.
Is there a way to set the box ip without editing the Vagrant script between the first and second vagrant up
?
Edit: Result of vagrant up --debug
command: http://pastebin.com/BTccc4NT
Edit: The problem was that the Vagrant file from the default box (on Windows, it's at C:\Users\user\.vagrant.d\boxes\nameofbox\virtualbox\Vagrantfile
) itself had this line:
config.vm.network "private_network", ip: "192.168.50.50", auto_config: false
config.vm.network "private_network", ip: "192.168.50.10"
should do the trick so there might be something else, do you have a provision script that force the ip ? can you runvagrant up --debug &> vagrant.log
and post the log file somewhere on pastebin (the file will be really large but will detail if the right commands are run correctly)