-
Notifications
You must be signed in to change notification settings - Fork 0
/
changeDNS.sh
executable file
·49 lines (43 loc) · 967 Bytes
/
changeDNS.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#!/bin/bash
function usage(){
echo "<script name> [o|f]"
echo "-o starts the openDNS Server"
echo "-f stops the openDNS server"
}
function startOpenDNS(){
echo "Cambiando a OpenDNS"
sudo service hostapd stop
sudo service isc-dhcp-server stop
sudo cp /etc/dhcp/dhcpd-opendns.conf /etc/dhcp/dhcpd.conf
sudo ifdown wlan0 && sudo ifup wlan0
sudo ifconfig wlan0 192.168.42.1
sudo service isc-dhcp-server start
sudo service hostapd start
echo "Cambio a OpenDNS realizado"
}
function stopOpenDNS(){
echo "Quitando el OpenDNS"
sudo service hostapd stop
sudo service isc-dhcp-server stop
sudo cp /etc/dhcp/dhcpd-normal.conf /etc/dhcp/dhcpd.conf
sudo ifdown wlan0 && sudo ifup wlan0
sudo ifconfig wlan0 192.168.42.1
sudo service isc-dhcp-server start
sudo service hostapd start
echo "OpenDNS apagado"
}
while getopts ":of" opts; do
case "${opts}" in
o)
startOpenDNS
;;
f)
stopOpenDNS
;;
*)
usage
exit -1
;;
esac
done
exit 0