How to set static IP on my VM with only one interface?

Discussion in 'Parallels Provider for Vagrant' started by MaksimP, Oct 5, 2015.

  1. MaksimP

    MaksimP Bit Poster

    Messages:
    9
    Hello.

    How to set static IP on VM without second interface?
    If i write in Vagrant file
    Code:
    config.vm.network "public_network", ip: "10.10.10.20"
    I'm getting a second interface with need IP. But I don't need two interfaces on VM.

    If i write:
    Code:
    config.vm.provider "parallels" do |v|
       v.customize ["set", :id, "--device-set", "net0", "--ipadd", "10.10.10.20", "--gw", "10.10.10.1", "--nameserver", "10.10.10.1"]
    end
    
    config.ssh.host = "10.10.10.20"
    
    Vagrant can not configure VM with timeout (I suspect that there can not be accessed via SSH)
     
    Last edited: Oct 5, 2015
  2. Mikhail Zholobov

    Mikhail Zholobov Parallels Developers

    Messages:
    49
    Sorry, currently it's not possible. The first network interface is always configured to "Shared" network for Vagrant internal needs. Vagrant provider expects that it's IP will be reached with DHCP.
     
  3. MaksimP

    MaksimP Bit Poster

    Messages:
    9
    May be it's possible to configure DHCP of PD to set specific IP for specific MAC?
     
  4. Mikhail Zholobov

    Mikhail Zholobov Parallels Developers

    Messages:
    49
    I'm not sure, but you can try to hack it by editing the file "/Library/Preferences/Parallels/parallels_dhcp_leases".
     
  5. MaksimP

    MaksimP Bit Poster

    Messages:
    9
    in /Library/Preferences/Parallels/parallels_dhcp_leases
    Code:
    [vnic0]
    10.10.10.10="1444126469,1800,001c42000000,01001c42000000"
    
    in Vagrantfile
    Code:
    config.vm.provider "parallels" do |v|
        v.customize ["set", :id, "--device-set", "net0", "--mac", "00:1C:42:00:00:00"]
    end
    
    It worked!
    Thank you.
     
  6. 2viacartao

    2viacartao

    Messages:
    1
    I was trying to reset a specific IP and your tip given quite right.

    Thank Mikhail.
     
  7. NoahO

    NoahO Bit Poster

    Messages:
    5
    Thanks, this helped me a lot.
     
  8. Swati@Parallels

    Swati@Parallels Kilo Poster

    Messages:
    361
    Glad to hear that issue has been resolved. Please feel free to reach us anytime.
     
  9. RAILITYL

    RAILITYL Bit Poster

    Messages:
    21
    I'm getting a second interface with need IP. But I don't need two interfaces on VM.
     
  10. RAILITYL

    RAILITYL Bit Poster

    Messages:
    21
    Glad to hear that issue has been resolved. Please feel free to reach us anytime.
     

Share This Page