networking - How to set DNS server address temporarily? - Ask Ubuntu


at workplace dhcp server goes down.

so made script sets ip address , netmask using ifconfig , default gateway using route. i'm yet find command assign dns server temporarily.

is there command can use set dns server address eth0 temporarily? if dhcp server comes back, can reconnect using dhcp without hard coding configuration file.

write /etc/resolv.conf:

echo "nameserver 1.2.3.4" | sudo tee /etc/resolv.conf 

upon successful dhcp connection, should overwritten "correct" dns server.


Comments

Popular posts from this blog

download - Firefox cannot save files (most of the time), how to solve? - Super User

windows - "-2146893807 NTE_NOT_FOUND" when repair certificate store - Super User

sql server - "Configuration file does not exist", Event ID 274 - Super User