Question about IP Address on VirtualBox for a home server

34,349

* VBox means VirtualBox, when used in this answer

10.0.2.15 is an address that falls in the 10.0.0.0 - 10.255.255.255 range, which is a "private network address" range, per RFC 1918 (page 4, section 3 states "private access space" for LANs and Intranets and such). Like network addresses starting with 192.168.*.*, those typically are internal network addresses for the given local network, in this case the 'network' used by VirtualBox on the system. VirtualBox tends to use local addressing within your system for it's virtual machines, so on the host machine you'd have to forward incoming traffic to the internal 10.0.2.15 address.

I'm going to guess that your system/server has one IP address from the router on your home network. You can use that IP address as the destination for the website, however, you cannot get an address more "public" than the 10.0.0.0 - 10.255.255.255 range, as it is a "private network" within your system (because VirtualBox is weird that way).

If you have a home system that is the host of the VBox VM behind a router that has an IP address of 192.168.1.194 (for example), and you have your VM on your system with an IP address of 10.0.2.15, the way to get data from the internet to the VM is two stepped, really:

(1) The router will need to route port 80 to 192.168.1.194 (or whatever the actual IP for your host system is, that is to say, the system running the VirtualBox VM.)

(2) Your system will need a specific iptables (or similar firewall) rule to forward port 80 or related ports from the host system to 10.0.2.15 (the VBox VM).

Share:
34,349

Related videos on Youtube

Nathan
Author by

Nathan

Updated on September 18, 2022

Comments

  • Nathan
    Nathan over 1 year

    I have set up a LAMP server within a VirtualBox partition using the Ubuntu automatic install. This is the first time I have tried to set up a home server. The installation seems to have been successful and now I am trying to understand my Internet connection.

    If I ping google, I get 64 bytes from 67.215.66.132...(in fact, I get this over and over until I stop it). That seems promising.

    However, when I run ifconfig, it returns inet addr: 10.0.2.15. I'm not sure what kind of address this is. Maybe a local network address? It is not an address, I can access from a browser so I am not sure if my server is accessible from the outside.

    The server is connected via ethernet to a Uverse router.

    Ultimately, I want to try to host a single website on this server but I am wondering if I have to make more adjustments to my IP address before proceeding.

    Any feedback on the above would be appreciated.

    Thanks

    • Jan Geep
      Jan Geep over 10 years
      In virtualbox what type of network adapter did you set the guest up with and what IP address does the host OS have?
  • Nathan
    Nathan over 10 years
    Okay, thanks, this helps. When you say "You can use that IP address as the destination for the website" do you mean 192.168.1.194? I will need to do some research on routing to port 80 and VBox VM. I appreciate your help. I am getting closer.
  • Thomas Ward
    Thomas Ward over 10 years
    No, your external IP address. I'm assuming you're on a home network. If you're on a home network go to whatismyip.com to get your external, internet-facing IP address. Then you can use that address from elsewhere to get to your "server" after you've got redirecting within your network happening (i.e. router -> host computer; host computer -> VM)
  • Salt
    Salt over 10 years
    The 10.0.*.* address you mention is a typical VirtualBox private address. That's the IP address of the VM on the host machine. It's not visible outside the host. To set up port forwarding Thomas mentions, use VBox tools VBoxManage, or the Settings dialog in the VBox GUI.
  • Thomas Ward
    Thomas Ward over 10 years
    @Salt i believe i said that specifically, in the code, that the 10.0.*.* was on the host machine and nowhere else. But port forwarding he needs to do is internal on the host machine, not necessarily within VBox tools. Depending on how vbox assigned the network address, that is. And to have it visible from outside VBox or the local computer, he'll have to do port forwarding for his home network to the host machine, then another forward from the host machine to the VM.
  • Salt
    Salt over 10 years
    @Thomas So you did say, curse me for skimming. Still, while VBoxManage and friends are hardly a complete answer, they deserve mention, and the VBox NAT documentation I linked should prove helpful. It did in my case, last time I wanted to make a VBox VM reachable outside its host.
  • Thomas Ward
    Thomas Ward over 10 years
    @Salt I'm on a phone, if you want you can edit the data into my answer as a proposed edit, and I'll take a look later.