// For details please see http://www.cyberciti.biz/faq/howto-linux-renew-dhcp-client-ip-address/ func (dnsconf *dNSConfig) ReloadNameServers() (err error) { err = debugmode.DebugExec("dhclient", "-r") if err != nil { return err } err = debugmode.DebugExec("dhclient") if err != nil { return err } debugmode.DebugExec("service", "network-manager", "restart") return err }
func (dnsconf *dNSConfig) DHCPNameServers() (err error) { err = debugmode.DebugExec("netsh", "interface", "ip", "set", "dnsservers", dnsconf.iface.Name, "dhcp") if err != nil { return err } return dnsconf.ReloadNameServers() }
func (dnsconf *dNSConfig) AddNameServers(addrs []net.IP) (err error) { for i, addr := range addrs { err = debugmode.DebugExec("netsh", "interface", "ip", "add", "dnsservers", dnsconf.iface.Name, addr.String(), fmt.Sprintf("%d", i+1)) if err != nil { return err } } return dnsconf.ReloadNameServers() }
// For details please see https://www.netbsd.org/docs/network/dhcp.html#enable-dhcp func (dnsconf *dNSConfig) ReloadNameServers() (err error) { return debugmode.DebugExec("sh", "/etc/rc.d/dhclient", "restart") }
func (dnsconf *dNSConfig) ReloadNameServers() (err error) { return debugmode.DebugExec("ipconfig", "/flushdns") }
// For details please see http://www.openbsd.org/cgi-bin/man.cgi/OpenBSD-current/man8/dhclient.8 // // When configuring the interface, dhclient attempts to remove any existing // addresses, gateway routes that use the interface, and non-permanent arp(8) // entries. Conversely, if the interface is later manipulated to add or // delete addresses then dhclient will automatically exit. It thus // automatically exits whenever a new dhclient is run on the same interface. func (dnsconf *dNSConfig) ReloadNameServers() (err error) { // On receiving HUP dhclient will restart itself, reading dhclient.conf(5) and // obtaining a new lease. return debugmode.DebugExec("pkill", "-HUP", "dhclient") }
// For details please see http://www.cyberciti.biz/faq/freebsd-unix-force-dhcp-client-to-get-a-new-lease/ func (dnsconf *dNSConfig) ReloadNameServers() (err error) { return debugmode.DebugExec("service", "dhclient", "restart", "em0") }