A friend of mine asked me to help him in his homework. The situation needed a virtual local area network to emulate the connections between two servers and a client operating system.
So I have started to configure the environment, you can see the details here:
- Hardware: Core i5; 4 GB RAM; wired LAN
- Operating system: Fedora 19 (3.11.7-200.fc19.x86_64)
- Virtualization software: VirtualBox 4.3.2 r90405
- Number of virtual machines: 2
- Virtual machine OS #1: CentOS 6.4 (2.6.32-358.el6.x86_64)
- Virtual machine OS #2: Ubuntu 12.04.3 LTS (x86_64)
- Virtual machine HW: 1 CPU (90%); 512 MB RAM; 8 MB vRAM; 4 GB VDI
- Virtual machine vLAN: Bridged networking (not NAT!)
Setting up two virtual servers in VirtualBox
The task was to set up two virtual servers with the possibility of pinging each other. This requires bridged networking. The NAT – by its structure – doesn’t allow pinging.
CentOS 6.4 virtual machine was supposed to have the role of apache, mail, vsftpd, openssh. I installed it using the CentOS-6.4-x86_64-minimal.iso file, but I had a problem. There was no internet connection in the Centos 6.4 virtual machine and the IP address was 127.0.0.1
I figured I would need to install VBox Additions, but it was impossible because it required devel-kernel to be installed. This module couldn’t be installed because there was no internet but to have internet I would needed VBox Additions … Is it lol?
As a workaround I tried to set the networking to NAT in VirtualBox virtual machine options but it didn’t solve the problem.
No internet connection in VirtualBox?
I reinstalled the guest operating system and I tried the CentOS 6.4 LiveCD. Then I had the following problem: I clicked on the Installation icon on the desktop but nothing happened.
So I decided to delete CentOS and installed Ubuntu 12.04.3 LTS. Same guest machine, only different operating system. After the first boot it was working just fine!
I decided to use Ubuntu 12.04.3 LTS on both virtual machines because in my case CentOS was not mandatory. I wanted to use both operating systems because it would have been fun but unfortunately CentOS 6.4 does not receive IP address in VirtualBox 4.3.2.
The reason is unknown to me. Have you ever met this problem? Do you know any solution? If yes, please share here.
Update: c0nsaw provided the solution for this problem.
The CentOS minimal does not enable networking by default. To enable the networking automatically after reboot you have to do the following:
- become root: su –
- open file to edit: vi /etc/sysconfig/network-scripts/ifcfg-eth0
- in the script file set: ONBOOT to be ‘yes’
- save&exit the file: :wq
- type the following to start networking: service network start