Failed to add a custom host

I run the Rancher server on a virtual machine with ubuntu 16.04, and it works well.
When I want to add a custom agent with another virtual machine which runs on the same physical machine, it failed.
It shows good when I used the copied command to run a rancher-agent

INFO: Launched Rancher Agent: 85f29dde8a3816376f2ca22d5c24dab10ce824d9493ff87ab331cb8e4132935b

But I can’t see my host shown in the Web UI,so I tried to see the logs of the rancher-agent. Then I find out the error:

ERROR: DNS Checking loopback IP address, localhost or ::1 configured as the DNS server on the host file /etc/resolv.conf, can’t accept it

I wonder how to solve this problem. It also occur in the situation of adding the server as a custom host.

The error is described here:

In v1.6.15 you can add -e CATTLE_CHECK_NAMESERVER=false to ignore the check.

I think their instructions are outdated and it’s systemd providing the dns server instead of dnsmasq (maybe not in 16.04 but in newer versions). But the easiest thing to do is just give a list to docker instead of messing with the host config.

After I follow the instructions and finish the editing, the problem is still there…