I am using Ubuntu on VirtualBox in Dell Laptop and wanted to know how I can configure the static IP in Ubuntu so that I can browse internet on Ubuntu and also use putty.

I am using data card for internet.

Currently in /etc/network/interfaces the settings is as follows:

iface eth0 inet dhcp
  • If host is connected to the internet, then why don't you just go into the VM settings and enable WIFI?
    – horIzoN
    Mar 6, 2013 at 16:44
  • Ubuntu desktop or server? Mar 6, 2013 at 16:48
  • Do you want to browse the internet and use putty, or do you specifically want to have a static IP address? Your question seems to suffer from the XY-problem.
    – zwets
    Mar 6, 2013 at 19:22

3 Answers 3


Find your actual network configuration by typing


You should see something similar to

eth0 Link encap Ethernet HWaddr 00:00:00:00:00:00
inet addr: Bcast Mask:

Edit the networking config file by typing

sudo nano /etc/network/interfaces

Inside it find the line

auto eth0
iface eth0 inet dhcp

and change it to

auto eth0
iface eth0 inet static

The actual change may need to be modified to something more specific for you. IE if you're routers IP is then your gateway and dns-nameservers would need to be configured accordingly. I set the address to because the odds of you getting enough connections to reach that IP and have any conflict from DHCP are slim to none. Let me know if this works for you. Good luck.

--Also. Your network adapter should be bridged.--


The easiest method is through network manager:

1- From the top of the screen select the network icon, next to the clock and volume, then click Edit Connections.

2- From the window that opens, go to Wired tab, select your connection (there should be only one connection, if you didn't touch anything). Then click Edit.

3- From the IPv4 Settings tab change Method from Automatic (DHCP) to Manual.

4- Under Addresses feild, click on Add.

5- Enter your desired IP address and subnet mask and click Save, you can also enter an optional DNS server here.

  • 1
    Though this will get the OP a static IP address on the guest, it is unlikely to fulfill his/her wish "to browse the internet and use putty". If OP has left the configuration of the VM Network Adapter at the default (NAT), it is more likely that s/he will have no internet connectivity at all.
    – zwets
    Mar 6, 2013 at 19:20
  • yes I see, let me fix that.
    – Soroosh129
    Mar 6, 2013 at 19:26
  • @zwets aha, you have an answer, so I'll wait to see your comment on me editing the post.
    – Soroosh129
    Mar 6, 2013 at 19:28
  • To have bidirectional communication between host OS, guest OSs and other machines in your LAN, I changed network adapter to "Bridged Adapter" for each guest OS using VM Virtual Box Manager. In more details: open Oracle VM Virtual Box Manager, select guest VM (OS) on the left side, click top menu item "Settings", click "Network" on the left side menu from the displayed screen, select tab "Adapter1", change value of field "Attached to:" to "Bridged Adapter" and finally click button "OK".
    – mvsagar
    Jan 10, 2017 at 3:05

If you want to connect your Ubuntu VM to the internet, there is no need to pick a static IP address. Assuming the host has an internet connection, and you have created a default (NAT) network adapter for your virtual machine, then just stick to DHCP in Ubuntu. It will get an IP address from the host and the host will do the NAT-ting to the internet.

If you insist on having a static IP address for the guest, then configure the virtual network adapter for bridged networking and allocate it to a network card on the host.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .