Suggested Answer:See explanation below.
vi /etc/resolv.conf nameserver 172.24.254.254 host server1.example.com On every clients, DNS server is specified in /etc/resolv.conf. When you request by name it tries to resolv from DNS server.
This is old school stuff and name resolutions checks for DNS server first over hosts file and easiest way to do add DNS server IP without the complicated nmcli is to use nmtui (you can use it even in very base OS install and saves heaps of time)
nmcli great to have if you have plenty of time i.e. using it at work to waste time and deter your manage from ever thinking of firing you :)
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.
upvoted 1 times
...
...
Log in to ExamTopics
Sign in:
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.
Upvoting a comment with a selected answer will also increase the vote count towards that answer by one.
So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.
sugisho
Highly Voted 3 years, 4 months agowizojlo
9 months, 1 week agoPENNSHARK
Most Recent 10 months, 4 weeks agoLazylinux
3 months, 2 weeks agoAcesyo
1 year, 9 months agomattd81
2 years, 6 months agowizojlo
9 months, 1 week ago