Cannot connect to host

Failure in name resolution hints at the name server not being configured properly. If you can use the TrueNAS UI shell and e.g. ping google.com works as expected that would confirm that name resolution is indeed working so you might be suffering from:

Try that “ping” from the UI shell and report the results, please.