My host is windows 7 and my guest (virtual machine) is ubuntu. I cannot connect to internet when I am on virtual environment. I am using Oracle VirtualBox. Any idea? Thanks.
There are several modes in which you can connect to internet inside from a virtual machine. Easiest is using NAT.
Select your Ubuntu virtual machine in virtual box manager and go to settings. Navigate to Network and select NAT as shown in the screenshot.
When you open Ubuntu go to Network Connection and go to Wired tab and select your connection and Edit. Use Automatic (DHCP) under IPv4 Settings. Also you can check the connect automatically. Then your system will be connected to network every time you open it.
This same problem was solved for me by changing a previously selected setting. When I originally set up VB I configured it to use a wireless connection. But then wireless for me became unavailable because of my situation, but I had forgotten that I needed to change the setting in VB to use a wired connection instead.
I don't know if this reflects your situation, but here are the steps for changing connection type:
Open VB, go to Settings, Network, Adapter 1, "Name", choose connection type.