add route6 option to route ipv6 nets to a specific address

This commit is contained in:
2014-08-02 23:23:16 +02:00
parent d242e3e65e
commit bcb22604a4

View File

@@ -254,6 +254,13 @@ class VMHelper:
for ipv6 in net['ipv6']: for ipv6 in net['ipv6']:
commands.append( ["ip", "-6", "route", "add", ipv6, "dev", net['dev']]) commands.append( ["ip", "-6", "route", "add", ipv6, "dev", net['dev']])
commands.append(["ip6tables", "-A", chain, "-i", net['dev'], "-s", ipv6, "-j", "ACCEPT"]) commands.append(["ip6tables", "-A", chain, "-i", net['dev'], "-s", ipv6, "-j", "ACCEPT"])
# routes networks onto a specific ipv6 address belonging to the VM
if ('route6' in net):
for dstnet, viaadd in net['route6'].items():
commands.append( ["ip", "-6", "route", "add", dstnet, "via", viaadd ])
commands.append(["ip6tables", "-A", chain, "-i", net['dev'], "-s", dstnet, "-j", "ACCEPT"])
commands.append(["ip6tables", "-A", chain, "-i", net['dev'], "-j", "REJECT", "--reject-with", "icmp6-adm-prohibited"]) commands.append(["ip6tables", "-A", chain, "-i", net['dev'], "-j", "REJECT", "--reject-with", "icmp6-adm-prohibited"])
commands.append(["ip6tables", "-A", "FORWARD", "-j", chain]) commands.append(["ip6tables", "-A", "FORWARD", "-j", chain])