Assisting 13089943 developers since 2005.

Web Developer, Open Source, Loyal, Dad.  

Read More »

How to Configure VirtualBox with a Static IP in Linux

Posted by David  •  Feb 18th, 2015 7:17:42 pm - Subscribe | Mood: good | Music: Study Music - Music To Make You Smarter

In this entry I will go over how to easily configure VirtualBox and assign your linux machine a static ip.

I am using GNU/Linux CentOs 6.5 as my disto. you may be using something like Ubuntu and if so then that is ok. The main focus here is how to allow VirtualBox to communicate through your network interface card. Once that is completed you can configure your linux machine via it's GUI or the CLI.

Let's get started!
1. Open VirtualBox - I am going to assume that you have your distro already installed on VirtualBox.
2. Click on Network or right click on your distro and go to settings and choose Network.
3. Under Adapter 1 - Checkmark to enable adapter
4. Attached to: Choose Bridge Adapter
5. Name: Choose how you are connected to the internet, you will see a list of adapter names. If you are connected via ethernet (cable) chose that one, or if you are connected to the internet via wifi choose that one. (I am connected via en0: Wi-Fi (Air Port)
6. Now click on the down arrow
7. Adapter type: Choose MT Desktop
8. Promiscuous mode: Choose Allow VM's
9. Click Ok
10. Start your VM

Now you will need to configure your network setting on your Linux VM. I won't go into detail, but my commands are like this.

$ vim /etc/sysconfig/network-scripts/ifconfig-eth0

DEVICE=eth0
BOOTPROTO=static
IPADDR=192.168.1.88
NETMASK=255.255.255.0
GATEWAY=192.168.1.1
ONBOOT=yes
DNS1=8.8.8.8
DNS2=8.8.4.4

Be sure to also check your DNS at /etc/resolv.conf

$ vim /etc/resolv.conf

DNS1=8.8.8.8
DNS2=8.8.4.4

That's pretty much it. If you need info on how to assign a static IP in a Debian based system such as Ubuntu follow this documentation and search for Static IP Address Assignment.

Comments 0  •  Feb 18th, 2015 7:17:42 pm - Subscribe  •  Tweet this entry | Post a comment



Responses

Leave a Reply


ReCaptcha:

Posting as anonymous Anonymous guest, why not register, or login now.

Image Gallery

Badges

Amazon Wishlist Stumble Upon Toolbar
Internet Blogs - Blog Top Sites Internet Blogs - Blog Top Sites Technology

About Me

avatar

@davidpolanco
iPhone: 29.513522,-98.565523 Web Designer, Open Source, Loyal, Dad. Learn more...