LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices



Reply
 
Search this Thread
Old 02-04-2013, 10:17 PM   #1
zousheng
LQ Newbie
 
Registered: Feb 2013
Location: China
Posts: 29

Rep: Reputation: Disabled
linux(in VirtualBox) apache http://localhost working, but 127.0.0.1 not working


I installed httpd in the virtual box which used bridge network connect method, and my computer(win7) can ping the linux ip, http://localhost works fine in linux, but http://127.0.0.1 not working, and the http://ip not working either, also checked the /etc/hosts don't know why, could anyone help? thanks very much.
 
Old 02-05-2013, 12:02 AM   #2
grail
Guru
 
Registered: Sep 2009
Location: Perth
Distribution: Manjaro
Posts: 7,693

Rep: Reputation: 1988Reputation: 1988Reputation: 1988Reputation: 1988Reputation: 1988Reputation: 1988Reputation: 1988Reputation: 1988Reputation: 1988Reputation: 1988Reputation: 1988
Well I guess the obvious question would be, when you ping localhost, does it return 127.0.0.1? On some distros it could well be 127.0.1.1
 
Old 02-05-2013, 01:12 AM   #3
zousheng
LQ Newbie
 
Registered: Feb 2013
Location: China
Posts: 29

Original Poster
Rep: Reputation: Disabled
Hi, when i ping localhost, it returns 127.0.0.1, nothing special. Any idea? thanks
 
Old 02-05-2013, 02:04 AM   #4
grail
Guru
 
Registered: Sep 2009
Location: Perth
Distribution: Manjaro
Posts: 7,693

Rep: Reputation: 1988Reputation: 1988Reputation: 1988Reputation: 1988Reputation: 1988Reputation: 1988Reputation: 1988Reputation: 1988Reputation: 1988Reputation: 1988Reputation: 1988
Have set up port forwarding in the virtualbox as the 127.0.0.1 you are receiving is from the windows machine?
 
Old 02-05-2013, 02:21 AM   #5
zousheng
LQ Newbie
 
Registered: Feb 2013
Location: China
Posts: 29

Original Poster
Rep: Reputation: Disabled
Hi, I didn't set the port forwarding in the virtualbox, i tested in the linux, cause in linux it still failed, after it succeeded in linux, i will try in windows. should I do any change about the port forwarding? thanks
 
Old 02-05-2013, 10:35 AM   #6
grail
Guru
 
Registered: Sep 2009
Location: Perth
Distribution: Manjaro
Posts: 7,693

Rep: Reputation: 1988Reputation: 1988Reputation: 1988Reputation: 1988Reputation: 1988Reputation: 1988Reputation: 1988Reputation: 1988Reputation: 1988Reputation: 1988Reputation: 1988
Sorry ... missed that bit. So just to confirm the ping you have done was inside linux or windows? Also, which distribution are you using?
 
Old 02-06-2013, 12:28 AM   #7
zousheng
LQ Newbie
 
Registered: Feb 2013
Location: China
Posts: 29

Original Poster
Rep: Reputation: Disabled
Inside the linux, and i am using RHEL5. Thanks for your time.
 
Old 02-06-2013, 07:05 AM   #8
Habitual
Senior Member
 
Registered: Jan 2011
Distribution: Undecided
Posts: 3,622
Blog Entries: 1

Rep: Reputation: Disabled
Quote:
Originally Posted by zousheng View Post
Inside the linux, ...
Terminal >
Code:
ifconfig
 
Old 02-06-2013, 07:16 AM   #9
zousheng
LQ Newbie
 
Registered: Feb 2013
Location: China
Posts: 29

Original Poster
Rep: Reputation: Disabled
I will paste the output of command ifconfig here tomorrow, thx for your attention
 
Old 02-06-2013, 06:56 PM   #10
zousheng
LQ Newbie
 
Registered: Feb 2013
Location: China
Posts: 29

Original Poster
Rep: Reputation: Disabled
eth0 Link encap:Ethernet HWaddr 08:00:27:00:AF:A4
inet addr:10.0.2.15 Bcast:10.0.2.255 Mask:255.255.255.0
inet6 addr: fe80::a00:27ff:fe00:afa4/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:85 errors:0 dropped:0 overruns:0 frame:0
TX packets:137 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:21667 (21.1 KiB) TX bytes:14757 (14.4 KiB)

lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:1243 errors:0 dropped:0 overruns:0 frame:0
TX packets:1243 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:4001264 (3.8 MiB) TX bytes:4001264 (3.8 MiB)
Here is the output. Any idea?
 
Old 02-07-2013, 10:24 AM   #11
grail
Guru
 
Registered: Sep 2009
Location: Perth
Distribution: Manjaro
Posts: 7,693

Rep: Reputation: 1988Reputation: 1988Reputation: 1988Reputation: 1988Reputation: 1988Reputation: 1988Reputation: 1988Reputation: 1988Reputation: 1988Reputation: 1988Reputation: 1988
How about the output of your /etc/hosts file

When displaying out please place the data in [code][/code] tags
 
Old 02-09-2013, 08:45 AM   #12
smbhandary
LQ Newbie
 
Registered: Jan 2013
Distribution: RHEL and AIX ( sort of )
Posts: 18

Rep: Reputation: Disabled
On the basis of my understanding of the problem statement...


Terms / Context
-----------------
host = system on which Virtual box is installed.
guest = system installed on Virtual Box.
httpd port = port httpd is configured to listen on on the guest.


I have not been able to configure two port forwarding rules to the same ip on VirtualBox using Internal Networking devices.

So I have multiple ips , a DHCP provided ip for ssh and separate static ips ( Internal Networking ) for every thing else.


my checklist :
---------------


Actions in sequence ie if action 1 dont work / not done , fix it before going on the next action:
----------------------------------------------------------------------------------------------------

1. Configure port forwarding on Virtual Box on the network device httpd is listening on
-----------------------------------------------------------------------------------------
rule name : guest_http
Protocol : TCP
source ip : 127.0.0.1
source port : 8888 < or whatever you want it to be>
destination ip : leave blank.
destination port : whatever port httpd is running on on the guest.

2. start the apache instance on the guest.

3 netstat -an | grep -i list | grep 80 < or which ever port httpd is configured to listen on>
Should show up a line. Else ensure the service is up and listening

4. on the host :
start up a browser and enter http://127.0.0.1:8888 OR enter http://localhost:8888

Last edited by smbhandary; 02-09-2013 at 08:46 AM. Reason: add a line
 
Old 02-09-2013, 07:21 PM   #13
zousheng
LQ Newbie
 
Registered: Feb 2013
Location: China
Posts: 29

Original Poster
Rep: Reputation: Disabled
Thanks for all your help, it's really a pity that, the vm which had this issue crashed yesterday, can't be recovered. Now i try it in centos 5.7, it's working fine, and i changed the VM network from NAT to bridge, i can access the http://<ip-DHCP allocated> in my laptop host, and in my centos vm, it's also working. It should be the rhel configuration is messed. Thanks again for all your help.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
apache: http://localhost (work) http://ipaddress (not working) sarmad Linux - Newbie 7 02-05-2013 08:47 AM
nagios not working (http://localhost/nagios or http://ip/nagios) 404 error connect2janu Linux - Server 1 11-18-2012 03:06 AM
http://localhost/ has stopped working oshirowanen Linux - Server 2 04-02-2010 03:47 PM
localhost not working but 127.0.0.1 does xeross Linux - Networking 4 10-13-2008 04:30 PM
[SOLVED] Printing Help !! (http://localhost:631/) (WTF did it stop working?) MBA Whore Linux - Hardware 31 08-28-2006 02:35 AM


All times are GMT -5. The time now is 08:34 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration