Page 1 of 1

How can I assign a static IP?

Posted: 31. Mar 2011, 15:58
by NatHarari
Hi everyone,

I've got a question about static IPs. :)

I have a Debian Lenny host (latest update) running VB 4.0.4. On it, I've got an Ubuntu 10.10 installation (all this has been installed today so it's all the latest stuff and completely updated).

My Host has an IP of X.X.X.250 with another four static IP's available and two ethernet cards in the host. I'd like to assign a static IP to my guest ubuntu installation.

How exactly do I do it?

I've tried reading the manual, but I really am not sure still how to do it. Do I have to assign it via my host first, and then which settings would I use for the guest?

IE: Host IP: X.X.X.250
Guest: X.X.X.253

I'm not sure what other information to include so please let me know if you need any other info and I'll certainly post it asap.

Much appreciated for any help and thank you in advance. :)

Note: I'm trying to do this via the desktop GUI (IE: Gnome in Debian and default Gnome in Ubuntu) with the default GUI interface to manage VirtualBox instances. Command line is entirely possible, but I'd like to see how to do it with a GUI if at all possible. :)

Re: How can I assign a static IP?

Posted: 31. Mar 2011, 16:37
by Perryg
Use Bridged mode and assign the address to the guest in the usual manor.

Re: How can I assign a static IP?

Posted: 1. Apr 2011, 00:10
by saeldur
The simplest way to setup fixed IP in your eth0 is by editing /etc/network/interfaces file. Something like:

Code: Select all

       auto lo eth0

       iface lo inet loopback

       iface eth0 inet static
            address 192.168.1.253
            netmask 255.255.255.0
            gateway 192.168.1.1
Don't get confused by the auto word, it'll be static, it's just to start at boot time.

More information in man interfaces

However, you might find more straightforward to set the IP via NetworkManager. Check the Ubuntu Documentation about this, it's really helpful (look at 6.1 Adding Wired connections and 6.1.3 IPv4 Settings). If you check System Setting, both ways should give you the same result (this second option is not a GUI for the first one, but it's more the Ubuntu way I think).

Re: How can I assign a static IP?

Posted: 1. Apr 2011, 00:22
by NatHarari
saeldur wrote:The simplest way to setup fixed IP in your eth0 is by editing /etc/network/interfaces file. Something like:

Code: Select all

       auto lo eth0

       iface lo inet loopback

       iface eth0 inet static
            address 192.168.1.253
            netmask 255.255.255.0
            gateway 192.168.1.1
Don't get confused by the auto word, it'll be static, it's just to start at boot time.

More information in man interfaces

However, you might find more straightforward to set the IP via NetworkManager. Check the Ubuntu Documentation about this, it's really helpful (look at 6.1 Adding Wired connections and 6.1.3 IPv4 Settings). If you check System Setting, both ways should give you the same result (this second option is not a GUI for the first one, but it's more the Ubuntu way I think).

Thanks! I did that on the Host, actually. How do I implement it on the Guest?

This is very helpful already: letting me know I didn't totally mess up. :) I just don't know how I'd have it recognize the guest now.

Re: How can I assign a static IP?

Posted: 1. Apr 2011, 00:25
by vbox4me2
In the Guest its no different, you apply it to the Guest network adapter.

Re: How can I assign a static IP?

Posted: 1. Apr 2011, 00:30
by NatHarari
vbox4me2 wrote:In the Guest its no different, you apply it to the Guest network adapter.
Thank you, I'm gonna try it tomorrow morning. :) Very much appreciated.