how to access Apache server running on host os using the name other than the ip address or localhost on vmware guest

1

my Apache server is running on Windows 7 that is my host OS for CentOs 6.4 running on vmware. In windows 7 i can access web pages (files on server) through 127.0.0.1, localhost, and alias created of the localhost in the Apache configuration but on CentOs which is my guest os i can access the host's server only through 192.168.136.1 (subnetIp of guest's NAT is 192.168.136.0), is there any way to access the server from the guest by using the alias created.

UDB

Posted 2013-08-07T14:46:52.720

Reputation: 113

Is DNS resolving works fine on your guest OS? – VL-80 – 2013-08-07T14:53:08.550

can't tell I am new to this stuff like protocols and vmware – UDB – 2013-08-07T15:59:21.617

OK. In your CentOS open terminal and execute 'cat /etc/resolv.conf'. After that execute 'nslookup alias_of_apache'. Post outputs of both commands here. – VL-80 – 2013-08-07T17:09:46.173

>Generated by NetworkManager

domain localdomain search localdomain nameserver 192.168.136.2 – UDB – 2013-08-07T17:22:50.737

;; connection timed out; trying next origin Server: 192.168.136.2 Address: 192.168.136.2#53

** server can't find alias_of_apache: NXDOMAIN – UDB – 2013-08-07T17:24:35.743

Did you substitute 'alias_of_apache' with your real alias which you are using to access it? If no - do so, and execute second command again. – VL-80 – 2013-08-07T17:41:17.873

Server: 192.168.136.2 Address: 192.168.136.2#53

Non-authoritative answer: Name: www.gamesaint.com Address: 208.73.211.167 – UDB – 2013-08-07T17:46:52.093

@Nikolay 208.73.211.167 is a domain on internet while mine(www.gamesaint.com) is just a local servername for Apache services i am using for my college project – UDB – 2013-08-07T18:10:50.153

Answers

1

If I understood you correctly than try to do following:

Execute this command in terminal as root (on CentOS):

echo '192.168.136.1 www.gamesaint.com' >> /etc/hosts

Try to access your web site using this host name. If that works - I will give explanation why it does.

OK. Apparently it works for you. So, what is happening - you are using real hostname from Internet for internal purposes. When you try to access it from CentOS your browser performs DNS lookup procedure.

  1. It asks DNS server - what is IP address of the hostname www.gamesaint.com?
  2. And it receives answer from DNS server: The IP address of www.gamesaint.com is 208.73.210.210
  3. Now your browser connects to IP address 208.73.210.210 which is different from your local web server address.

In order to handle that we just instructed your CentOS that if it needs to communicate with www.gamesaint.com than it should use address 192.168.136.1

I hope it gives you good explanation.

VL-80

Posted 2013-08-07T14:46:52.720

Reputation: 3 867

thanks that worked for CentOS, but there is still a problem when i tried to associate the ip address 192.168.136.1 to the alias name by editing host file in windows Xp running on virtual box, browser in xp failed to connect after timeout – UDB – 2013-08-07T19:48:13.603

all problems cleared just used name require as alias for default gateway on xp obtained by ipconfig command into the host file. thanks again – UDB – 2013-08-07T20:05:42.463