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 want to connect two hosts(ubuntu) in virtualbox by: Attached to NAT.

I set up in terminal: - 1st host: sudo ifconfig eth0 10.0.0.1 netmask 255.255.255.0 - 2nd host: sudo ifconfig eth1 10.0.0.2 netmask 255.255.255.0

and I checked on the 1st and 2nd host:

ping yahoo.com   -> unknownhost

  • ping 10.0.0.1 on the first host -> ok
  • ping 10.0.0.2 on the first host -> destination host unreacheable

  • ping 10.0.0.1 on the second host -> destination host unreacheable
  • ping 10.0.0.2 on the second host -> ok

What did I do wrong?


For second host:

eth1      Link encap:Ethernet  HWaddr 08:00:27:B8:2F:C5  
          inet addr:10.0.0.2  Bcast:10.0.0.255  Mask:255.255.255.0
          inet6 addr: fe80::a00:27ff:feb8:2fc5/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:52 errors:0 dropped:0 overruns:0 frame:0
          TX packets:52 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:6100 (5.9 KiB)  TX bytes:10176 (9.9 KiB)
          Base address:0xd240 Memory:f0820000-f0840000 

eth2      Link encap:Ethernet  HWaddr 08:00:27:C1:F8:AA  
          inet addr:10.0.2.15  Bcast:10.0.2.255  Mask:255.255.255.0
          inet6 addr: fe80::a00:27ff:fec1:f8aa/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:37 errors:0 dropped:0 overruns:0 frame:0
          TX packets:43 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:4774 (4.6 KiB)  TX bytes:4052 (3.9 KiB)
          Base address:0xd010 Memory:f0000000-f0020000 

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:16436  Metric:1
          RX packets:2 errors:0 dropped:0 overruns:0 frame:0
          TX packets:2 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:100 (100.0 b)  TX bytes:100 (100.0 b)

sit0      Link encap:IPv6-in-IPv4  
          NOARP  MTU:1480  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:0 (0.0 b)  TX bytes:0 (0.0 b)
share|improve this question
    
why are you using NAT instead of bridged? –  Kevin Apr 3 '13 at 11:54
    
i want to connect this hosts using private ip(RFC 1918) –  user213344 Apr 3 '13 at 12:18
add comment

1 Answer

Set up 2 seperate interfaces on each VM - One for NAT (which gives internet-acccess to the vms) and one as "Internal Networking" for inter-VM-communication.

Your current NAT Interfaces are not able to talk with each other.

share|improve this answer
    
i set up on the first host: Adapter 1:NAT,Adapter 2: INERNAL NETWORK. The same on second host, what should i do next? –  user213344 Apr 3 '13 at 13:19
    
Nobody wants to help me? –  user213344 Apr 3 '13 at 20:52
    
NAT networking requires no more action - the Guests should be able to reach every network that your host can reach. For the internal network you should have a look into your guest OS for figuring out the subnet and IPs of your guest - then you should be able to communicate between guests. –  Henrik Apr 5 '13 at 7:51
add comment

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.