-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathdns_server
25 lines (18 loc) · 1.24 KB
/
dns_server
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
#!/bin/bash
# Pedir al usuario la dirección IP del servidor DNS y el dominio
read -p "$(tput setaf 1)[$(tput setaf 3)*$(tput setaf 1)]$(tput setaf 6)Introduce la dirección IP del servidor DNS: " dns_ip
read -p "$(tput setaf 1)[$(tput setaf 3)*$(tput setaf 1)]$(tput setaf 6)Introduce el dominio: " domain
# Configurar el servidor DNS
echo "$(tput setaf 1)[$(tput setaf 3)*$(tput setaf 1)]$(tput setaf 6)Configurando servidor DNS..."
echo "$(tput setaf 1)[$(tput setaf 3)*$(tput setaf 1)]$(tput setaf 6)nameserver $dns_ip" > /etc/resolv.conf
# Configurar el dominio
echo "$(tput setaf 1)[$(tput setaf 3)*$(tput setaf 1)]$(tput setaf 6)Configurando dominio..."
echo "$(tput setaf 1)[$(tput setaf 3)*$(tput setaf 1)]$(tput setaf 6)search $domain" >> /etc/resolv.conf
# Agregar la dirección IP del servidor DNS al archivo hosts
echo "$(tput setaf 1)[$(tput setaf 3)*$(tput setaf 1)]$(tput setaf 6)Agregando dirección IP del servidor DNS al archivo hosts..."
echo "dns_ip www.$domain" >> /etc/hosts
# Reiniciar el servicio de red
echo "$(tput setaf 1)[$(tput setaf 3)*$(tput setaf 1)]$(tput setaf 6)Reiniciando el servicio de red..."
systemctl restart network
echo "$(tput setaf 1)[$(tput setaf 3)*$(tput setaf 1)]$(tput setaf 6)Configuración completa."
tput sgr0