[controller] setup IPv6 hosts
This commit is contained in:
parent
8a14c40c7b
commit
f5b9baff78
1 changed files with 16 additions and 4 deletions
|
@ -14,6 +14,8 @@ import re
|
|||
import logging
|
||||
import argparse
|
||||
import ipaddress
|
||||
import subprocess
|
||||
|
||||
|
||||
logging.basicConfig()
|
||||
log = logging.getLogger("main")
|
||||
|
@ -66,11 +68,21 @@ class L2Controller(object):
|
|||
- all routes are networks (no /128 v6 or /32 v4
|
||||
- hosts get the first ip address in the network
|
||||
"""
|
||||
for v6route in self.v6_routes[self.mode]:
|
||||
self.controller.table_add("v6_routing", "set_egress_port", [v6route['net']], [v6route['port']])
|
||||
|
||||
for v4route in self.v4_routes[self.mode]:
|
||||
self.controller.table_add("v4_routing", "set_egress_port", [v4route['net']], [v4route['port']])
|
||||
for v6route in self.v6_routes[self.mode]:
|
||||
host = "h{}".format(v6route['port'])
|
||||
dev = "{}-eth0".format(host)
|
||||
net = ipaddress.ip_network(v6route['net'])
|
||||
ipaddr = "{}/{}".format(net[1],net.prefix_length)
|
||||
|
||||
subprocess.run(["mx", host, "ip", "addr", "flush", "dev", dev])
|
||||
subprocess.run(["mx", host, "sysctl", "net.ipv6.conf.lo.disable_ipv6=0"])
|
||||
subprocess.run(["mx", host, "sysctl", "net.ipv6.conf.{}.disable_ipv6=0".format(dev)])
|
||||
subprocess.run(["mx", host, "ip", "addr", "add", ipaddr, "dev", dev])
|
||||
|
||||
# mx h$i "ip -6 route add default via 2001:db8:6::42"
|
||||
|
||||
#for v4route in self.v4_routes[self.mode]:
|
||||
|
||||
|
||||
def debug_print_pkg(self, pkg, msg="INCOMING"):
|
||||
|
|
Loading…
Reference in a new issue