Open berdario opened 9 years ago
Yeah, it's very annoying that the IP addresses assigned by VirtualBox's DHCP server changes so quickly. The only workaround at the moment is to run "nixops deploy --check" - that should detect the new IP address.
@edolstra I've found that nixops deploy --check
is not always enough. I often need to remove the offending IP from ~/.ssh/known_hosts
as well.
Hm, what is the issue exactly? I believe the IP is synchronized on every start
, so is the issue that it is changing while the machine is running?
Won’t updating the IP before each ssh
(or even make private_ipv4
a property that’s updated on every read) solve this?
It can be workable with ~/.ssh/config
set to:
Host 192.168.0.*
StrictHostKeyChecking no
UserKnownHostsFile=/dev/null
AND nixops deploy --check
Still, that's just a workaround.
Note: --check
didn't help me, but manually updating the IP address in the nixops state helped:
$ sqlite3 ~/.nixops/deployments.nixops
then
sqlite3> UPDATE ResourceAttrs SET value = '192.168.56.102' WHERE machine=6 AND name='privateIpv4';
Is it possible to allow user specify the network.privateIPv4 options and reconfigure guest os use static ip address? I think vagrant has some behavior like this. It is ok to use dhcp as the initial method to access the guest os, after that a predictable static ip address is more reasonable.
I guess this could be related to this issue, still it'd be nice if there was an easy way to work around this.
Failing that, this should at least be documented in the manual, so that the suggested example configuration for deployments on VirtualBox will statically specify ip addresses.
this is the
dev.nix
of (which is pretty much the example trivial-vbox.nix from the manual):The machine was originally deployed just fine, on 192.168.56.102, this is the partial output of
nixops export -d dev
:and this is the output of
VBoxManage guestproperty get nixops-72421978-e769-11e4-a07e-34e6d704a2e9-devmachine /VirtualBox/GuestInfo/Net/1/V4/IP
:If I manually connect with ssh, add 192.168.56.102 as another address, redeploy and then reboot I keep getting the new 192.168.56.101 address.
Even if I add
deployment.targetHost = "192.168.56.101";
to the machine configuration, it'll get ignored since nixops still thinks that the machine is accessible on the old address...I now worked around this by manually ssh into it, adding the old address, add the following to the configuration:
redeploying, and now even after reboot it sticks...
Weirdly, if I try to change it back with
The change is not picked up correctly by nixops, even after the successfull deploy, and will thus locks itself out again