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?
i found a way to do this:
kill the dns service (there may be a more subtle way?)
restart the service using the desired upstream server:
on a newer ubuntu (one with
systemd
) this would be:check with:
Navigate to this directory
/etc/resolvconf/resolv.conf.d
edit the head file using vi or vim with su privilegeadd the following lines to the file
save the file and use resolvconf utility to set the static DNS server address you entered by the following command
To get this to work, I added
au.archive.ubuntu.com
to the/etc/hosts
file with an IP address I got from pinging it on my PC.Then did
apt update
and it resolved.