Commit bdc2d63f authored by David Johnson's avatar David Johnson

Only enable routing/seg6 on routers.

parent f6fd727d
Pipeline #3061 passed with stages
in 15 seconds
......@@ -49,18 +49,18 @@ if not node:
print "Setting addresses for %s ..." % (hostname,)
(dev,mac) = (None,None)
addrs = []
for i in node.findall("g:interface",namespaces=nsmap):
mac = i.get("mac_address")
dev = None
if mac:
dev = findif(mac=mac)
addrs = []
for a in i.findall("c:ip",namespaces=nsmap):
if a.get("type") != "ipv6":
continue
(addr,prefixlen) = (a.get("address"),a.get("prefixlen"))
addrs.append("%s/%s" % (addr,prefixlen))
if dev and addrs:
if dev and len(addrs) > 1:
print "Enabling overall ipv6 forwarding and segment routing..."
os.system("sysctl -w net.ipv6.conf.all.forwarding=1")
os.system("sysctl -w net.ipv6.conf.all.seg6_enabled=1")
......@@ -68,12 +68,14 @@ for i in node.findall("g:interface",namespaces=nsmap):
os.system("sysctl -w net.ipv6.conf.%s.seg6_enabled=1" % (dev,))
print "Enabling ipv6 forwarding for %s ..." % (dev,)
os.system("sysctl -w net.ipv6.conf.%s.forwarding=1" % (dev,))
if dev:
print "Disabling ipv6 autoconf for %s ..." % (dev,)
os.system("sysctl -w net.ipv6.conf.%s.autoconf=0" % (dev,))
print "Flushing existing ipv6 addresses for %s ..." % (dev,)
os.system("ip -6 addr flush dev %s" % (dev,))
print "Downing interface %s to allow sysctls to take effect ..." % (dev,)
os.system("ip link set %s down" % (dev,))
if dev and len(addrs):
for a in addrs:
print "Adding address %s to %s" % (a,dev)
os.system("ip -6 addr add %s dev %s" % (a,dev))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment