Page 1 of 1

[Solved] Assign public IP address to VM?

Posted: 20. Oct 2009, 15:20
by J2R
I have a machine at a hosting provider which is running Windows 2008 Server, whose IP address is 83.xxx.xxx.xxx (obviously with real numbers instead of the x's!). I have been given a couple of 'spare' addresses in the range 77.xxx.xx.xxx. What I would like to be able to do is to have a Linux guest VM running certain services, accessible publicly, so I presumed I would set up a bridged adapter in the Windows host, and in Linux configure eth0 with the static address 77.xxx.xx.xxx. Having done this, though, I'm neither able to address the VM from the host nor vice versa. So what is the correct way to do what I want? Thx.

Re: Assign public IP address to VM?

Posted: 20. Oct 2009, 15:30
by Sasquatch
Just setting an IP address won't get you anywhere. You still need a route to it, so a gateway is needed and it needs to be registered to a DNS server if you want to access it through name instead of IP.

Re: Assign public IP address to VM?

Posted: 20. Oct 2009, 16:13
by J2R
Sasquatch wrote:Just setting an IP address won't get you anywhere. You still need a route to it, so a gateway is needed and it needs to be registered to a DNS server if you want to access it through name instead of IP.
I set up eth0 in /etc/network/interfaces on the Ubuntu guest with the static IP address but I don't actually know what the gateway should be (I took a guess). Is this likely to be what the issue is? I presume that with a correct gateway in there, the host should be able to find the guest and vice versa, but I'm puzzled about the two entirely different ranges.

Re: Assign public IP address to VM?

Posted: 20. Oct 2009, 16:23
by Sasquatch
You should have gotten the rest of the IP configuration from your provider that supplied those IP addresses. If it didn't, ask them for it. You would face the same problems as with a native system.

Re: Assign public IP address to VM?

Posted: 20. Oct 2009, 16:45
by J2R
Sasquatch wrote:You should have gotten the rest of the IP configuration from your provider that supplied those IP addresses. If it didn't, ask them for it. You would face the same problems as with a native system.
Thanks, I'm trying to get that information now. So am I right in thinking that all I should need to do would be to use a bridged adapter and then configure the requisite static IP address information in my Linux VM and it should then be addressable via that public IP address?

Re: Assign public IP address to VM?

Posted: 20. Oct 2009, 17:03
by Sasquatch
Yes, the same things you did as on the Host to make it internet accessible. Bridged will make it appear like a separate machine on the network.

Re: Assign public IP address to VM?

Posted: 21. Oct 2009, 17:07
by J2R
Well, the hosting provider got back to me with the answer "You don't actually need a gateway address for these additional IPs." Now, I'll admit I don't know much about networking but this is definitely something I don't get - how can an additional IP, in a different range, not require a gateway address? I did try configuring a static IP address without a gateway in the VM, but once again I couldn't access the network.

Re: Assign public IP address to VM?

Posted: 21. Oct 2009, 17:15
by Sasquatch
Sounds like they think you add that IP address as second IP on an already configured interface. If they are serious about this for an unconfigured machine, I will wish you good luck, because without a gateway, no OS will know where to send a reply to, the data will just go into a big black hole.

Re: Assign public IP address to VM?

Posted: 21. Oct 2009, 17:56
by J2R
Sasquatch wrote:Sounds like they think you add that IP address as second IP on an already configured interface. If they are serious about this for an unconfigured machine, I will wish you good luck, because without a gateway, no OS will know where to send a reply to, the data will just go into a big black hole.
Yes, my thoughts exactly. I'll see if I can press them.

Re: Assign public IP address to VM?

Posted: 21. Oct 2009, 18:55
by J2R
Well, I got a gateway address out of them but I still can't get this working. If I do an ifconfig, I see that my eth0 interface has a large value for TX bytes and 0 for RX bytes. If I try to connect to an IP address on the same network, I get a no route to host error. I tried changing from pcnet to Intel T Server but it has not made a difference. Any tips, please?

Re: Assign public IP address to VM?

Posted: 21. Oct 2009, 20:43
by Sasquatch
Does the gateway show up in route? You should have a default gateway set in that, like this:

Code: Select all

default         router          0.0.0.0         UG    100    0        0 eth0
You can add the gateway manually through the command line using this:

Code: Select all

route add default gw <ip address>
Having a high TX value only means that a lot of packets have been transmitted, but because RX is 0, no packet ever got received.

Re: Assign public IP address to VM?

Posted: 22. Oct 2009, 22:31
by J2R
You know, sometimes I'm so busy trying to be really clever in one area that I don't realise how staggeringly stupid I'm being in another...

I found the problem. I was simply trying to bridge to the wrong adapter, the primary one. As soon as I chose the secondary one (which I hadn't noticed before) the problem went away. Sorry to have wasted your time!

Re: [Solved] Assign public IP address to VM?

Posted: 18. Mar 2014, 04:39
by cruzades
Hi J2R

I'm stumbled with this thread

It is yours, and I have the same issue with yours, I'm hoping that you can able to give a light for this please.

My setup is, Windows 2008 Server hosted.

I have 10 Public IPs available to use for my virtualbox, how ever I can't even get my virtual box and IP from secondary NIC (bridge), my question is do I need to put my Public IP on my Second NIC (host) so that the client (virtualbox) will able to get an IP?

Can I have your setup documentation from your setup?

Regards,
Eric

Re: [Solved] Assign public IP address to VM?

Posted: 18. Mar 2014, 13:55
by mpack
The post you're commenting on was made in 2009, and J2R has not visited since Dec 2011, so you might wait a long time for his answer...