Inicio > network, unix/linux > Switch DNS

Switch DNS

jueves, 1 de julio de 2010 Albertux Dejar un comentario Ir a comentarios
#!/bin/bash
# Author: Albertux (Alberto Isaac Ayala Esquivias)
# Script: switch the nameservers (DNS)
 
if [ ! $( id -u ) -eq 0 ]
then
	echo "Run this script as root"
	exit
fi
 
if [ $# -le 0 ]
then
	echo "Usage $0 [open|google|comodo|old]"
fi
 
if  [ ! -f /etc/resolv.conf.bak ]
then
	cp /etc/resolv.conf /etc/resolv.conf.bak
fi
 
case $1 in
	open)
		echo -e "# OpenDNS\nnameserver 208.67.222.222\nnameserver 208.67.220.220" > /etc/resolv.conf
	;;
	google)
		echo -e "# Google Public DNS\nnameserver 8.8.8.8\nnameserver 8.8.4.4" > /etc/resolv.conf
	;;
	comodo)
		echo -e "# Comodo Secure DNS\nnameserver 156.154.70.22\nnameserver 156.154.71.22" > /etc/resolv.conf
	;;
	old)
		cp /etc/resolv.conf.bak /etc/resolv.conf
	;;
esac
Categories: network, unix/linux Tags: ,
  1. Sin comentarios aún.
  1. Sin trackbacks aún.