def _setupRouting(endpoint): host = endpoint.getHost() assert host bridge = endpoint.getBridge() assert bridge id = endpoint.getId() assert id assert ifaceutil.bridgeExists(host, bridge) tincname = _tincName(endpoint) assert ifaceutil.interfaceExists(host, tincname) assert not ifaceutil.interfaceBridge(host, tincname) #enable ip forwarding host.execute ("sysctl -q -w net.ipv6.conf.all.forwarding=1"); host.execute ("sysctl -q -w net.ipv4.conf.all.forwarding=1"); #add gateway addresses for gw in endpoint.getGateways(): ifaceutil.addAddress(host, bridge, gw) #set bridge up ifaceutil.ifup(host, bridge) ifaceutil.connectInterfaces(host, bridge, tincname, id, endpoint.getGateways())
def _setupRouting(endpoint): host = endpoint.getHost() assert host bridge = endpoint.getBridge() assert bridge id = endpoint.getId() assert id assert ifaceutil.bridgeExists(host, bridge) tincname = _tincName(endpoint) assert ifaceutil.interfaceExists(host, tincname) assert not ifaceutil.interfaceBridge(host, tincname) #enable ip forwarding host.execute ("sysctl -q -w net.ipv6.conf.all.forwarding=1"); host.execute ("sysctl -q -w net.ipv4.conf.all.forwarding=1"); #add gateway addresses for gw in endpoint.getGateways(): ifaceutil.addAddress(host, bridge, gw) #set bridge up ifaceutil.ifup(host, bridge) ifaceutil.connectInterfaces(host, bridge, tincname, id, endpoint.getGateways()) for gw in endpoint.getGateways(): ip = gw.split("/")[0] util.waitFor(lambda :ifaceutil.reachable(host, ip, iface=bridge)) assert ifaceutil.reachable(host, ip, iface=bridge), "Cannot reach %s in interface %s" % (ip, bridge)