I have the below dev. environment.
- Hardware:- Windows 7, 32bit, HP Laptop.
- Software:- CentOs 6.5 running on VirtualBox 4.3.10.
In a nutshell The problem is that I can't access the internet and localhost at the same time in my VirtualBox. Example:
HOST ONLY ADAPTER
If I have my VirtualBox adapter set to Host Only.
ifconfig eth0 shows me the below configuration:
#ifconfig eth0 Link encap:Ethernet HWaddr 08:00:27:81:0F:EA inet addr:192.168.57.162 Bcast:192.168.56.255 Mask:255.255.255.0 inet6 addr: fe80::a00:27ff:fe81:fea/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:342 errors:0 dropped:0 overruns:0 frame:0 TX packets:362 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:37176 (36.3 KiB) TX bytes:66580 (65.0 KiB)
cat /etc/resolv.conf shows the below:
#cat /etc/resolv.conf [root@localhost dd.com]# cat /etc/resolv.conf ; generated by /sbin/dhclient-script nameserver 22.214.171.124 nameserver 194.290.66.07
Now, with those above settings. If I check
http://192.168.57.162 I can see all is working. Nginx, Php ... all is fine. The problem here is that, if I wanted to install a package with
yum install ... or
yum update or even
ping google.co.uk gives me error. Example:
[root@localhost myProject]# ping google.co.uk ping: unknown host google.co.uk
So, I tried to switch to NAT Adapter.
Now, with NAT. I if I do
ifconfig eth0 I see the below config:
#ifconfig Link encap:Ethernet HWaddr 08:00:27:81:0F:EA inet addr:10.0.2.15 Bcast:10.0.2.255 Mask:255.255.255.0 inet6 addr:fe80::a00:27ff:fe81:fea/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX pacakets:434 errors:0 dropped:0 overruns:0 frame:0 TX Packets:445 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:47366 (46.2 KiB TX bytes:76674 (74.8Kib)
Now, you would assume if I typed
localhost or even
http://10.0.2.15 I would be able to see my server running or my web pages. But, No! Nothing shows up. I get an error message, as if I was trying to access a page that did not exist. I've even adjusted my hosts file. But nothing. I can't even access CentOs using putty. But, weird enough I can install packages, ping server and all..
So, I tried to use two adapters, but sadly whichever is set Adpater 1 only seems to work, as if the Adapter 2 is being ignored. So, overall with these settings, I can either only install packages but not see my server, or vise versa.
I am looking for alternative that will allow me to see my localhost and install pacakges at the same time using only one adapter.
According to metacom's answer I added a port into the NAT adapter as below.