Ubuntu 14.04 setting static IP for server on VirtualBox

9,202

Solution 1

To have a static IP for your server, you have to understand your network configuration. If you are the one managing the IP network, you have to use one of the free IP. Otherwise, please ask your network admin for a static IP and use that.

  • address (enter the IP you got from admin)
  • netmask (enter the subnet mask)
  • network (you can identify your network from the IP you got)
  • gateway (This also you have get from the admin)
  • dns-nameservers (this can be 8.8.8.8 or whatever admin gives you)

Except, IP address, everything else can be copied from another machine from your network which is configured with static IP.

Solution 2

I believe I have this working with the following settings in /etc/network/interfaces:

auto eth0
iface eth0 inet static
address 192.168.1.32
netmask 255.255.255.0
broadcast 192.168.1.255
network 192.168.1.0
gateway 192.168.1.1
dns-nameservers 8.8.8.8 8.8.4.4
Share:
9,202

Related videos on Youtube

esteemed.squire
Author by

esteemed.squire

Updated on September 18, 2022

Comments

  • esteemed.squire
    esteemed.squire over 1 year

    I've been following this post here on how to do this. I am using OS X and VirtualBox with an Ubuntu server.

    In the post they have the following: (I don't see those settings)

    auto eth0
     iface eth0 inet static
       address 10.253.0.50
       netmask 255.255.255.0
       network 10.253.0.0
       gateway 10.253.0.1
       dns-nameservers 8.8.8.8
    

    Where do I find network, gateway and dns-nameservers?

    When I do an ifconfig in Ubuntu, I only see the following relevant settings:

    eth0

    • inet addr
    • Bcast
    • Mask

    lo

    • inet addr
    • Mask
    • steeldriver
      steeldriver almost 9 years
      The appropriate network settings will depend whether you are setting it up in bridged mode with an IP address from the same LAN range as the host, or in the default NAT mode where you will be forwarding ports from the host to the private virtual network.
    • solsTiCe
      solsTiCe over 7 years
      You don't see them because you have to type them
  • esteemed.squire
    esteemed.squire almost 9 years
    I am using the following—address from the one provided by the virtual machine e.g., 192.168.1.32, netmask is provided when I do a ifconfig in Ubuntu server. network, gateway, dns-nameservers I do not see these listed in the ifconfig in Ubuntu nor on my host OS X when I do a ifconfig. Any idea where I can find these numbers? I am using bridged adapter for the virtual machine.
  • esteemed.squire
    esteemed.squire almost 9 years
    Thanks, I believe I have it figured out with the changes in the answer, seems to work and I'm able to ping other ips as well with these settings.