yellowman / nsh

OpenBSD networking configuration shell
http://www.nmedia.net/nsh/
Other
177 stars 27 forks source link

add nameserver command to manage static DNS nameserver IPs #41

Closed stspdotname closed 1 year ago

stspdotname commented 1 year ago

The nameserver command accepts up to 5 IPv4 or IPv6 addresses and will propose these nameservers to resolvd(8) by running /sbin/route.

Nameservers learned by other means such as DHCP will co-exist peacefully, though the ultimate decision about which nameservers /etc/resolv.conf will contain is entirely up to resolvd.

The route nameserver command requires a network interface which the proposed nameservers belong to. We use lo0 for this purpose since lo0 is unlikely to be used by other daemons which produce nameserver proposals.

The /sbin/route command is also able to remove all nameservers associated with an interface. This is mapped to the "no nameserver" command, which removes all static nameservers configured for lo0 from /etc/resolv.conf.

stspdotname commented 1 year ago

The above force push fixed a bug in conf_nameserver(). Adding multiple nameservers requires one invocation of the nameserver command with a list of IPs, not several invocations with one IP each.

stspdotname commented 1 year ago

Above force-push changes the implementation to send a routing message directly instead of calling the /sbin/route executable to send it.

stspdotname commented 1 year ago

Above force-push removed the macro definition for "/sbin/route" added for the first version of this patch.