示例#1
0
def _setup_ip_forwarding():
    """
    Ensure that IP forwarding is enabled.
    :return: None
    """
    # Enable IP forwarding since all compute hosts are vRouters.
    # IPv4 forwarding should be enabled already by docker.
    try:
        with open('/proc/sys/net/ipv4/ip_forward', 'w') as f:
            f.write("1")
    except Exception:
        print "ERROR: Could not enable ipv4 forwarding."
        sys.exit(1)

    try:
        if ipv6_enabled():
            with open('/proc/sys/net/ipv6/conf/all/forwarding', 'w') as f:
                f.write("1")
    except Exception:
        print "ERROR: Could not enable ipv6 forwarding."
        sys.exit(1)
示例#2
0
def _setup_ip_forwarding():
    """
    Ensure that IP forwarding is enabled.
    :return: None
    """
    # Enable IP forwarding since all compute hosts are vRouters.
    # IPv4 forwarding should be enabled already by docker.
    try:
        with open('/proc/sys/net/ipv4/ip_forward', 'w') as f:
            f.write("1")
    except Exception:
        print "ERROR: Could not enable ipv4 forwarding."
        sys.exit(1)

    try:
        if ipv6_enabled():
            with open('/proc/sys/net/ipv6/conf/all/forwarding', 'w') as f:
                f.write("1")
    except Exception:
        print "ERROR: Could not enable ipv6 forwarding."
        sys.exit(1)