summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMark McLoughlin <markmc@redhat.com>2011-09-20 09:37:07 +0000
committerTarmac <>2011-09-20 09:37:07 +0000
commit086a2184bc29880ce97e826fc43656a7eec54986 (patch)
treec20b26e2cc6d3ad51f41d0bb90aaeb4a05a3bfee
parent0e0a2e7fc8f98c7ef9c85e466dae985e5a529238 (diff)
parenta1229e5dbc3c03887dec49d93f55a0e4f60d96be (diff)
downloadnova-086a2184bc29880ce97e826fc43656a7eec54986.tar.gz
nova-086a2184bc29880ce97e826fc43656a7eec54986.tar.xz
nova-086a2184bc29880ce97e826fc43656a7eec54986.zip
Add iptables filter rules for dnsmasq (lp:844935)
On Fedora, the default policy for the INPUT chain in the filter table is DROP. This means that DHCP and DNS request packets from the guest get dropped. Add these rules to allow the traffic through:  $> sudo iptables -t filter -A nova-network-INPUT -i br0 -p udp -m udp --dport 67 -j ACCEPT  $> sudo iptables -t filter -A nova-network-INPUT -i br0 -p tcp -m tcp --dport 67 -j ACCEPT  $> sudo iptables -t filter -A nova-network-INPUT -i br0 -p udp -m udp --dport 53 -j ACCEPT $> sudo iptables -t filter -A nova-network-INPUT -i br0 -p tcp -m tcp --dport 53 -j ACCEPT
-rwxr-xr-xnova/network/linux_net.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/nova/network/linux_net.py b/nova/network/linux_net.py
index 9bf98fc27..ad7c5776b 100755
--- a/nova/network/linux_net.py
+++ b/nova/network/linux_net.py
@@ -524,6 +524,18 @@ def get_dhcp_hosts(context, network_ref):
return '\n'.join(hosts)
+def _add_dnsmasq_accept_rules(dev):
+ """Allow DHCP and DNS traffic through to dnsmasq."""
+ table = iptables_manager.ipv4['filter']
+ for port in [67, 53]:
+ for proto in ['udp', 'tcp']:
+ args = {'dev': dev, 'port': port, 'proto': proto}
+ table.add_rule('INPUT',
+ '-i %(dev)s -p %(proto)s -m %(proto)s '
+ '--dport %(port)s -j ACCEPT' % args)
+ iptables_manager.apply()
+
+
def get_dhcp_opts(context, network_ref):
"""Get network's hosts config in dhcp-opts format."""
hosts = []
@@ -616,6 +628,8 @@ def update_dhcp(context, dev, network_ref):
_execute(*cmd, run_as_root=True)
+ _add_dnsmasq_accept_rules(dev)
+
@utils.synchronized('radvd_start')
def update_ra(context, dev, network_ref):