Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I am running two VM instances of RHEL/CentOS on my VirtualBox instance running on host Windows 7. The problem is when I am executing VBoxManage list vms -l | more and then sunsequently VBoxManage guestproperty get <uuid> "/VirtualBox/GuestInfo/Net/0/V4/IP", I can see the same IP for both the VMs. I have set the internal networking intnet for both the VMs using Networks --> Adapter 2 --> PCnet-FAST III (Internal Network, 'intnet') and my understanding was that eth0 may have been the private network interface for the VMs. But both their IP is showing as 10.0.2.15. Is there a way I can access distinct IPs in the private VM network for the two VMs?

NOTE: I can also access only a single VM instance when accessing through Putty SSH client. And it is connecting to the proxy 127.0.0.1:2222 always. Thus I am not being able to distinguish between the VMs. I need separate instance accesses to run server and client codes on separate instances in a client-server architecture. See my other thread How to configure putty to ssh to multiple vm using same host which explains the problem in detail.

enter image description here

I am attaching the VBoxManage command line outputs as executed on the host. I am running 1.3_2 and 1.3_3 sandboxes but both have same IP as shown below in bold:

C:\Program Files\Oracle\VirtualBox>VBoxManage list vms
"Hortonworks Sandbox 1.3" {4914b5c7-1395-47f5-80ef-8fbec8cadbd4}
"Hortonworks Sandbox 1.3_1" {f103f5d2-f949-4d67-a81e-c63ddc5335dc}
"Hortonworks Sandbox 1.3_2" {fc2b9f50-bf4a-4a5d-8189-22d62c7e1d67}
"Hortonworks Sandbox 1.3_3" {5976fff1-7a0d-4eca-bedf-7756f7076dbd}
C:\Program Files\Oracle\VirtualBox>VBoxManage guestproperty get fc2b9f50-bf4a-4a
5d-8189-22d62c7e1d67 "/VirtualBox/GuestInfo/Net/0/V4/IP"
**Value: 10.0.2.15**

C:\Program Files\Oracle\VirtualBox>VBoxManage guestproperty get 5976fff1-7a0d-4e
ca-bedf-7756f7076dbd "/VirtualBox/GuestInfo/Net/0/V4/IP"
**Value: 10.0.2.15**

On the VM sandbox 1.3_2, I ran the below command to get the local IP for eth0 as below:

[hue@sandbox ~]$ arp -an
? (10.0.2.2) at 52:54:00:12:35:02 [ether] on eth0
[hue@sandbox ~]$ route
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
10.0.2.0 * 255.255.255.0 U 0 0 0 eth0
link-local * 255.255.0.0 U 1002 0 0 eth0
default 10.0.2.2 0.0.0.0 UG 0 0 0 eth0

Any ideas how can I find the distinct IPs for the different sandboxes?

I see a similar thread how-to-do-networking-between-virtual-machines-in-virtualbox? where it is being said to use the dhcpserver for IP resolution of the guest VMs. But it asks for --ip NOTE: I tried to run the VBoxManage dhcpserver but it asks for --ip option and --netmask which I have provided as below with the following output:

C:\Program Files\Oracle\VirtualBox>VBoxManage dhcpserver add --netname intnet --
netmask 10.0.2.*
Oracle VM VirtualBox Command Line Management Interface Version 4.3.0
(C) 2005-2013 Oracle Corporation
All rights reserved.

Usage:

VBoxManage dhcpserver       add|modify --netname <network_name> |
                                       --ifname <hostonly_if_name>
                            [--ip <ip_address>
                            --netmask <network_mask>
                            --lowerip <lower_ip>
                            --upperip <upper_ip>]
                            [--enable | --disable]

VBoxManage dhcpserver       remove --netname <network_name> |
                                   --ifname <hostonly_if_name>


Syntax error: You need to specify --ip option 

While trying to enable the dhcpserver, it already exists:

C:\Program Files\Oracle\VirtualBox>VBoxManage dhcpserver add --netname intnet --
ip 10.0.2.15 --netmask 255.255.255.0 --lowerip 10.0.2.101 --upperip 10.0.2.254 -
-enable
VBoxManage.exe: error: DHCP server already exists

The output for route -n and sudo ss -lntp are as follows: (as requested by MariusMatiae)

[hue@sandbox ~]$ route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
10.0.2.0        0.0.0.0         255.255.255.0   U     0      0        0 eth0
192.168.56.0    0.0.0.0         255.255.255.0   U     0      0        0 eth1
169.254.0.0     0.0.0.0         255.255.0.0     U     1002   0        0 eth0
0.0.0.0         10.0.2.2        0.0.0.0         UG    0      0        0 eth0
[hue@sandbox ~]$ sudo ss -lntp
State      Recv-Q Send-Q        Local Address:Port          Peer Address:Port
LISTEN     0      10                        *:8651                     *:*                                                                                              users:(("gmetad",1046,0))
LISTEN     0      128                       *:50060                    *:*                                                                                              users:(("java",2797,86))
LISTEN     0      10                        *:8652                     *:*                                                                                              users:(("gmetad",1046,1))
LISTEN     0      128               10.0.2.15:50030                    *:*                                                                                              users:(("java",2834,84))
LISTEN     0      128               127.0.0.1:34927                    *:*                                                                                              users:(("java",2797,70))
LISTEN     0      50                        *:10000                    *:*                                                                                              users:(("java",1690,130))
LISTEN     0      128                      :::80                      :::*                                                                                              users:(("httpd",1282,4),("httpd",1414,4),("httpd",1415,4),("httpd",1416,4),("htt                                                                                        pd",1417,4),("httpd",1418,4),("httpd",1419,4),("httpd",1420,4),("httpd",1421,4))
LISTEN     0      128        ::ffff:10.0.2.15:60020                   :::*                                                                                              users:(("java",3513,121))
LISTEN     0      128               10.0.2.15:8020                     *:*                                                                                              users:(("java",1886,76))
LISTEN     0      128               10.0.2.15:50070                    *:*                                                                                              users:(("java",1886,99))
LISTEN     0      128                      :::22                      :::*                                                                                              users:(("sshd",1191,4))
LISTEN     0      128                       *:22                       *:*                                                                                              users:(("sshd",1191,3))
LISTEN     0      100                      :::11000                   :::*                                                                                              users:(("java",2237,35))
LISTEN     0      128                      :::5432                    :::*                                                                                              users:(("postmaster",1550,4))
LISTEN     0      128                       *:5432                     *:*                                                                                              users:(("postmaster",1550,3))
LISTEN     0      128                       *:8888                     *:*                                                                                              users:(("python",1064,5),("python",5540,5))
LISTEN     0      1          ::ffff:127.0.0.1:11001                   :::*                                                                                              users:(("java",2237,39))
LISTEN     0      100               127.0.0.1:25                       *:*                                                                                              users:(("master",1272,12))
LISTEN     0      50                        *:50010                    *:*                                                                                              users:(("java",1884,75))
LISTEN     0      128                       *:50075                    *:*                                                                                              users:(("java",1884,76))
LISTEN     0      50                        *:9083                     *:*                                                                                              users:(("java",1797,125))
LISTEN     0      128               10.0.2.15:50300                    *:*                                                                                              users:(("java",2834,74))
LISTEN     0      50                        *:50111                    *:*                                                                                              users:(("java",3142,261))
LISTEN     0      50                        *:8000                     *:*                                                                                              users:(("python2.6",3770,3),("python2.6",3843,3),("python2.6",3843,22))
LISTEN     0      50                        *:8002                     *:*                                                                                              users:(("java",3772,136))
LISTEN     0      50                       :::2181                    :::*                                                                                              users:(("java",2197,52))
LISTEN     0      128               10.0.2.15:51111                    *:*                                                                                              users:(("java",2820,74))
LISTEN     0      50                       :::48231                   :::*                                                                                              users:(("java",2197,43))
LISTEN     0      128               127.0.0.1:199                      *:*                                                                                              users:(("snmpd",1179,8))
LISTEN     0      50                        *:9290                     *:*                                                                                              users:(("java",2834,88))
LISTEN     0      128                       *:8010                     *:*                                                                                              users:(("java",1884,81))
LISTEN     0      128               10.0.2.15:50090                    *:*                                                                                              users:(("java",1888,76))
LISTEN     0      50                        *:3306                     *:*                                                                                              users:(("mysqld",1460,10))
share|improve this question
    
Are these using NAT? My understanding is that virtualbox guests that use NAT networking can't directly communicate with each other. They can communicate with each other using port forwarding (which will route traffic through the host OS). And they can communicate with each other if they are configured to use any networking type other than NAT. –  Mark Plotnick Nov 19 '13 at 4:51
    
@Mark Plotnick: Yes, true. But I am trying to communicate between two VMs running on the private network intnet which will be connected through internal networking and can send messages through the device driver of the host adapter if required. You can check 6.6 Internal Networking section in virtualbox.org/manual/ch06.html#networkingmodes –  somnathchakrabarti Nov 19 '13 at 4:55
    
@Mark Plotnick: I have added Internal Network adapter as second adapter in both VM instances (it's mentioned with the VM network adapter I used). See open-source-experiments.blogspot.com/2008/04/… –  somnathchakrabarti Nov 19 '13 at 4:57
    
I will try to reproduce. I'm not sure if eth0 is being connected to the intnet interfaces, since intnet is NIC adapter 2. I would expect eth0 to be connected to NIC adapter 1. A couple things to check: (a) is the DHCP server network you want to create - 10.0.2.* - distinct from the network address that vbox already uses for the NAT network? (2) do the two VM's perhaps have the same MAC addresses for the interfaces on the intnet net? –  Mark Plotnick Nov 19 '13 at 13:22
1  
@somnathchakrabarti can you please provide the output of these two commands on the guest VMs? route -n; sudo ss -lntp. –  MariusMatutiae Nov 30 '13 at 6:28

1 Answer 1

You have two possibilities:

  1. use bridged connections for both VMs. In this way they both have IPs on your LAN, as if they were physical machines.
  2. set up a Host-only network. This requires the following steps:

    a) File -> Preferences -> Network -> Host-only networks.

    b) Add one by clicking on the Plus sign;

    c) Hit the screwdriver -> DHCP server. Check Enable DHCP sever

    d) fill in the mask as you like. Reasonable values are: Server Address 192.168.56.254 Server mask 255.255.255.0 Lower Adrress Bound 192.168.56.100 Upper Address Bound 192.168.56.200

Now configure your VMs to have at least one adapter on the Host-only network.

Start you VMs, and now your host has IP 192.168.56.1, and the various VMs are located at 192.168.56.100, 192.168.56.101,... You can now ping and sssh and vnc from one machne to the others.

EDIT:

In view of your routing table, solution 2 will work if you give these commands on both VMs:

  sudo route delete default gw 10.0.2.2
  sudo route add default gw 192.168.56.1
share|improve this answer
    
I have tried with second option but as mentioned in my other thread superuser.com/questions/682318/…, due to some internal settings of the Hortonwork Sandbox guest instances, SSH is only enabled at 127.0.0.1:2222 But I need to access the individual guest VMs separately? –  somnathchakrabarti Nov 30 '13 at 6:19
    
Thanks a lot MariusMatutiae, for your detailed answer! It did help me a lot to progress further. I have tried with second option but as mentioned in my other thread superuser.com/questions/682318/…, due to some internal settings of the Hortonwork Sandbox guest instances, SSH is only enabled at 127.0.0.1:2222 But I need to access the individual guest VMs separately? –  somnathchakrabarti Nov 30 '13 at 6:25
    
@somnathchakrabarti I have amended my answer above to address your issue. –  MariusMatutiae Nov 30 '13 at 6:51
    
But I can access a single VM instance through 127.0.0.1:2222 I can't open SSH terminal for multiple VMs to execute from the command line! Do you mean that I execute your mentioned command in the only VM instance that I can SSH ? –  somnathchakrabarti Nov 30 '13 at 6:55
    
@somnathchakrabarti No, I am suggesting you use, from the host, ssh me@192.168.56.10.. to access your VM. –  MariusMatutiae Nov 30 '13 at 7:06

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.