You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Enhance tailnet to (optionally) configure DNS records for peers. #14718
Today, tailnet.Conn does not configure any DNS in Tailscale networking. In order to support a desktop native VPN to Coder workspaces, we should enhance tailnet.Conn (e.g. via the configMaps subcomponent) to be programmed with domain names and corresponding IP addresses to be served from the Tailscale DNS server.
This will allow us to eventually have client applications learn workspace agent names and IP addresses ( via #14716 ) and then program DNS entries for them into Tailscale.
In this increment, only IPv6 addresses need to be supported, and if enabled the Tailscale DNS service should respond on [fd60:627a:a42b::53]:53.
Here's what the DNS configuration looks like (taken from an experimental branch with hardcoded values), in configmaps.go
// reconfig computes the correct wireguard config and calls the engine.Reconfig// with the config we have. It is not intended for this to be called outside of// the updateLoop()func (c*configMaps) reconfig(nm*netmap.NetworkMap) {
cfg, err:=nmcfg.WGCfg(nm, Logger(c.logger.Named("net.wgconfig")), netmap.AllowSingleHosts, "")
iferr!=nil {
// WGCfg never returns an error at the time this code was written. If it starts, returning// errors if/when we upgrade tailscale, we'll need to deal.c.logger.Critical(context.Background(), "update wireguard config failed", slog.Error(err))
return
}
addrs:=append([]netip.Prefix{}, nm.Addresses...)
rc:=&router.Config{
LocalAddrs: addrs,
Routes: []netip.Prefix{ServicePrefix},
}
err=c.engine.Reconfig(cfg, rc, &dns.Config{
Routes: map[dnsname.FQDN][]*dnstype.Resolver{
"coderlan.": nil,
},
Hosts: map[dnsname.FQDN][]netip.Addr{
"dogfood2.coderlan.": {netip.MustParseAddr("fd7a:115c:a1e0:4280:a0ad:1919:6552:9fe3")},
},
OnlyIPv6: true,
}, &tailcfg.Debug{})
iferr!=nil {
iferrors.Is(err, wgengine.ErrNoChanges) {
return
}
c.logger.Error(context.Background(), "failed to reconfigure wireguard engine", slog.Error(err))
}
}
Activity
spikecurtis commentedon Sep 23, 2024
Here's what the DNS configuration looks like (taken from an experimental branch with hardcoded values), in
configmaps.gochore: support adding dns hosts to `tailnet.Conn` (#15419)