示例#1
0
 def ifup(self, iface):
     ipwrapper.linkSet(iface.name, ['up'])
     if iface.ipv4.bootproto == 'dhcp':
         dhclient.run(iface.name, 4, iface.ipv4.defaultRoute,
                      iface.duid_source, iface.blockingdhcp)
     if iface.ipv6.dhcpv6:
         dhclient.run(iface.name, 6, iface.ipv6.defaultRoute,
                      iface.duid_source, iface.blockingdhcp)
示例#2
0
def _set_dhcp_config(iface, attrs):
    # TODO: DHCPv6
    blocking_dhcp = attrs.get('blockingdhcp', False)
    duid_source = attrs.get('bonding') or attrs.get('nic')

    ipv4 = address.IPv4(*_ipv4_conf_params(attrs))
    if ipv4.bootproto == 'dhcp':
        dhclient.run(iface, 4, ipv4.defaultRoute, duid_source, blocking_dhcp)
示例#3
0
 def ifup(self, iface):
     with self.ip.interfaces[iface.name] as i:
         i.up()
     if iface.ipv4.bootproto == 'dhcp':
         dhclient.run(iface.name, 4, iface.ipv4.defaultRoute,
                      iface.duid_source, iface.blockingdhcp)
     if iface.ipv6.dhcpv6:
         dhclient.run(iface.name, 6, iface.ipv6.defaultRoute,
                      iface.duid_source, iface.blockingdhcp)
示例#4
0
def dhclient_run(iface):
    dhclient.run(iface, blocking_dhcp=True)
    try:
        yield
    finally:
        dhclient.stop(iface)
示例#5
0
def dhclient_run(iface):
    dhclient.run(iface, blocking_dhcp=True)
    try:
        yield
    finally:
        dhclient.stop(iface)