I have a really annoying issue. I am using KVM on CentOS 7 and two networks.

  • One of the networks is isolated with internal host routing only
  • The other network is forwarding using NAT.

I have set up two VM's. One of the VM's is only connected to the isolated network and the other is connected to both.

VM #1 - Gateway (nat network and isolated network) VM #2 - Isolated host (isolated network)

Now, the issue. I cannot get it VM #2 to be configured to use VM #1 as gateway with the network configuration. Sample below

  <bridge name='virbr2' stp='on' delay='0'/>
  <mac address='52:54:00:46:53:61'/>
  <domain name='systems'/>
  <ip address='' netmask=''>
      <range start='' end=''/>

Do I have to manually configure that each time the VM boot if I want to use DHCP? I can solve it by setting static configuration but I don't really want to use that.


  • If you want VM#2 to use DHCP you need to configure the VM accordingly. But you haven't shown VM#2's network configuration. There's not much hope of anyone helping you as your question currently stands. – garethTheRed Nov 21 '15 at 14:32
  • Well, the problem lies in the network configuration for the isolated network. I want to be able to set the default gateway in the configuration above, and I cannot find how to do it. VM #2 is a standard Win 7 with DHCP enabled. It relies on what is configure din the network, as mentioned above. If I set it to be static it works fine. VM #1 has IP – davvy Nov 21 '15 at 16:03
  • Ah! I understand your problem now. The default gateway (and DNS) is the IP address of the interface above ( I assume then, that your DHCP clients are either not being told this or choosing to ignore it. Have you used tcpdump or wireshark to see if it the gateway address is actually being sent by the host? – garethTheRed Nov 21 '15 at 17:51
  • The IP above is the IP of the interface that is assigned by the virtual host. I want an entry such as gateway= that I can put somewhere in the settings so that the default gateway will be that inside the VM. But yes, you are correct. The gateway is not being sent, I have confirmed it. – davvy Nov 21 '15 at 18:16
  • Going by this bug, libvirt starts an instance of dnsmasq for each network, which cannot be configured. The suggestion there is to not enable dhcp in the XML file (as you've done) and then start your own version of dnsmasq with your own custom configuration. – garethTheRed Nov 21 '15 at 22:35

As long as in your situation VM#1 is a gateway, it is intended to act as a DHCP server. So you just need to disable DHCP at network configuration xml (just remove anything between <dhcp> and </dhcp>) and run DHCP server or relay at VM#1.

I've just tested this approach and it works just fine for me.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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