Skip to content

Instantly share code, notes, and snippets.

@abutcher abutcher/magic.md
Last active Nov 28, 2017

Embed
What would you like to do?

Edit your network and add your domain (<domain name='example.com' localOnly='yes'/>) to the network definition. All of your hosts using this network must have hostnames (hostnamectl set-hostname) within the domain.

sudo virsh net-edit default
<network>
  <name>default</name>
  <uuid>a4879b25-1c92-49d6-986b-e9e2cde27678</uuid>
  <forward mode='nat'/>
  <bridge name='virbr0' stp='on' delay='0'/>
  <mac address='52:54:00:5e:35:9c'/>
  <!-- *~ magic ~* all VM hostnames must match *.example.com *~ magic ~* -->
  <domain name='example.com' localOnly='yes'/>
  <ip address='192.168.122.1' netmask='255.255.255.0'>
    <dhcp>
      <range start='192.168.122.2' end='192.168.122.254'/>
    </dhcp>
  </ip>
</network>

Destroy the network and recreate it.

sudo virsh net-destroy default
sudo virsh net-start default

Tell NetworkManager what's up.

/etc/NetworkManager/conf.d/localdns.conf:

[main]
dns=dnsmasq

The address line below allows all *.apps.example.com to resolve to 192.168.122.186. A router should exist on this IP address.

/etc/NetworkManager/dnsmasq.d/libvirt_dnsmasq.conf:

address=/apps.example.com/192.168.122.186
server=/example.com/192.168.122.1
addn-hosts=/etc/addn-hosts

Add any static hosts to /etc/addn-hosts.

/etc/addn-hosts:

192.168.122.186 master1.example.com openshift.example.com

Restart services.

systemctl restart NetworkManager
systemctl restart libvirtd
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.