Page 1 of 1

Win Server 2008 R2: guest localhost points to host localhost

Posted: 18. Jun 2015, 18:22
by renardinho
Dear forum members,

I have this Win server 2008 R2 VM that was initially created using HyperV, which I had to convert into something virtualbox could handle, I don't really remember the format (probably vmdk), using Starwind V2V Converter.
At first glance it looked like Starwind didn't screwed everything up since I was able to start the VM, log in, and access internet through the host (NAT).
The VM server contains a website which I can access ( through localhost ) from inside the VM.

I don't need to access the internet from the VM so I've set up a Host-only network. The host (ubuntu 14.04 64) has the address 192.168.56.1 and I can access its localhost from the guest by requesting 192.168.56.1 through a Web browser.
However, I can't access the guest localhost from the host with 192.168.56.101. What I get instead is the host localhost.

I tried with a bridged-adapter and I ended up with the same issue.
I also tried to run the VM on another host (Win7), same issue again.

What am I doing wrong?
Thanks!

Re: Win Server 2008 R2: guest localhost points to host local

Posted: 20. Jun 2015, 15:51
by noteirak
Could you give the output of the following commands in the host please while the problem is happening

Code: Select all

sudo ifconfig -a
sudo ip addr
sudo route -n
sudo iptables -L -n -v
sudo iptables -t nat -L -n -v

Re: Win Server 2008 R2: guest localhost points to host local

Posted: 23. Jun 2015, 15:54
by renardinho
Hey noteirak, thank you for your help. Here is what you asked for:

sudo ifconfig -a

Code: Select all

eth0      Link encap:Ethernet  HWaddr 3c:a8:2a:de:1b:71  
          inet addr:194.57.88.233  Bcast:194.57.88.255  Mask:255.255.255.0
          inet6 addr: fe80::3ea8:2aff:fede:1b71/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:7073306 errors:0 dropped:0 overruns:0 frame:0
          TX packets:3298271 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:9993873037 (9.9 GB)  TX bytes:502336282 (502.3 MB)
          Interrupt:20 Memory:d0300000-d0320000 

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:65536  Metric:1
          RX packets:77093 errors:0 dropped:0 overruns:0 frame:0
          TX packets:77093 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:12667617 (12.6 MB)  TX bytes:12667617 (12.6 MB)

vboxnet0  Link encap:Ethernet  HWaddr 0a:00:27:00:00:00  
          inet addr:192.168.56.1  Bcast:192.168.56.255  Mask:255.255.255.0
          inet6 addr: fe80::800:27ff:fe00:0/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:670 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:0 (0.0 B)  TX bytes:64743 (64.7 KB)

wlan0     Link encap:Ethernet  HWaddr 80:00:0b:8c:82:be  
          inet addr:172.21.68.105  Bcast:172.21.71.255  Mask:255.255.248.0
          inet6 addr: fe80::8200:bff:fe8c:82be/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:468195 errors:0 dropped:0 overruns:0 frame:0
          TX packets:531443 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:105381336 (105.3 MB)  TX bytes:237844167 (237.8 MB)
sudo ip addr

Code: Select all

1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default 
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
    link/ether 3c:a8:2a:de:1b:71 brd ff:ff:ff:ff:ff:ff
    inet 194.57.88.233/24 brd 194.57.88.255 scope global eth0
       valid_lft forever preferred_lft forever
    inet6 fe80::3ea8:2aff:fede:1b71/64 scope link 
       valid_lft forever preferred_lft forever
3: wlan0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
    link/ether 80:00:0b:8c:82:be brd ff:ff:ff:ff:ff:ff
    inet 172.21.68.105/21 brd 172.21.71.255 scope global wlan0
       valid_lft forever preferred_lft forever
    inet6 fe80::8200:bff:fe8c:82be/64 scope link 
       valid_lft forever preferred_lft forever
4: vboxnet0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UNKNOWN group default qlen 1000
    link/ether 0a:00:27:00:00:00 brd ff:ff:ff:ff:ff:ff
    inet 192.168.56.1/24 brd 192.168.56.255 scope global vboxnet0
       valid_lft forever preferred_lft forever
    inet6 fe80::800:27ff:fe00:0/64 scope link 
       valid_lft forever preferred_lft forever
sudo route -n

Code: Select all

Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
0.0.0.0         194.57.88.254   0.0.0.0         UG    0      0        0 eth0
172.21.64.0     0.0.0.0         255.255.248.0   U     9      0        0 wlan0
192.168.56.0    0.0.0.0         255.255.255.0   U     0      0        0 vboxnet0
194.57.88.0     0.0.0.0         255.255.255.0   U     1      0        0 eth0
sudo iptables -L -n -v

Code: Select all

Chain INPUT (policy ACCEPT 0 packets, 0 bytes)
 pkts bytes target     prot opt in     out     source               destination         

Chain FORWARD (policy ACCEPT 0 packets, 0 bytes)
 pkts bytes target     prot opt in     out     source               destination         

Chain OUTPUT (policy ACCEPT 0 packets, 0 bytes)
 pkts bytes target     prot opt in     out     source               destination         
sudo iptables -t nat -L -n -v

Code: Select all

Chain PREROUTING (policy ACCEPT 0 packets, 0 bytes)
 pkts bytes target     prot opt in     out     source               destination         

Chain INPUT (policy ACCEPT 0 packets, 0 bytes)
 pkts bytes target     prot opt in     out     source               destination         

Chain OUTPUT (policy ACCEPT 0 packets, 0 bytes)
 pkts bytes target     prot opt in     out     source               destination         

Chain POSTROUTING (policy ACCEPT 0 packets, 0 bytes)
 pkts bytes target     prot opt in     out     source               destination 

Re: Win Server 2008 R2: guest localhost points to host local

Posted: 24. Jun 2015, 00:15
by noteirak
Nothing wrong at that level.
What address do you put exactly in the browser of the host when you get the issue?

Re: Win Server 2008 R2: guest localhost points to host local

Posted: 24. Jun 2015, 17:30
by renardinho
I got rid of the DHCP server from the Host-only network and assigned static IPs instead.
The host has the address 192.168.56.1, and when put in a Web browser (either on the host or the guest) I can access the host localhost.
The guest has the address 192.168.56.2, and when put in a Web browser on the guest, I can access the guest localhost. But if put in a browser on the host, then I am redirected to the host localhost.

Re: Win Server 2008 R2: guest localhost points to host local

Posted: 24. Jun 2015, 18:21
by Martin
What do you mean with "localhost" in your explanation?
localhost is just a hostname for the local IP address 127.0.0.1

Re: Win Server 2008 R2: guest localhost points to host local

Posted: 25. Jun 2015, 10:47
by renardinho
Yep, and that is exactly what I mean. When I put the IP address of the guest machine (http://192.168.56.2) on the host Web browser (which address is 192.168.56.1), the result is exactly the same as if I had requested http://127.0.0.1

Re: Win Server 2008 R2: guest localhost points to host local

Posted: 25. Jun 2015, 16:57
by noteirak
I still don't see anything wrong with your VM or VirtualBox. I would suspect some miss-configuration in your web server.

Re: Win Server 2008 R2: guest localhost points to host local

Posted: 25. Jun 2015, 17:44
by renardinho
You must be right. I tried with a different VM (windows 7 Pro) and with the same settings on both side I was able to access the guest localhost from the host.
Thank you for your help!