vagrant ubuntu looses static ip after lid close

Discussion in 'Linux Virtual Machine' started by ascheman, Jun 29, 2015.

  1. ascheman

    ascheman Junior Member

    Messages:
    11
    I am using Vagrant 1.7.2 with Parallels provider (ParallelsDesktop-10.2.0-28956) on a MBP with OSX 10.8.5. I have assigned a static IP within the Vagrantfile

    Vagrant.configure(2) do |cddemo|
    cddemo.vm.network "private_network", ip: "10.211.55.7"
    cddemo.vm.provider "parallels" do |parallels, override|
    parallels.name = "ga-cddemo"
    parallels.memory = 3072
    override.vm.box = "parallels/ubuntu-14.04"
    end
    ...​

    This works fine, Vagrant sets up a second interface (eth1) and assigns the static IP to it (though I was expecting it drops the dhcp assignment for the first interface eth0 and provides only one interface), /etc/network/interfaces:
    # The primary network interface
    auto eth0
    iface eth0 inet dhcp
    # This is an autoconfigured IPv6 interface
    iface eth0 inet6 auto
    pre-up sleep 2
    #VAGRANT-BEGIN
    # The contents below are automatically generated by Vagrant. Do not modify.
    auto eth1
    iface eth1 inet static
    address 10.211.55.7
    netmask 255.255.255.0
    #VAGRANT-END​

    However, whenever I close the lid of the MBP and open it up again, the VM has lost its network connectivity. No ssh or even ping is possible neither to the dynamic IP nor to the static one. If I login to the console and "ifdown eth1" the VM immediately becomes accessible again. The I can "ifup eth1" and everything is fine. Nevertheless I would prefer to see it online on itself as soon as I resume from sleep mode.
     

Share This Page