-1

Does host's hosts file influence routing of requests from inside virtual box VM? I.e. if I will add something to host's hosts file will the request be routed properly from the virtual box.

I guess that, if I am running image networking in NAT mode, it should work. How exactly does the hosts file resolution work? How is the hosts file DNS resolution hooked to the network interface?

Zveratko
  • 2,663
  • 6
  • 35
  • 64

1 Answers1

1

If you're running Nat in VirtualBox you'll need to port forward to the guest internal ip. Usually, for Nat but not always, your virtual system guest will be on 10.0.2.15. You can check this with ipconfig and modify accordingly. On the Virtualbox main interface goto File/Preferences and select Network. Add a new Network (Network card icon with plus), by default called NatNetwork. Make sure the checkbox is on. Click on edit (the screwdriver icon) and select Port Forwarding. Fill in the six boxes on the Port Forwarding Rules dialog. For example, let us assume you have installed Webmin on a Virtual Server, with ssl.

I would suggest for Webmin:

Name: Webmin, Protocol: TCP, Host IP: 127.0.0.1, Host Port: 2525, Guest IP: 10.0.2.15, Guest Port: 10000.

Finally, click OK on all dialogs back to the main interface. Back at Virtualbox main interface goto Network and change the Attached to: from Nat to NatNetwork and click OK.

Goto your browser and put https://localhost:2525 and the Webmin login dialog will come up.

For SSH access from a host terminal, assuming you have installed OpenSSH server, it would be similar.

Name: ssh, Protocol: TCP, Host IP: 127.0.0.1, Host Port: 2222, Guest IP: 10.0.2.15, Guest Port: 22.

At the host terminal prompt: sudo shh -p 2222 YourAdminGuestName@127.0.0.1

The Host Port numbers can be any port not used. The ones I've used in the above examples I've chosen at random and work on my machine. Guest Port numbers are real allocated port numbers.

Geoff
  • 26
  • 1