LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Networking (http://www.linuxquestions.org/questions/linux-networking-3/)
-   -   Setting up a virtual network with DHCP on host (http://www.linuxquestions.org/questions/linux-networking-3/setting-up-a-virtual-network-with-dhcp-on-host-4175428753/)

pinsky 09-24-2012 05:04 AM

Setting up a virtual network with DHCP on host
 
I'm doing a voluntary network workshop on basic networking in a Linux environment. The idea is to show them how networking works, and give possible solution for migrations to Open source solutions instead of current pure Microsoft ones.

I am limited on using a live USB, or in the worst scenario a live DVD. I was planning on having Lubuntu with KVM preinstalled and have 2 small Debian installations as virtual machines.

The idea was to try to set a DHCP server on the Lubuntu host, and have it assign the IP-s for the virtual client machines.

Then try to separate the clients, so that each is on a separate LAN, and set the host as router with NAT, so that the clients can access the Internet through the host, and ping each other even though they are on different subnets.

Then we'd also like to setup a DNS on the host, so the subnets can have each a domain name...

Which virtual networking option would you suggest?

I don't want the bridged option in which the hosts will get their IP from the real router cause then we cant experiment with router setup on the host computer.

However, if we use the KVM NAT, then we again can't setup the router on the host.

I guess what we're looking for is how to achieve just a "virtual physical" :) network connection, and leave all the other handling to the host.

acid_kewpie 09-24-2012 05:12 AM

As there's not really such a thing as kvm networking, and the config is really just pure Linux it's really simple to put together whatever network layout you want internally. Create internal bridges for whatever internal networks you want, as as long as your host also has an interface on that network then you can enable ip_forward and route out to them, or NAT them out. Why can't you just use the default NAT config? I don't really see where the issue is with this. You can certainly pull out the MASQ config from iptables if you don't actually want NAT, that's probably the simplest way to get where you appear to want to be.

pinsky 09-24-2012 05:50 AM

Quote:

Originally Posted by acid_kewpie (Post 4787869)
Why can't you just use the default NAT config? I don't really see where the issue is with this.

I thought it was some internal KVM networking mechanism being used to handle NAT and assigning IP to virtual clients.


I will try to do what you told me. Do all the settings for setting bridges on both host and virtual clients take place in:

Code:

/etc/network/interfaces

acid_kewpie 09-24-2012 05:54 AM

No, DHCP is generally done by a noddy dnsmasq instance. The bridges are, I *think* loaded by libvirt (which is outside of KVM technically), but only to keep the configuration separate. You can put the configs directly in that location (or the /etc/sysconfig/network-scripts original location) and load virbr1 on demand easily enough, but there's probably no real need to undermine the management wrapper it does put in place.

pinsky 09-24-2012 06:15 AM

So the next steps are?
  • Disable dnsmasq
  • Setup bridges with brctl
Is this what you ment by:
Quote:

Originally Posted by acid_kewpie
but there's probably no real need to undermine the management wrapper it does put in place.

"Use the standard way to make bridges"?
  • Install a DHCP server on the host


All times are GMT -5. The time now is 08:31 AM.