How can I assign a static IP?

Discussions about using Linux guests in VirtualBox.
Post Reply
NatHarari
Posts: 3
Joined: 31. Mar 2011, 15:30
Primary OS: Debian Lenny
VBox Version: OSE Debian
Guest OSses: Ubuntu

How can I assign a static IP?

Post 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. :)
Perryg
Site Moderator
Posts: 34369
Joined: 6. Sep 2008, 22:55
Primary OS: Linux other
VBox Version: OSE self-compiled
Guest OSses: *NIX

Re: How can I assign a static IP?

Post by Perryg »

Use Bridged mode and assign the address to the guest in the usual manor.
saeldur
Posts: 8
Joined: 22. Mar 2011, 18:05
Primary OS: Linux other
VBox Version: OSE other
Guest OSses: Linux, Windows

Re: How can I assign a static IP?

Post 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).
NatHarari
Posts: 3
Joined: 31. Mar 2011, 15:30
Primary OS: Debian Lenny
VBox Version: OSE Debian
Guest OSses: Ubuntu

Re: How can I assign a static IP?

Post 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.
vbox4me2
Volunteer
Posts: 5218
Joined: 21. Nov 2008, 20:27
Location: Rotterdam
Contact:

Re: How can I assign a static IP?

Post by vbox4me2 »

In the Guest its no different, you apply it to the Guest network adapter.
NatHarari
Posts: 3
Joined: 31. Mar 2011, 15:30
Primary OS: Debian Lenny
VBox Version: OSE Debian
Guest OSses: Ubuntu

Re: How can I assign a static IP?

Post 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.
Post Reply