Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


Is there a way to access web server (or SSH access) into VirtualBox Guest using public IPs?
New on LowEndTalk? Please Register and read our Community Rules.

All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.

Is there a way to access web server (or SSH access) into VirtualBox Guest using public IPs?

JRTechJRTech Member
edited August 2016 in Help

I've bought a Dedicated Server. Here is the details:

Main IP: 173.208.244.aaa

Subnet Mask 255.255.255.248

Gateway 173.208.244.zzz

Usable IP: 173.208.244.aaa - 173.208.244.eee

I've installed Debian 8 on this Dedicated Server then installed VirtualBox.

I need to create 5 VPS in this VirtualBox. It would be Ubuntu 16.04, Windows Server 2008, CentOS 7, etc... This VPS will be used to host different websites.

I then installed Ubuntu 16.04 as guest and assign IP 173.208.244.bbb . But I still cannot access this guest web server or access SSH into Guest from my laptop.

This is my Debian 8 (host) network interface

auto eth1
allow-hotplug eth1
iface eth1 inet static
    address 173.208.244.aaa
    netmask 255.255.255.248
    network 173.208.244.yyy
    broadcast 173.208.244.kkk
    gateway 173.208.244.zzz
    # dns-* options are implemented by the resolvconf package, if installed
    dns-nameservers 127.0.0.1
    dns-search <host_of_my_provider>

auto vmbr0
iface vmbr0 inet static
    address 173.208.244.aaa
    netmask 255.255.255.248
    bridge_ports none
    bridge_stp off
    bridge_fd 0
    up route add -host 173.208.244.bbb dev vmbr0
    up route add -host 173.208.244.ccc dev vmbr0
    up route add -host 173.208.244.ddd dev vmbr0
    up route add -host 173.208.244.eee dev vmbr0

These are my VirtualBox Settings

http://i.imgur.com/4iPDV2v.png

http://i.imgur.com/JPsZMMe.png

This is Network Interface of Guest OS (Ubuntu 16.04)

http://i.imgur.com/UqCgWDy.png

I also installed Nginx in it. The Guest can open the default Nginx webpage easily.

http://i.imgur.com/UL3hyYe.png

But when I access from Host or from my home computer, It says:

curl: (7) Failed to connect to 173.208.244.bbb port 80: No route to host

What am I supposed to do now? Which one should be corrected?

Comments

  • BayuBayu Member
    edited August 2016

    -- edited --

  • dfroedfroe Member, Host Rep

    You cannot have the same IP configured on two different interfaces (eth1 and vmbr0). Or at least the effect won't be what you most likely expect.

    Probably the easiest setup would be a simple bridge, bridging all VMs and your physical ethernet nic together. Your host's IP would then be assigned to that bridge, leaving eth0 unconfigured.

    If you need to deal with two seperate interfaces, you could try doing some proxy arp between those interfaces. Use with care and only if you know what your are doing to avoid bad thing(tm) to happen. The root cause why this setup doesn't work is that your upstream router will broadcast an ARP request for your IPs because they are within its subnet but your VMs won't be able to reply because they are on a different L2/L3 network.

    Did I say bad things can happen with proxy arp? One example: StrongSwan's Unity plugin which is enabled by default will automatically proxy arp the IPs of your remote SA if your local SA is 0.0.0.0/0. In case you are using virtual tunnel interfaces which is a great thing together with 0.0.0.0/0 SAs, that's going to be funny. :)

  • You can use (nat) in virtualbox

  • How about using nat for the vm and then set the ip for each vm?

    I've tried this in the past, and working

  • Choose 'bridge' instead 'NAT' but need public IP for guest.

  • JRTechJRTech Member
    edited August 2016

    @Jorbox & @ErawanArifNugroho

    As far as I know, NAT will use the same IP with Host. What I need is to give Guest its own public IP so it can be accessed from anywhere. Or when Guest runs curl icanhazip.com it should result: 173.208.244.bbb (not 173.208.244.aaa)

    @dfroe

    I've changed it to this now on my Host (DS):

    auto lo
    iface lo inet loopback
    
    iface eth1 inet manual
    
    auto vmbr0
    iface vmbr0 inet static
        address 173.208.244.aaa
        netmask 255.255.255.248
        network 173.208.244.yyy
        broadcast 173.208.244.kkk
        gateway 173.208.244.zzz
        # dns-* options are implemented by the resolvconf package, if installed
        dns-nameservers 127.0.0.1
        dns-search <host_of_my_provider>
        bridge_ports eth1
        bridge_stp off
        bridge_fd 0
    

    Is this correct?

    @mustafaramadhan

    Should I use 2 adaptors both (NAT & Bridge), or only 1 adaptor (Bridge only)?

  • Bridge only.

  • mtoledocemtoledoce Member
    edited August 2016

    NAT and 2 adaptors is for port forward with 1 public IP ..is not your case. You need All bridges. use console in VirtualBox to config your net adapters with 1 static IP on each guests ..and after connect via ssh or whatever. But you may need install proxmox or esxi instead debian alone.

Sign In or Register to comment.