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

MaksimP

Bit poster
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:
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.
 
I'm not sure, but you can try to hack it by editing the file "/Library/Preferences/Parallels/parallels_dhcp_leases".
 
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.
 
Back
Top