openstack team mailing list archive
-
openstack team
-
Mailing list archive
-
Message #13436
Re: Problems accessing metadata service due to nova-network generated iptables rules
> Is the DNAT rule expected to work? Does linux_net.py need a special
> case for when the metadata address is on the local host?
For now, I've modified linux_net.py so that it conditionally creates a REDIRECT
rule if FLAGS.metadata_host is 127.0.0.1:
def metadata_forward():
"""Create forwarding rule for metadata."""
if FLAGS.metadata_host == '127.0.0.1':
iptables_manager.ipv4['nat'].add_rule('PREROUTING',
'-s 0.0.0.0/0 -d 169.254.169.254/32 '
'-p tcp -m tcp --dport 80 -j REDIRECT '
'--to-ports %s' %
(FLAGS.metadata_port))
else:
iptables_manager.ipv4['nat'].add_rule('PREROUTING',
'-s 0.0.0.0/0 -d 169.254.169.254/32 '
'-p tcp -m tcp --dport 80 -j DNAT '
'--to-destination %s:%s' %
(FLAGS.metadata_host, FLAGS.metadata_port))
iptables_manager.apply()
--
Lars Kellogg-Stedman <lars@xxxxxxxxxxxxxxxx> |
Senior Technologist | http://ac.seas.harvard.edu/
Academic Computing | http://code.seas.harvard.edu/
Harvard School of Engineering and Applied Sciences |
Follow ups
References