Friday, April 19, 2024
 Popular · Latest · Hot · Upcoming
7
rated 0 times [  7] [ 0]  / answers: 1 / hits: 8524  / 2 Years ago, mon, december 6, 2021, 6:43:11

is there a way i can change the DNS server on the command-line without having to change anything on the disk?



i recently booted into the rescue session and i got an IP address (using DHCP) but no DNS server. as my network config is usually done with the nm-applet in the desktop session and not in /etc/network/interfaces i would like to be able to provide a DNS server just for this rescue session and not write anything on disk.



this is usually possible by editing /run/resolvconf/resolv.conf. but resolvconf seems not to be running in the ubuntu 14.04 rescue session.



i was hoping there was something similar to the network configuration where i can configure an interface without having to edit a file:



# ifconfig eth0 192.168.2.5 netmask 255.255.255.0
# route add default gw 192.168.2.1


is there a way to do this for DNS in a rescue session on ubuntu 14.04?


More From » 16.04

 Answers
2

i found a way to do this:



kill the dns service (there may be a more subtle way?)



# killall dnsmasq


restart the service using the desired upstream server:



# dnsmasq --server=192.168.2.1





on a newer ubuntu (one with systemd) this would be:



# systemd-resolve -i enp0s31f6 --set-dns=192.168.2.1  # --set-dnssec=true


check with:



# systemd-resolve --status

[#18128] Wednesday, December 8, 2021, 2 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
tonhorn

Total Points: 196
Total Questions: 118
Total Answers: 95

Location: Vanuatu
Member since Fri, May 13, 2022
2 Years ago
tonhorn questions
Tue, May 10, 22, 12:01, 2 Years ago
Sat, Dec 18, 21, 06:23, 2 Years ago
Thu, Jun 16, 22, 04:03, 2 Years ago
Fri, Apr 1, 22, 05:23, 2 Years ago
;