summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--nova/network/linux_net.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/nova/network/linux_net.py b/nova/network/linux_net.py
index 08a2ae354..b4f000280 100644
--- a/nova/network/linux_net.py
+++ b/nova/network/linux_net.py
@@ -67,6 +67,11 @@ linux_net_opts = [
cfg.ListOpt('dmz_cidr',
default=[],
help='A list of dmz range that should be accepted'),
+ cfg.MultiStrOpt('force_snat_range',
+ default=[],
+ help='Traffic to this range will always be snatted to the '
+ 'fallback ip, even if it would normally be bridged out '
+ 'of the node. Can be specified multiple times.'),
cfg.StrOpt('dnsmasq_config_file',
default='',
help='Override the default dnsmasq settings with this file'),
@@ -592,6 +597,14 @@ def init_host(ip_range=None):
add_snat_rule(ip_range)
+ rules = []
+ for snat_range in CONF.force_snat_range:
+ rules.append('PREROUTING -p ipv4 --ip-src %s --ip-dst %s '
+ '-j redirect --redirect-target ACCEPT' %
+ (ip_range, snat_range))
+ if rules:
+ ensure_ebtables_rules(rules, 'nat')
+
iptables_manager.ipv4['nat'].add_rule('POSTROUTING',
'-s %s -d %s/32 -j ACCEPT' %
(ip_range, CONF.metadata_host))