LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 06-18-2010, 10:11 PM   #1
alee
LQ Newbie
 
Registered: May 2008
Posts: 28

Rep: Reputation: 15
Configuring 2 Ubuntu VM (networking)


Hi,

I have latest ubuntu and I have made 3 vm's for them.

VM 1: with 2 NIC cards, one is NAT connected directly through my host machine to the internet with ip address 192.168.190.142. Second NIC card is "host only" with ip address 192.168.0.10

VM 2: with 1 NIC card, "host only" and ip address 192.168.0.100

I want VM 2 to connect to the internet but through VM 1. for this I used following configuration in
Code:
/etc/network/interfaces
but it is not working

Code:
auto lo
iface lo inet loopback

auto eth1
iface eth1 inet static
    address 192.168.0.100
        netmask 255.255.255.0
        network 192.168.0.0
        broadcast 192.168.0.255
        gateway 192.168.0.10
I have given my VM 2 the gateway of VM 1 but it is not going through. Am i doing something wrong. Could someone please help me?

P.S:
both machines are pinging each other properly.
 
Old 06-19-2010, 02:31 AM   #2
tkmsr
Member
 
Registered: Oct 2006
Distribution: Ubuntu,Open Suse,Debian,Mac OS X
Posts: 798

Rep: Reputation: 39
When we read your question we are completely clueless as what you are asking

1) You are using Xen,KVM or which type of hypervisor ?
2) When you say VM1 I think you mean to say the real operating system which is host for the guests is it correct?
3) Can you describe some thing about your network topology bridged,NAT,






Code:
                                |--------------192.168.0.100
                                |            
                                | 
                                |
                                |
                                |
                                |--------------192.168.1.4
                                |            
  (Public IP )     (KVM)        |
            A-------------------|
                                |
  (192.168.190.142)             |
  (192.168.0.10                 |--------------192.168.1.5
                                |            
                                |
                                |
                                |
                                |
                                |
                                |
                                |--------------192.168.1.19
                                |

4)
Quote:
Originally Posted by alee View Post
Hi,


P.S:
both machines are pinging each other properly.
Which are these two machines.

5) Are you saying the host Operating System also as VM or only guest OS?

Last edited by tkmsr; 06-19-2010 at 02:37 AM.
 
Old 06-19-2010, 10:17 AM   #3
alee
LQ Newbie
 
Registered: May 2008
Posts: 28

Original Poster
Rep: Reputation: 15
Okay, I might have put the question in a wrong way.

- I have 1 physical machine which is running Windows 7 64 Bit.
- I have installed VMWare on it.
- I have created 2 VM (Virtual Machines). VM 1 (Ubuntu 10.04) and VM 2 (Ubuntu 10.04)


Code:


                                  192.168.0.10 (eth2)                           192.168.0.100 (eth1)
Windows 7 ------------------ VM 1 (2 NIC Cards)--------------------------- VM 2 (1 NIC Card)
(host)                        192.168.80.132 (
                            eth1 - NAT with Host Machine i.e. 
                                   windows 7)
The VM1 machine, is able to use internet properly.
- 2 Machines (VM 1 and VM 2) are able to ping each other i.e.
Code:
ping 192.168.0.10
from VM 2 work fine and
Code:
ping 192.168.0.100
from VM 1 work fine

I want my VM 2 to access internet through VM 1.


I hope i am clear this time
 
Old 06-19-2010, 12:01 PM   #4
tkmsr
Member
 
Registered: Oct 2006
Distribution: Ubuntu,Open Suse,Debian,Mac OS X
Posts: 798

Rep: Reputation: 39
Quote:
Originally Posted by alee View Post
I want my VM 2 to access internet through VM 1.
Then you need to configure Squid on VM1
Google Squid.
 
Old 06-19-2010, 12:59 PM   #5
alee
LQ Newbie
 
Registered: May 2008
Posts: 28

Original Poster
Rep: Reputation: 15
emm .. are you sure? it should not be that complex thing .. :s
 
Old 06-19-2010, 12:59 PM   #6
alee
LQ Newbie
 
Registered: May 2008
Posts: 28

Original Poster
Rep: Reputation: 15
okay let me put this way. I don't want to set up a proxy server. I want to share the connection which is being used by VM1.
 
Old 06-19-2010, 06:47 PM   #7
SuperJediWombat!
Member
 
Registered: Apr 2009
Location: Perth, Australia
Distribution: Ubuntu/CentOS
Posts: 208

Rep: Reputation: 51
From VM1 run these commands:
Code:
sudo bash -c 'echo "1" > /proc/sys/net/ipv4/ip_forward'
sudo iptables -t nat -A POSTROUTING -o eth1 -s 192.168.0.0/24 -j MASQUERADE
That assumes that eth1 is the 'external' interface for VM1 (whichever interface is connected to the internet through the windows7 host)
 
1 members found this post helpful.
Old 06-19-2010, 09:34 PM   #8
alee
LQ Newbie
 
Registered: May 2008
Posts: 28

Original Poster
Rep: Reputation: 15
i did the ipforward thingy but have not tested the iptables. will test it .. thanks though
 
Old 06-20-2010, 08:49 AM   #9
SuperJediWombat!
Member
 
Registered: Apr 2009
Location: Perth, Australia
Distribution: Ubuntu/CentOS
Posts: 208

Rep: Reputation: 51
You will also need to set VM1 as the default gateway for VM2
 
  


Reply

Tags
networking, vmware



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem with configuring Xen Bridge Networking l2g Linux - Networking 4 04-30-2010 05:04 AM
Configuring SUSE 11 Networking swamprat Linux - Networking 2 11-27-2008 03:08 AM
still problem configuring ip and networking juanb Linux - Newbie 6 01-03-2006 04:40 AM
Problems Configuring Networking rtwatts07 Linux - Newbie 5 08-07-2004 07:54 PM
Linux-Networking Configuring Samba and Firewall Pradeep Linux - Networking 0 11-26-2001 10:26 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 09:37 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration