Wednesday, February 22, 2012

Rogers, Y U SO SLOW??

This is a post the is only very slightly related to anything I'm working on, but when I go to download things off my local machines to a remote machine in Chicago I am forced to upload a 1.2 KB/s or LESS!!!!!

I am paying for the Ultimate, read that again, Ultimate package. 50Mbps Downstream and some other 2Mbps Upstream. This is not torrents, it is yum package manager downloading remotely from my local filezilla server.

You're all liars and if it weren't for the extra hundreds of dollars that I'd rather not spend going to another company, I would do just that.

Monday, February 20, 2012

Installing Guest additions in VirtualBox; Windows 7 host.

In order to share folders, clipboard and other things you must install the Virtualbox Guest Additions. The iso file that you need to mount in your CentOS guest is located in the VirtualBox installation directory and is named VBoxGuestAdditions.iso.

EDIT: I just realized that the option to mount the guest additions iso file is right in the menu! From the guest window, click on Devices > CD/DVD Devices > Install Guest Additions
If you don't see it there, you are probably using an older version of Virtualbox and should follow the directions below.

From the guest window, click on Devices > CD/DVD Devices > Choose a virtual CD/DVD disc file...
You might see the file name in the list already, but if not, you need to navigate to the installation directory of Virtualbox itself (C:\Program Files\Oracle\Virtualbox by default) and select the iso file.




Before you jump into installing the Virtualbox Guest Additions, you should prepare your system as suggested by the Virtualbox documentation. To do this, run the following command:

# yum -y update && yum -y install gcc make kernel-devel
# reboot


Now from the command line in the CentOS guest mount the image as a virtual device:
# mount -t iso9660 /dev/cdrom /mnt

After this, run the set up:
# cd /mnt
# sh ./VBoxLinuxAdditions.run

Now you are supposed to install a package named dkms, but this is not available by default in the CentOS yum repo. Whenever you run updates on the kernel in your CentOS guest, you will need to run this command:

/etc/init.d/vboxadd setup

"Network is unreachable" CentOS 6.2 as guest in VirtualBox.

Since this is the first post here I will explain that I have started working on a project and am going to use this blog to document progress and post various problems I run into with the solutions that worked for me.

The project I am working on involves using multiple distributions of Linux, and since I don't want to multi-boot I am using VirtualBox to develop specific things for each distro. I am running Windows 7 Ultimate 64 bit on the host machine.

After I had installed CentOS 6.2 in a virtual machine I ran into trouble with connecting to the internet. I tried using NAT, bridged, and host-only options in the network settings for the VM and still no such luck. After some googling and banging my head on my keyboard trying to find a solution I had come up with nothing that had worked. I eventually came across a post in the Debian forums that gave a couple of commands that I punched into the shell, more specifically the route command.

The output of the route command was as follows:


Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
192.168.0.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
169.254.0.0 0.0.0.0 255.255.0.0 U 1003 0 0 eth0


... or something to that extent.
The issue was that I was behind a router and it wasn't reaching external networks. I was able to ping other VMs and my host machine and from both the guest and the host, but not able to ping google.ca. I would get a message telling me "network is unreachable".

The problem was solved when I changed the configuration a little bit in /etc/sysconfig/network-scripts/ifcfg-eth0. I appended the following lines to the file. I might also note here that when you configure your ifcfg file to work behind a router, the IP that you choose to use (I use a static internal IP for consistency, and it might be wise if you will be using them as virtual hosts) needs to be in the same network as your router. My router gateway is at 192.168.0.1 and this VM is using the static IP 192.168.0.19.

The entire file in it's working state is:


TYPE=Ethernet
DEVICE=eth0
BOOTPROTO=
NM_CONTROLLED=yes
NETMASK=255.255.255.0
USERCTL=yes
ONBOOT=yes
MACADDR=00:00:00:00:00:00
IPADDR=192.168.0.19
PEERDNS=yes
GATEWAY=192.168.0.1
NETWORK=192.168.0.0


After editing the fie and running /etc/init.d/network restart I was able to ping google and update/install things through yum.

That's what worked for me, if you've run into the same problem and were able to solve it in a different way please do let me know how you were able to solve it.

EDIT:
Upon setting up yet another VM and running into this same problem using Bridged Networking in Virtualbox, I was able to ping local machines, but not external machines on the internet or domain names.
To fix this issue and be able to resolve domains, I added this line to /etc/resolv.conf:

nameserver 8.8.8.8

After this I was able to resolve domains. There's probably another fix for that to do with the settings I configured previously, perhaps not. That's what worked for me and for those of you who don't know, 8.8.8.8 is one of the IPs for google's public DNS servers.