diff --git a/generate.py b/generate.py
index 4cbab193718ebb1da783e3895b32e091fc477e20..b06bdceaa858d944b486dc0112fde65d45edcdbf 100755
--- a/generate.py
+++ b/generate.py
@@ -74,6 +74,8 @@ def retrieve_hosts():
             # TODO AAAA records (and others)
             for (name, ttl, rdata) in z.iterate_rdatas('A'):
                 host = h.get(name)
+                if name in [s.strip() for s in config['excludes']['unmerged'].split(',')]:
+                    continue
                 if host is None:
                     host = []
                     h[name] = host
@@ -83,6 +85,8 @@ def retrieve_hosts():
                     i[rdata.address] = addr
                 addr.append(name)
             for (name, ttl, rdata) in z.iterate_rdatas('CNAME'):
+                if name in [s.strip() for s in config['excludes']['unmerged'].split(',')]:
+                    continue
                 target = h.get(rdata.target)
                 if target is None:
                     target = []
@@ -93,6 +97,8 @@ def retrieve_hosts():
                 if line.startswith('#') or len(line.strip()) < 3:
                     continue
                 parts = line.split()
+                if parts[1] in [s.strip() for s in config['excludes']['unmerged'].split(',')]:
+                    continue
                 addr = i.get(parts[0])
                 if addr is None:
                     addr = []