Skip to content

Instantly share code, notes, and snippets.

@nickboldt
Created August 9, 2016 18:52
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nickboldt/7390a20ad5027a598d65ff44dcd5def5 to your computer and use it in GitHub Desktop.
Save nickboldt/7390a20ad5027a598d65ff44dcd5def5 to your computer and use it in GitHub Desktop.
add 8.8.8.8 to resolv.conf
#!/bin/bash
# note: run as root
# add 8.8.8.8 to /etc/resolv.conf
sed -e "s/nameserver 8.8.8.8//" /etc/resolv.conf | uniq > /etc/resolv.conf.2
echo "nameserver 8.8.8.8" >> /etc/resolv.conf.2
mv -f /etc/resolv.conf.2 /etc/resolv.conf
echo""
echo "Current /etc/resolv.conf contains:"
cat /etc/resolv.conf | grep -v "#"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment