Try   HackMD

Configurar tarjetes de xarxa en un servidor Ubuntu amb Netplan

En aquesta pràctica farem servir Netplan, que podeu trobar més informació a la seva pàgina web

Per començar anem al nostre servidor Ubuntu i introduim la comanda seguent per editar el arxiu de configuració

sudo vim /etc/netplan/*.yaml

Ens deuria de apareixer una finestra amb una estructura semblant a aquesta:

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 →

Aquí podem observar com només tenim configurat un adaptador de xarxa així que a continuació añadirem el que nosaltres volem configurar

Per la nostra pràctica añadirem el segon adaptado de xarxa que en el nostre cas és "enp2s0"

Añadim el nostre adaptador i desactivem el DHCP

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 →

Que es el DHCP?

.
El servei DHCP es un servei que s'encarrega de donar-nos IP automaticament
Més informació de com fer un Servidor DHCP

A continuació introduirem les adreçes que volem per la nostra xarxa junt amb la cantitat de bits que te la nostra máscara

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 →

Informació sobre la IP i la màscara

.
Es important que la sintaxi estigui exactament igual, exepte la IP i la màscara que heu de canviarles per les que vosaltres volgueu.

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 →
Recordeu possar el guió amb un espai
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 →

  • Exemples de màscara
Màscara Bits
255.0.0.0 /8
255.255.0.0 /16
255.255.255.0 /24

En el meu cas he utilitzat la /24

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ÓN IMPORTANTS ELS ESPAIS Y QUE ESTIGUI A LA MATEIXA ALÇADA
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 guardada la configuració amb :x escriurem la comanda:

sudo netplan try

Aquesta comanda comproba que la configuració sigui correcte i en aquest cas ens mostra aquest missatge:

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 →

Per aplicar el canvi apretarem el INTRO o ENTER


Cualsevol dubte