SIMULATION -
Successfully resolve to server1.example.com where your DNS server is 172.24.254.254.
SIMULATION -
Successfully resolve to server1.example.com where your DNS server is 172.24.254.254.
To successfully resolve server1.example.com using the DNS server at 172.24.254.254, you should configure the DNS server in the /etc/resolv.conf file. Open /etc/resolv.conf with a text editor and add the line 'nameserver 172.24.254.254'. Save the file, then use the 'host server1.example.com' command to verify that server1.example.com is being resolved correctly. This method sets the DNS server for the session, and the 'host' command will query the specified DNS server for the IP address of server1.example.com.
example nmcli c m ens192 1pv4.dns 172.24.254.254 or nmtui
absolutey the easiest and also persistent way to do it. just a sidenote, there is a typo (1pv4.dns --> should be ipv4.dns)
Can you add this to the vim /etc/hosts file to complete this request?
I do not see it like this. /etc/hosts contains domain name and IP address of each custom machine/server we want to add. The question does not provide IP address of the server, only DNS server. The IP of the server itself is unknown and DNS should resolve it. Correct method (and easiest, IMHO) would be to use nmcli like sugisho suggested. Modifying resolv.conf, on the other hand, would only result in temporary solution as this file gets overwritten automatically on each reboot by NetworkManager, unless we add a custom configuration to /etc/NetworkManager/conf.d/something.conf with contents: [main] dns=none Only then can we modify the /etc/resolv.conf manually and it will persist.
echo "172.24.254.254 server1.example.com" >> /etc/hosts
echo "172.24.254.254 server1.example.com" >> /etc/hosts