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)
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)
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)
def dhclient_run(iface): dhclient.run(iface, blocking_dhcp=True) try: yield finally: dhclient.stop(iface)