I’m new to Rancher and I’m writing a paper on the same. I’m having a loopback problem in DNS that prompts me to wrap resolv.conf. But when I change any field in this file my internet access is hacked and still it does not fix my problem. Help please!!
ERROR: DNS Checking loopback IP address 127.0.0.0/8, localhost or ::1 configured as the DNS server on the host file /etc/resolv.conf, can’t accept it
I struggle with this constantly. If I reboot (FreeNAS on metal running Ubuntu server in VM running Rancher), it’s a super-annoying ritual. Thankfully, I don’t reboot often. I fight with the resolv.conf so much I had to write a script to make it what I want it to be. And dnsmasq will keep replacing it randomly, or if I restart containers or if I sneeze. So just run the commands below in a script, it’s so much easier.
Your system is still going to want its hostname to point to its IP address, so manually add it to /etc/hosts. Once you make this resolv.conf change, you’ll start getting lookup errors if you don’t.
Make the resolv.conf that you want and copy it to /run/systemd/resolve/
#!/bin/sh
sudo rm /run/systemd/resolve/stub-resolv.conf
sudo ln -s /run/systemd/resolve/resolv.conf /run/systemd/resolve/stub-resolv.conf #this is the end
More than likely you’re getting this problem when you’re either trying to add a host, or if you’ve restarted and the host is trying to start back up. In hosts it’ll say Reconnecting and never progress. Once you’ve gotten the resolv.conf you want (you may want to keep checking to make sure it hadn’t been reverted), then:
sudo docker container restart rancher-agent
Your host will connect immediately and your stacks should start activating. (If you were just getting started and trying to add a host, you’ll be able to at this point.)
This is a terribly crude solution, but it works. It’s all I could come up with in the limited time I had.
If anyone else knows a permanent solution, that would be amazing. I tried to install dnsmasq so that I could just put the DNS servers I wanted in /etc/dnsmasq.conf, but Ubuntu only does dnsmasq-base and it doesn’t seem to work with that.