Instalação do ISC DHCP server no Ubuntu e derivados

Publicado por Pietro Scherer (última atualização em 27/09/2013)

[ Hits: 9.520 ]

Homepage: www.twitter.com/pietro_scherer

Download install_dhcp.sh

Download install_dhcp_1.0.sh (versão 2)




Instala e configura o servidor DHCP da ISC no Ubuntu e outras distribuições que utilizam o apt-get.

  



Versões atualizadas deste script

Versão 2 - Enviado por Pietro Scherer em 25/09/2013

Changelog: Adicionado contato de desenvolvedor do script e corrigido um bug nas linhas do DNS.

Download install_dhcp_1.0.sh


Esconder código-fonte

#!/bin/bash

echo "                                                                              "
echo "                                                                              "
echo "            ##################################################################"
echo "            ##################################################################"
echo "            ####           INSTALACAO AUTOMATICA SERVIDOR DHCP            ####"
echo "            ##################################################################"
echo "            ##################################################################"

sleep 5

echo "EXECUTAR SCRIPT?[S/n]"
read sim
test "$sim" = "n" && exit

echo "Digite a interface de rede do servidor DHCP"
read interface

echo "Digite a faixa de rede [xxx.xxx.xxx.xxx]"
read subnet

echo "Digite a mascara de rede [xxx.xxx.xxx.xxx]"
read netmask

echo "Digite o endereco IP inicial da range DHCP [xxx.xxx.xxx.xxx]"
read rangestart

echo "Digite o endereco IP final da range DHCP [xxx.xxx.xxx.xxx]"
read rangeend

echo "Digite o gateway preferencial [xxx.xxx.xxx.xxx]"
read gateway

echo "Digite o DNS primario"
read dns1

echo "Digite o DNS secundario"
read dns2

echo "digite o broadcast de rede"
read broadcast

apt-get -y install isc-dhcp-server
mv /etc/dhcp/dhcpd.conf /etc/dhcp/dhcpd.conf.bkp
touch /etc/dhcp/dhcpd.conf
echo "ddns-update-style none;" >> /etc/dhcp/dhcpd.conf
echo "default-lease-time 600;" >> /etc/dhcp/dhcpd.conf
echo "max-lease-time 7200;" >> /etc/dhcp/dhcpd.conf
echo "authoritative;" >> /etc/dhcp/dhcpd.conf
echo "subnet $subnet netmask $netmask {" >> /etc/dhcp/dhcpd.conf
echo "range $rangestart $rangeend;" >> /etc/dhcp/dhcpd.conf
echo "option routers $gateway;" >> /etc/dhcp/dhcpd.conf
echo "option domain-name-servers $dns1,$dns2" >> /etc/dhcp/dhcpd.conf
echo "option broadcast-address $broadcast;" >> /etc/dhcp/dhcpd.conf
echo "}" >> /etc/dhcp/dhcpd.conf
mv /etc/default/isc-dhcp-server /etc/default/isc-dhcp-server.bkp
touch /etc/default/isc-dhcp-server
echo "INTERFACES=\"$interface\"" >> /etc/default/isc-dhcp-server

Scripts recomendados

Montar Dispositivos USB

AutoLibre

Script educado que saúda o usuário

Script de instalação de pacotes

.conky


  

Comentários
[1] Comentário enviado por guinux em 20/09/2013 - 12:24h

Parabéns pelo script!


Contribuir com comentário




Patrocínio

Site hospedado pelo provedor RedeHost.
Linux banner

Destaques

Artigos

Dicas

Tópicos

Top 10 do mês

Scripts