next_inactive up previous


Por Paco Aldarias Raya

Instalar un servidor dhcp

Por Paco Aldarias Raya

Impreso: 26 de noviembre 2003

Email: pacosecun@inicia.es
Web: http://aldarias.es/pacodebian
Este documento es de libre reproducción siempre que se cite su fuente.
Realizado con:
LATEX

Índice General


1 Introducción

El DHCP es un servicio para asignacion de ip de maquinas en una red local

La asignacion de ips puede ser: - De forma dinamica. Se da un rango de ips para dar Le da una ip libre La ips en una maquina cambian cada vez q se arranque - De forma estatica. El servidor analiza la mac de la tarjeta Y le da siempre una ip.

Hay routers que este servicio lo incluyen.

2 Instalación

Desde consola como root:

apt-get install dhcp

3 Configurar

Crear el fichero: /etc/dhcpd.conf
default-lease-time 600;
max-lease-time 7200;
option subnet-mask 255.255.255.0;
option broadcast-address 192.168.0.255;
option routers 192.168.0.200; option domain-name-servers 192.168.0.200, 194.179.1.100; /
option domain-name "pacodominio.es";

ddns-update-style ad-hoc;

subnet 192.168.0.0 netmask
255.255.255.0 {
range 192.168.0.1 192.168.0.2;
}

host pacohost { hardware ethernet 00:00:21:E0:B9:35;
fixed-address 192.168.0.1;
}

host pilar { hardware ethernet 00:00:21:E0:B9:37;
fixed-address 192.168.0.2;
}

4 Ponerlo en marcha

/etc/init.d/dhcpd start

5 Otro ejemplo

--------------- Crear el fichero: /etc/dhcpd.conf
    server-identifier lx;
    subnet 192.168.1.0 netmask 255.255.255.0{

    range  192.168.1.21 192.168.1.30;

    option domain-name-servers 192.168.1.253, 192.168.1.252;
    option routers 192.168.1.254;

    host pc1{
    hardware ethernet 00:00:00:00:00:00;
    fixed-address 192.168.1.1;}

    host pc2{
    hardware ethernet 11:11:11:11:11:11;
    fixed-address 192.168.1.2;}

    }

Nota : La linea "range 192.168.1.21 192.168.1.30" es para cuando no tengas las MAC asigne una IP.

6 Ejemplo dhcp.conf

[frame=lines]

# /etc/dhcpd.conf
# Por Paco Aldarias
# 08/05/02
# Fichero de configuracion del servidor dhcp del IES JUAN DE GARAY
# El router q sale a internet esta en monopuesto.
# El servidor dhcp tiene tres tarjetas de red.

#***************** REGLAS ************************************************************
#A las aulas se les da las siguientes I.P.
#   - Alumnos: 172.17.aula.PC
#   - Profesor: 172.17.10.aula
#     Puerta Enlace: 172.17.0.1 (eth2)
#     Máscara: 255.255.240.0

#A los departamentos se les da las siguientes I.P.:
#   - 192.168.10.PC.
#     Puerta Enlace: 192.168.10.204 (eth1)
#     Máscara: 255.255.240.0

# La conexión a Internet por ADSL es :
#   - 217.127.172.247 / 255.255.255.192 (eth0)

# El router ADSL 3COM es:
#   - 217.127.172.193 / 255.255.255.192 (conecta con eth0)

# Nota: Para reiniciar sbin/service dhcpd restart

#*******************************************  INICIO   ************************************************
shared-network name{
option domain-name "garay.es";
option domain-name-servers 194.179.1.100, 192.224.52.26;



#****************************** eth0: ADSL ********************

subnet 217.127.172.247 netmask 255.255.255.255 {

#range 217.127.172.247 217.127.172.247;
host gateway { hardware ethernet 00:E0:7D:A3:F2:B7; fixed-address 217.127.172.247; }
}

#****************************** Eth1: Departamentos ********************
subnet 192.168.0.0 netmask 255.255.240.0 {

default-lease-time 600;
max-lease-time 7200;
option subnet-mask 255.255.240.0;
option broadcast-address 192.168.10.255;

option domain-name-servers  194.179.1.100, 192.224.52.26;
option domain-name "garay.departamentos.es";
option routers 192.168.10.204;
#range 192.168.1.1 192.168.15.254;

# Eth1.
host gateway192{
hardware ethernet 00:E0:7D:A3:F2:BD;
fixed-address 192.168.10.204; option routers 217.127.172.247;}

# MAQUINAS DE LA RED Eth1

# newton 200
# einstein 201
host gonzalo{hardware ethernet 00:E0:7D:A3:F2:8F;
fixed-address 192.168.10.202; }

host pep_portatil  {hardware ethernet 00:90:F5:0A:39:7B;
fixed-address 192.168.10.203; }

host director   {hardware ethernet 00:E0:7D:A3:F2:AA;
fixed-address 192.168.10.50;}

host secretario {hardware ethernet 00:20:18:31:01:49;
fixed-address 192.168.10.51; }


}


#****************************** Eth2: Aulas  ********************
subnet 172.17.0.0 netmask 255.255.240.0 {
#range 192.168.1.2 192.168.1.254;


default-lease-time 600;
max-lease-time 7200;
option subnet-mask 255.255.240.0;
option broadcast-address 172.17.255.255;

option domain-name-servers  194.179.1.100, 192.224.52.26;
option domain-name "garay.aulas.es";
option routers 172.17.0.1;

# A LA RED eth2
host gateway172 { hardware ethernet 00:E0:7D:A3:F2:B0;
fixed-address 172.17.0.1; option routers 217.127.172.247;}


# *************************** AULA 1
host lab1prof { hardware ethernet 00:50:FC:1E:77:24;
fixed-address 172.17.10.1; option routers 172.17.0.1;}

host lab1inf1 { hardware ethernet 00:4F:4E:04:C5:67;
fixed-address 172.17.1.1; option routers 172.17.0.1;}

host lab1inf2 { hardware ethernet 00:4F:4E:03:40:BB;
fixed-address 172.17.1.2; option routers 172.17.0.1;}

host lab1inf3 { hardware ethernet 00:4F:4E:03:8B:80;
fixed-address 172.17.1.3; option routers 172.17.0.1;}

# *************************** AULA 2
host lab2prof { hardware ethernet 00:01:0A:10:3E:58;
fixed-address 172.17.10.2; option routers 172.17.0.1;}

host lab2inf1 { hardware ethernet 00:C0:26:20:06:52;
fixed-address 172.17.2.1; option routers 172.17.0.1;}

host lab2inf2 { hardware ethernet 00:4F:4E:03:F7:49;
fixed-address 172.17.2.2; option routers 172.17.0.1;}

host lab2inf3 { hardware ethernet 00:50:FC:1E:6B:73;
fixed-address 172.17.2.3; option routers 172.17.0.1;}






# *************************** AULA 3
host lab3prof {hardware ethernet 00:01:0A:10:48:66;
fixed-address 172.17.10.3; option routers 172.17.0.1;}

host lab3inf1 {hardware ethernet 00:50:FC:1E:6B:1F;
fixed-address 172.17.3.1; option routers 172.17.0.1;}

host lab3inf2 {hardware ethernet 00:50:FC:1E:98:3E;
fixed-address 172.17.3.2; option routers 172.17.0.1;}



# *************************** AULA 4
host lab4prof { hardware ethernet 00:01:0A:10:3F:5D;
fixed-address 172.17.10.4; option routers 172.17.0.1;}

host lab4inf1 { hardware ethernet 00:01:0A:10:3E:70;
fixed-address 172.17.4.1; option routers 172.17.0.1;}

host lab4inf2 { hardware ethernet 00:01:0A:10:3E:0F;
fixed-address 172.17.4.2; option routers 172.17.0.1;}

host lab4inf3 { hardware ethernet 00:01:0A:10:3D:9F;
fixed-address 172.17.4.3; option routers 172.17.0.1;}


}
}


7 Utilidades

Para ver las ips locales. ifconfig -a.

Para ver todas las ips de una subred: nmap -sP 192.168.0.*

Para ver los puertos abiertos de una maquina: nmap -sS -O 10.0.0.2

Para que muestre la version: /usr/sbin/dhcpd -T

Para ver direccion fisica de la maquina local: /sbin/ifconfig

Para ver la mac de una ip: /sbin/arp -a 192.168.0.200 ? (192.168.0.200) at 00:20:EA:2D:B0:B5 [ether] on eth0

Para ver la mac de una ip y mas cosas : /sbin/arp -sS -O 192.168.0.200

Para resolver nombres o ips: nslookup 158.42.255.4

Saber los saltos: /usr/sbin/traceroute 158.42.255.4

Para saber el nombre del servidor del dominio: dig www.korbin.mypc.nu

Para saber los saltos: /usr/sbin/traceroute 194.179.1.100

8 bibilografia

  1. man dhcp
  2. http://www.linuxdoc.org/HOWTO/mini/DHCP/x369.html
  3. http://www.linux-mag.com/2000-04/networknirvana_01.html
  4. http://www.isc.org/products/DHCP/
  5. http://www.insflug.org/COMOs/DHCPd-Mini-Como/DHCPd-Mini-Como.html
  6. http://deportes.ole.com/personal/garzones/ddns-micro-como.html.

Índice de Materias

arp
7
nmap
7
nslookup
7
servidor hdcp
1

Sobre este documento...

Instalar un servidor dhcp

This document was generated using the LaTeX2 HTML translator Version 2K.1beta (1.48)

Copyright © 1993, 1994, 1995, 1996, Nikos Drakos, Computer Based Learning Unit, University of Leeds.
Copyright © 1997, 1998, 1999, Ross Moore, Mathematics Department, Macquarie University, Sydney.

The command line arguments were:
latex2html dhcp -no_subdir -split 0 -local_icons 1 -show_section_numbers -no_auto_link

The translation was initiated by Paco Aldarias on 2003-11-26


next_inactive up previous
Paco Aldarias 2003-11-26