0

I have a quick question. I have a bunch of VM's (VMWare Workstation) running on a Ubuntu server and have found that VMWare NAT (DHCP) service is unreliable and slow. I have to do use NAT instead of Bridging because I don't have enough static IP's for all the VMs.

Is it possible to setup the Linux Host (Ubuntu) to be a DHCP server but only for the local VM's?

The server has 2 NIC's so if I set eth0 to be a static IP, which connects to the outside work, and eth1 to listen for DHCP. Now, I am thinking if I don't want DHCP to broadcast I would just not connect a cable to eth1 and setup the VM's to connect to eth1 for the DHCP addresses. That way DHCP would not broadcast through my network but be listening on that interface.

Would that setup work?

EDIT

I have to use NAT or DHCP for the Guest VM's because the servers are in a data-center which does not offer DHCP and we don't have enough static IP's.

Thanks.

2
  • Why can't you use bridging and let the VMs get their IP addresses from the DHCP server that supplies the rest of the network? Oct 19, 2011 at 21:06
  • Hey John, good question. I would do that but unfortunately the servers are in a data-center that does not offer DHCP. All the Host servers are connecting to the outside world via switch and static IP's. Oct 19, 2011 at 21:11

3 Answers 3

1

I'm sure you could use iptables to simply block any incoming DHCP requests from other machines but another option is to set up your DHCP server with just enough scope to supply your VMs, which should have reservations set for each. That way there will be no other addresses which can be handed out, even if the server did happen to receive a request.

4
  • That is a very interesting thought, thanks. However, would that cause a lot of un-needed/wanted network activity? Does the DHCP server broadcast or listen for DHCP packets? Wouldn't it just be better to not have a network cable connected to the DHCP interface? That way for every new VM we add we don't have to worry about the DHCP reservation piece. Oct 19, 2011 at 22:19
  • the network load induced by DHCP is neglectable. Oct 20, 2011 at 19:36
  • @Antoine, I don't believe we're discussing network load. However, it would be most undesirable for other machines to receive addresses that are not valid for anything but those VMs, hence the need to prevent it. Oct 20, 2011 at 20:34
  • Oops sorry. My bad. Read through too quickly. Oct 20, 2011 at 20:49
0

If you need just simple DHCP server, I would suggest using dnsmasq ( http://thekelleys.org.uk/dnsmasq/doc.html ). Its a powerful DNS forwarder but comes with integrated DHCP server. I am not sure if you can disable the DNS part completely but should it be problem you can configure it on a different port.

Configuring DHCP is one config option ( --dhcp-range ), and its the same with more advanced features.

0

In my experience using Virtualbox 4.x under a NAT situation, Virtualbox creates a virtual network inside the Host with its own IP range and Gateway (gateway being the host with a static ip) which the VMs live within. All external access is through the NAT'ing gateway on a virtual network adapter separate from any physical adapters and cables.

Therefore it is possible under Virtualbox, knowing the internal NAT network details, to disable the Virtualbox DHCP server and provide your own from within the virtual network.

DHCP will not traverse outside of a gateway unless it is specifically routed, for example through a VPN tunnel.

I cannot comment specifically on VMWare but I assume it works in a similar fashion.

Should this be successful you will need to ensure the VM providing DHCP gives the same network details as the host otherwise you will loose access to them via the network. However with my little experience of VMWare, you should have a console session available in order to configure the DHCP machine should you loose network access.

3
  • Sorry, I should state, this is not the host providing the DHCP, but an internal VM. However, Linux DHCP allows you to configure adapters to respond to, simply configure the service to respond on the virtual adapter only, this will stop DHCP to the outside. Oct 20, 2011 at 19:35
  • Thanks Drew! Do you (or anyone else) by chance know how to configure the Host DHCP to only respond to a virtual adapter (eth0:1)? I am assuming its the same way as a physical interface but one would reference etho:1 in the /etc/default/dhcp3-server file. Is that correct? Oct 20, 2011 at 22:53
  • I'm not entirely sure, you could look at this page help.ubuntu.com/community/dhcp3-server as it mentions using and selecting multiple interfaces. It could be as simple as providing a different range and subnet for your VMs (different from the outside world) and targeting those subnets in the dhcp3 file. There is also this page: linuxhomenetworking.com/wiki/index.php/… ... Good luck! Oct 21, 2011 at 7:56

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .