Assign Static IPs to VMs

Discussions related to using VirtualBox on Windows hosts.
Post Reply
Fortunecells
Posts: 4
Joined: 15. May 2017, 12:10

Assign Static IPs to VMs

Post by Fortunecells »

I have 2 IPs on 1 NIC from the provider. This is my network setting
2 ip.png
2 ip.png (11.65 KiB) Viewed 1164 times
Now how i can assign 1st IP to A VM, and 2nd IP to B VM?
socratis
Site Moderator
Posts: 27329
Joined: 22. Oct 2010, 11:03
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: Win(*>98), Linux*, OSX>10.5
Location: Greece

Re: Assign Static IPs to VMs

Post by socratis »

Use Bridged, set the IPs to static from within each VM and "assign 1st IP to A VM, and 2nd IP to B VM".
Do NOT send me Personal Messages (PMs) for troubleshooting, they are simply deleted.
Do NOT reply with the "QUOTE" button, please use the "POST REPLY", at the bottom of the form.
If you obfuscate any information requested, I will obfuscate my response. These are virtual UUIDs, not real ones.
Fortunecells
Posts: 4
Joined: 15. May 2017, 12:10

Re: Assign Static IPs to VMs

Post by Fortunecells »

I now using bridge, and inside the VM i manually configure the IPv4, but my VM now cant connect to internet, whats wrong with this setting?
122.png
122.png (35.07 KiB) Viewed 1151 times
socratis
Site Moderator
Posts: 27329
Joined: 22. Oct 2010, 11:03
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: Win(*>98), Linux*, OSX>10.5
Location: Greece

Re: Assign Static IPs to VMs

Post by socratis »

I don't know, I can't tell. Most of the information that I need are obfuscated. So, I can't know if the numbers that you put in the configuration make any sense or not. I suggest that you share your configuration, so that we'll know what we're dealing with.
Do NOT send me Personal Messages (PMs) for troubleshooting, they are simply deleted.
Do NOT reply with the "QUOTE" button, please use the "POST REPLY", at the bottom of the form.
If you obfuscate any information requested, I will obfuscate my response. These are virtual UUIDs, not real ones.
Perryg
Site Moderator
Posts: 34369
Joined: 6. Sep 2008, 22:55
Primary OS: Linux other
VBox Version: OSE self-compiled
Guest OSses: *NIX

Re: Assign Static IPs to VMs

Post by Perryg »

It appears that both addresses have been assigned to the host so they can not be assigned to the guests using Bridged mode. What you actually have is three separate machines ( host, vm1, and vm2 )
and each would require a separate address. Is your goal to have these machines visible to the public?
Fortunecells
Posts: 4
Joined: 15. May 2017, 12:10

Re: Assign Static IPs to VMs

Post by Fortunecells »

Yes i want this VMs visible to the public
Perryg
Site Moderator
Posts: 34369
Joined: 6. Sep 2008, 22:55
Primary OS: Linux other
VBox Version: OSE self-compiled
Guest OSses: *NIX

Re: Assign Static IPs to VMs

Post by Perryg »

Then you are going to need 3 separate addresses and the two that you want the guests to have can not be bound to the host.
scottgus1
Site Moderator
Posts: 20945
Joined: 30. Dec 2009, 20:14
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Windows, Linux

Re: Assign Static IPs to VMs

Post by scottgus1 »

socratis wrote:I don't know, I can't tell. Most of the information that I need are obfuscated. So, I can't know if the numbers that you put in the configuration make any sense or not. I suggest that you share your configuration, so that we'll know what we're dealing with.
At first I said, huh? Then I selected and burst out laughing. Quite effective in displaying your point, Socratis!

Fortune, you can't hide the info we need to help you. You're asking questions about IP addresses then you hide all the IP addresses - not going to help us help you. Folks can't hack into your computer just by knowing your LAN IP addresses. They need the public ones, at least.

That said, you say you have two public IP's on one NIC. OK, use Virtualbox "Bridged" to connect both guests to the one NIC, as recommended by our gurus in green above. Give each guest a static IP address within the guest OS.

Then you're going to need normal networking skills to separate the public IPs to the static IP addresses set in each guest, keeping in mind that if you set both IPs to the guests you will have none set for your host, thus the three-IP recommendation from Perry. Or put one public IP to one guest and leave the other for your whole network, with port forwarding to force internet-sourced traffic to the other guest. Ports or routes or something, something in your network router, etc., not a Virtualbox thing. You would run into the same problem running physical PCs: how to get traffic from two public IPs coming on one Ethernet wire to separate to two physical PCs? However you would accomplish that, you'd do the same thing with your Virtualbox setup. There are no settings in Virtualbox Bridged that will enable this, that I know of.
Post Reply