diff --git a/tun_linux.go b/tun_linux.go index 497e76a..03130f2 100644 --- a/tun_linux.go +++ b/tun_linux.go @@ -891,7 +891,9 @@ func (t *NativeTun) setSearchDomainForSystemdResolved() { } go func() { _ = shell.Exec(ctlPath, "domain", t.options.Name, "~.").Run() - _ = shell.Exec(ctlPath, "default-route", t.options.Name, "true").Run() - _ = shell.Exec(ctlPath, append([]string{"dns", t.options.Name}, common.Map(dnsServer, netip.Addr.String)...)...).Run() + if t.options.AutoRoute { + _ = shell.Exec(ctlPath, "default-route", t.options.Name, "true").Run() + _ = shell.Exec(ctlPath, append([]string{"dns", t.options.Name}, common.Map(dnsServer, netip.Addr.String)...)...).Run() + } }() }