Try   HackMD

Com crear un servidor DHCP en Ubuntu ( Pràctica )

Tot el següent aquesta fet en el servidor Ubuntu

sudo apt-get update

Ús

.

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →
Primer actualitzem el apt-get amb el comando:
Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

sudo apt-get install isc-dhcp-server

Ús

.

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →
Després instalem el servidor DHCP amb la seguent comanda
Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

sudo vim /etc/dhcp/dhcpd.conf

Ús

.

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →
Serveix per asignar la tarjeta de xarxa que vols que rebi les peticions
Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

Dintre del arxiu "dhcpd.conf" busca un apartat que comenci amb ➜ A slightly different…

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

Significat de las linias
  • Image Not Showing Possible Reasons
    • The image file may be corrupted
    • The server hosting the image is unavailable
    • The image path is incorrect
    • The image format is not supported
    Learn More →
    Primera Línia ➜ subnet IP netmask MASCARA
    Primera Ip = Defineix la xarxa on estara el DHCP server
    Máscara = Máscara de la xarxa que utilitzarem

  • Image Not Showing Possible Reasons
    • The image file may be corrupted
    • The server hosting the image is unavailable
    • The image path is incorrect
    • The image format is not supported
    Learn More →
    Segona Línia ➜ range IP IP
    Rang de ips que vols designar per els usuaris que demanin IP (dintre de la teva xarxa)

  • Image Not Showing Possible Reasons
    • The image file may be corrupted
    • The server hosting the image is unavailable
    • The image path is incorrect
    • The image format is not supported
    Learn More →
    Tercera Línia ➜ option domain-name-servers
    Servidors DNS que vols asignar a l'hora de fer DHCP, en cas de que vulguis 2 servidors separals amb una "," com en la fotografi de dalt

  • Image Not Showing Possible Reasons
    • The image file may be corrupted
    • The server hosting the image is unavailable
    • The image path is incorrect
    • The image format is not supported
    Learn More →
    Cuarta Línia ➜ option domain-name
    Nom que li volem donar al nostre domini, en la nostre pràctica no cal així que podem col·locar el nostre nom amb ".com"

  • Image Not Showing Possible Reasons
    • The image file may be corrupted
    • The server hosting the image is unavailable
    • The image path is incorrect
    • The image format is not supported
    Learn More →
    Cinquena Línia ➜ option subnet-mask
    Mascara de xarxa que volem asignar a la nostre subxarxa, en el nostre cas, 255.255.255.0

  • Image Not Showing Possible Reasons
    • The image file may be corrupted
    • The server hosting the image is unavailable
    • The image path is incorrect
    • The image format is not supported
    Learn More →
    Sisena Línia ➜ option routers
    En aquesta activitat no es esencial aquest camp així que asinarem la Ip del servidor

  • Image Not Showing Possible Reasons
    • The image file may be corrupted
    • The server hosting the image is unavailable
    • The image path is incorrect
    • The image format is not supported
    Learn More →
    Setena Línia ➜ option broadcast-address
    En aquesta linia possem la IP broadcast que volem per les IPs que donem

  • Image Not Showing Possible Reasons
    • The image file may be corrupted
    • The server hosting the image is unavailable
    • The image path is incorrect
    • The image format is not supported
    Learn More →
    Image Not Showing Possible Reasons
    • The image file may be corrupted
    • The server hosting the image is unavailable
    • The image path is incorrect
    • The image format is not supported
    Learn More →
    Últimes Línies ➜ default-lease-time, max-lease-time
    Aquests caps els deixarem per defecte ja que son els temps per al servidor

sudo vim /etc/default/isc-dhcp-server

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

Ús

En la primera opció has de posar la targeta de xarxa que vols que rebi les peticions per el protocol IPv4, en el nostre cas “enp2s0”

sudo systemctl restart isc-dhcp-server

Ús

Finalment, reiniciem el sistema isc-dhcp-server amb la comanda de dalt amb la funció systemctl

Comanda OPCIONAL per mirar el estat del servei

sudo systemctl status isc-dhcp-server

Resultat correcte

APARTAT DEL CLIENT

Per a que ens asigni una direcció IP amb el nostre client ahorem de fer els seguent pasos

Primer apaga el adaptador de xarxa i entra a la configuració

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →


I dintre de la categoria IPv4 posem de mètode el "Automàtic (DHCP)" i deixem el demés com ens ve predeterminat

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →


Una vegada configurat encenem la notre tarjeta de xarxa

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

Enrecordat de APLICAR els canvis quan el configuris

Si ho hem fet tot bé hauria d'apareixer connectat en qüestió de segons

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

Si ens apareix connectat podem introduir la comanda ip a en el nostre terminal per comprovar que ens ha asignat una IP dintre del rang

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →


Cualsevol dubte