Alberto Garcia

🪢 – Connectivitat remota

Connectivitat remota Accés SSH del professorat a tots els portàtils de l’equip Click Accés SSH amb claus entre els membres de l’equip Click Accés remot des de casa al portàtil de l’aula Click Accés remot des de l’aula a l’ordinador de casa Click

Pujada al cloud de vagrant de les boxes creades

Pujada al cloud de vagrant de les boxes creades Per pujar las boxes al claud de vagrant, usarem la pagina https://portal.cloud.hashicorp.com. Explicacio + debian Una vegada de la pàgina i iniciada la sessió anirem al nostre projecte pre-creat i entrarem en l’opció Vagrant Registry Dintre de l’opció clicarem a Create a box Registry i començarem el procés de registrar el nostre box. El primer pas és assignar el nom, i la descripció per aquest grup de registre, on dintre es on registrarem les box. Ara clicarem a Create Box Aquesta pestanya ja configurarem la vagrant box, el primer camp serà el nom d’abans + el nom del box, després configurarem si la volem que sigui pública o privada. En la següent part assignarem el nom de la verso que és la nostra box. Ara haurem de configurar la pujada, afegir la informació necessària que ens diu la pàgina com el nom del proveïdor, l’arquitectura, l’arxiu de la box, etc. Aquesta pestanya ja configurarem la vagrant box, el primer camp serà el nom d’abans + el nom del box, després configurarem si la volem que sigui pública o privada. Rocky Ubuntu w 2k19 w10 Client Una vegada de la pàgina i iniciada la sessió anirem al nostre projecte pre-creat i entrarem en l’opció Vagrant Registry Dintre de l’opció clicarem a Create a box Registry i començarem el procés de registrar el nostre box. El primer pas és assignar el nom, i la descripció per aquest grup de registre, on dintre es on registrarem les box. Ara clicarem a Create Box Aquesta pestanya ja configurarem la vagrant box, el primer camp serà el nom d’abans + el nom del box, després configurarem si la volem que sigui pública o privada. En la següent part assignarem el nom de la verso que és la nostra box. Ara haurem de configurar la pujada, afegir la informació necessària que ens diu la pàgina com el nom del proveïdor, l’arquitectura, l’arxiu de la box, etc. Aquesta pestanya ja configurarem la vagrant box, el primer camp serà el nom d’abans + el nom del box, després configurarem si la volem que sigui pública o privada.

⚙️ – Eines d’administració

Eines d’administració Adaptar les MVs perquè puguin ser compatibles amb vagrant Click Configuració accés remot (SSH i RDP) a totes les MV Click Protocol d’arrencada de totes les MVs des de CLI Click Habilitar els serveis de connexió remota necessaris a totes les MVs Click Creació de boxes de vagrant de cada una de les 5 MVs creades Click Pujada al cloud de vagrant de les boxes creades Click Instal·lació de Chocolatey a les MVs Windows Click

Màquines virtuals

Màquines virtuals Creació d’una MV amb W10 Click Creació d’una MV amb W2k19 Click Creació d’una MV amb Rocky Linux Click Creació d’una MV amb Ubuntu MATE Click Emportació en format OVA de cada MV Click Còpia en un USB de totes les OVAs exportades Click

Accés SSH del professorat a tots els portàtils de l’equip

Accés SSH del professorat a tots els portàtils de l’equip Perquè el professor tingui accés via SSH als nostres ordinadors, hem de passar-li al professor les rutes que ha de fer la seva màquina fins a les nostres. Membre Subred IP Pasarela Ip FIxa Alberto 192.168.100.0 192.168.100.2 Hector 192.168.100.192 192.168.100.194 Adri 192.168.100.160 192.168.100.162 Torre Principal 172.25.205.12

Configuració accés remot (SSH i RDP) a totes les MV

Configuració accés remot (SSH i RDP) a totes les MV Rocky El primer que farem serà instal·lar el SSH amb la següent comanda [root@localhost super]dnf install -y openssh-server Rocky Linux 9 – BaseOS 4.3 MB/s | 2.5 MB 00:00 Rocky Linux 9 – AppStream 11 MB/s | 9.5 MB 00:00 Rocky Linux 9 – Extras 43 kB/s | 17 kB 00:00 Package openssh-server-8.7p1-38.el9.x86_64 is already installed. Dependencies resolved. ================================================================================ Package Arch Version Repository Size ================================================================================ Upgrading: openssh x86_64 8.7p1-45.el9.rocky.0.1 baseos 453 k openssh-clients x86_64 8.7p1-45.el9.rocky.0.1 baseos 708 k openssh-server x86_64 8.7p1-45.el9.rocky.0.1 baseos 455 k Transaction Summary ================================================================================ Upgrade 3 Packages Total download size: 1.6 M Downloading Packages: (1/3): openssh-8.7p1-45.el9.rocky.0.1.x86_64.rp 2.6 MB/s | 453 kB 00:00 (2/3): openssh-server-8.7p1-45.el9.rocky.0.1.×8 2.5 MB/s | 455 kB 00:00 (3/3): openssh-clients-8.7p1-45.el9.rocky.0.1.x 3.3 MB/s | 708 kB 00:00 ——————————————————————————– Total 3.8 MB/s | 1.6 MB 00:00 Rocky Linux 9 – BaseOS 1.7 MB/s | 1.7 kB 00:00 Importing GPG key 0x350D275D: Userid : "Rocky Enterprise Software Foundation – Release key 2022 <releng@rockylinux.org>" Fingerprint: 21CB 256A E16F C54C 6E65 2949 702D 426D 350D 275D From : /etc/pki/rpm-gpg/RPM-GPG-KEY-Rocky-9 Key imported successfully Running transaction check Transaction check succeeded. Running transaction test Transaction test succeeded. Running transaction Preparing : 1/1 Running scriptlet: openssh-8.7p1-45.el9.rocky.0.1.x86_64 1/6 Upgrading : openssh-8.7p1-45.el9.rocky.0.1.x86_64 1/6 Running scriptlet: openssh-server-8.7p1-45.el9.rocky.0.1.x86_64 2/6 Upgrading : openssh-server-8.7p1-45.el9.rocky.0.1.x86_64 2/6 Running scriptlet: openssh-server-8.7p1-45.el9.rocky.0.1.x86_64 2/6 Upgrading : openssh-clients-8.7p1-45.el9.rocky.0.1.x86_64 3/6 Running scriptlet: openssh-clients-8.7p1-45.el9.rocky.0.1.x86_64 3/6 Running scriptlet: openssh-clients-8.7p1-38.el9.x86_64 4/6 Cleanup : openssh-clients-8.7p1-38.el9.x86_64 4/6 Running scriptlet: openssh-server-8.7p1-38.el9.x86_64 5/6 Cleanup : openssh-server-8.7p1-38.el9.x86_64 5/6 Running scriptlet: openssh-server-8.7p1-38.el9.x86_64 5/6 Cleanup : openssh-8.7p1-38.el9.x86_64 6/6 Running scriptlet: openssh-8.7p1-38.el9.x86_64 6/6 Verifying : openssh-8.7p1-45.el9.rocky.0.1.x86_64 1/6 Verifying : openssh-8.7p1-38.el9.x86_64 2/6 Verifying : openssh-server-8.7p1-45.el9.rocky.0.1.x86_64 3/6 Verifying : openssh-server-8.7p1-38.el9.x86_64 4/6 Verifying : openssh-clients-8.7p1-45.el9.rocky.0.1.x86_64 5/6 Verifying : openssh-clients-8.7p1-38.el9.x86_64 6/6 Upgraded: openssh-8.7p1-45.el9.rocky.0.1.x86_64 openssh-clients-8.7p1-45.el9.rocky.0.1.x86_64 openssh-server-8.7p1-45.el9.rocky.0.1.x86_64 Complete! I per finalitzar habilitarem el servell en l’arrancada del sistema amb la comanda  [root@localhost super] systemctl enable sshd Ubuntu El primer que farem serà instal·lar el SSH amb la següent comanda super@ubuntu:~$ sudo apt install -y openssh-server Reading package lists… Done Building dependency tree… Done Reading state information… Done The following additional packages will be installed: ncurses-term openssh-client openssh-sftp-server ssh-import-id Suggested packages: keychain libpam-ssh monkeysphere ssh-askpass molly-guard The following NEW packages will be installed: ncurses-term openssh-server openssh-sftp-server ssh-import-id The following packages will be upgraded: openssh-client 1 upgraded, 4 newly installed, 0 to remove and 277 not upgraded. Need to get 1,738 kB of archives. After this operation, 6,743 kB of additional disk space will be used. Get:1 http://es.archive.ubuntu.com/ubuntu noble-updates/main amd64 openssh-client amd64 1:9.6p1-3ubuntu13.14 [906 kB] Get:2 http://es.archive.ubuntu.com/ubuntu noble-updates/main amd64 openssh-sftp-server amd64 1:9.6p1-3ubuntu13.14 [37.3 kB] Get:3 http://es.archive.ubuntu.com/ubuntu noble-updates/main amd64 openssh-server amd64 1:9.6p1-3ubuntu13.14 [510 kB] Get:4 http://es.archive.ubuntu.com/ubuntu noble/main amd64 ncurses-term all 6.4+20240113-1ubuntu2 [275 kB] Get:5 http://es.archive.ubuntu.com/ubuntu noble-updates/main amd64 ssh-import-id all 5.11-0ubuntu2.24.04.1 [10.1 kB] Fetched 1,738 kB in 0s (4,752 kB/s) Preconfiguring packages … (Reading database … 250147 files and directories currently installed.) Preparing to unpack …/openssh-client_1%3a9.6p1-3ubuntu13.14_amd64.deb … Unpacking openssh-client (1:9.6p1-3ubuntu13.14) over (1:9.6p1-3ubuntu13.11) … Selecting previously unselected package openssh-sftp-server. Preparing to unpack …/openssh-sftp-server_1%3a9.6p1-3ubuntu13.14_amd64.deb … Unpacking openssh-sftp-server (1:9.6p1-3ubuntu13.14) … Selecting previously unselected package openssh-server. Preparing to unpack …/openssh-server_1%3a9.6p1-3ubuntu13.14_amd64.deb … Unpacking openssh-server (1:9.6p1-3ubuntu13.14) … Selecting previously unselected package ncurses-term. Preparing to unpack …/ncurses-term_6.4+20240113-1ubuntu2_all.deb … Unpacking ncurses-term (6.4+20240113-1ubuntu2) … Selecting previously unselected package ssh-import-id. Preparing to unpack …/ssh-import-id_5.11-0ubuntu2.24.04.1_all.deb … Unpacking ssh-import-id (5.11-0ubuntu2.24.04.1) … Setting up openssh-client (1:9.6p1-3ubuntu13.14) … Setting up ssh-import-id (5.11-0ubuntu2.24.04.1) … Setting up ncurses-term (6.4+20240113-1ubuntu2) … Setting up openssh-sftp-server (1:9.6p1-3ubuntu13.14) … Setting up openssh-server (1:9.6p1-3ubuntu13.14) … Creating config file /etc/ssh/sshd_config with new version Created symlink /etc/systemd/system/sockets.target.wants/ssh.socket → /usr/lib/s ystemd/system/ssh.socket. Created symlink /etc/systemd/system/ssh.service.requires/ssh.socket → /usr/lib/s ystemd/system/ssh.socket. Processing triggers for man-db (2.12.0-4build2) … Processing triggers for ufw (0.36.2-6) … I per finalitzar habilitarem el servell en l’arrancada del sistema amb la comanda  super@ubuntu:~/Desktop$ sudo systemctl enable ssh Synchronizing state of ssh.service with SysV service script with /usr/lib/systemd/systemd-sysv-install. Executing: /usr/lib/systemd/systemd-sysv-install enable ssh Created symlink /etc/systemd/system/sshd.service → /usr/lib/systemd/system/ssh.service. Created symlink /etc/systemd/system/multi-user.target.wants/ssh.service → /usr/lib/systemd/system/ssh.service. Debian El primer que farem serà instal·lar el SSH amb la següent comand debian1@debian:/home/debian1 sudo apt install openssh-server Hit:1 http://deb.debian.org/debian bookworm InRelease Get:2 http://security.debian.org/debian-security bookworm-security InRelease [48.0 kB] Get:3 http://deb.debian.org/debian bookworm-updates InRelease [55.4 kB] Get:4 http://security.debian.org/debian-security bookworm-security/main Sources [161 kB] Get:5 http://security.debian.org/debian-security bookworm-security/main amd64 Packages [281 kB] Get:6 http://security.debian.org/debian-security bookworm-security/main Translation-en [170 kB] Fetched 715 kB in 0s (2101 kB/s) Reading package lists… Done Building dependency tree… Done Reading state information… Done 3 packages can be upgraded. Run 'apt list –upgradable' to see them. Reading package lists… Done Building dependency tree… Done Reading state information… Done openssh-server is already the newest version (1:9.2p1-2+deb12u7). I per finalitzar habilitarem el servell en l’arrancada del sistema amb la comanda  debian1@debian:/home/debian1 sudo systemctl enable ssh Windows 10 Server En Windows normalment no s’utilitza el SSH, ja que el que s’utilitza és el rdp, que per activar-ho i tindre accés mitjançant el RDP, per activar el rdp el primer que farem serà anar a la configuració de Windows hi ha system. Una vegada en system entrarem en remote desktop, i clicarem en l’única opció, de Enable Remote Desktop I quan cliquem dintre s’obrira aquest menu blau on clicarem confirm i ja estaria activat. Però també es pot instal·lar el SSH en cas que el necessitis, per fer-ho el primer que farem serà obrir PowerShell i executar les comandes. Aquesta comanda serà per fer la instal·lació de SSH Add-WindowsCapability -Online -Name OpenSSH.Server~~~~0.0.1.0 Resultat de la comanda Path : Online : True RestartNeeded : False Ara el que farem serà habilitar el servei, i habilitar de manera automàtica,. Start-Service sshd Set-Service -Name sshd -StartupType 'Automatic' I per finalitzar afegirem una nova regla al firewall, que el que fa aquesta regla de firewall és permetre que la màquina Windows accepti connexions SSH entrants pel port 22, ja que per defecte el firewall de Windows les bloqueja. New-NetFirewallRule -Name sshd -DisplayName 'OpenSSH Server' -Enabled True -Direction Inbound -Protocol TCP -Action Allow -LocalPort 22 Window 10 Client Server En Windows normalment no s’utilitza el SSH, ja que el que s’utilitza és el rdp, que per activar-ho i tindre accés mitjançant el RDP, per activar el rdp el primer que farem serà anar a la configuració de Windows hi ha system. … Read more

Creació de boxes de vagrant de cada una de les 5 MVs creades

Creació de boxes de vagrant de cada una de les 5 MVs creades Ubuntu [09:08:38][Documents][agarcia@agarciaVBoxManage import ubuntu.ova 0%…10%…20%…30%…40%…50%…60%…70%…80%…90%…100% Interpreting /home/agarcia/Documents/ubuntu.ova… OK. Disks: vmdisk1 26843545600 -1 http://www.vmware.com/interfaces/specifications/vmdk.html#streamOptimized ubuntu-disk001.vmdk -1 -1 Virtual system 0: 0: Suggested OS type: "Ubuntu_64" (change with "–vsys 0 –ostype <type>"; use "list ostypes" to list all possible values) 1: Suggested VM name "ubuntu" (change with "–vsys 0 –vmname <name>") 2: Suggested VM group "/" (change with "–vsys 0 –group <group>") 3: Suggested VM settings file name "/home/agarcia/VirtualBox VMs/ubuntu/ubuntu.vbox" (change with "–vsys 0 –settingsfile <filename>") 4: Suggested VM base folder "/home/agarcia/VirtualBox VMs" (change with "–vsys 0 –basefolder <path>") 5: Number of CPUs: 4 (change with "–vsys 0 –cpus <n>") 6: Guest memory: 4096 MB (change with "–vsys 0 –memory <MB>") 7: Sound card (appliance expects "", can change on import) (disable with "–vsys 0 –unit 7 –ignore") 8: USB controller (disable with "–vsys 0 –unit 8 –ignore") 9: Network adapter: orig NAT, config 3, extra slot=0;type=NAT 10: CD-ROM (disable with "–vsys 0 –unit 10 –ignore") 11: IDE controller, type PIIX4 (disable with "–vsys 0 –unit 11 –ignore") 12: IDE controller, type PIIX4 (disable with "–vsys 0 –unit 12 –ignore") 13: SATA controller, type AHCI (disable with "–vsys 0 –unit 13 –ignore") 14: Hard disk image: source image=ubuntu-disk001.vmdk, target path=ubuntu-disk001.vmdk, controller=13;port=0 (change target path with "–vsys 0 –unit 14 –disk path"; change controller with "–vsys 0 –unit 14 –controller <index>"; change controller port with "–vsys 0 –unit 14 –port <n>"; disable with "–vsys 0 –unit 14 –ignore") 0%…10%…20%…30%…40%…50%…60%…70%…80%…90%…100% Successfully imported the appliance. [09:16:44][Documents][agarcia@agarcia]-$ vagrant package –base "ubuntu" –output ubuntu.box ==> ubuntu: Exporting VM… ==> ubuntu: Compressing package to: /home/agarcia/Documents/ubuntu.box [09:28:17][Documents][agarcia@agarcia]-$ vagrant box add ubuntu.box ubuntu.box ==> box: Box file was not detected as metadata. Adding it directly… ==> box: Adding box 'ubuntu.box' (v0) for provider: (amd64) box: Unpacking necessary files from: file:///home/agarcia/Documents/ubuntu.box ==> box: Successfully added box 'ubuntu.box' (v0) for '(amd64)'! Debian [09:23:06][Documents][agarcia@localhost]-$ VBoxManage import mvdebian.ova 0%…10%…20%…30%…40%…50%…60%…70%…80%…90%…100% Interpreting /home/agarcia/Documents/mvdebian.ova… OK. Disks: vmdisk1 21474836480 -1 http://www.vmware.com/interfaces/specifications/vmdk.html#streamOptimized mvdebian-disk001.vmdk -1 -1 Virtual system 0: 0: Suggested OS type: "Debian_64" (change with "–vsys 0 –ostype <type>"; use "list ostypes" to list all possible values) 1: Suggested VM name "mvdebian" (change with "–vsys 0 –vmname <name>") 2: Suggested VM group "/" (change with "–vsys 0 –group <group>") 3: Suggested VM settings file name "/home/agarcia/VirtualBox VMs/mvdebian/mvdebian.vbox" (change with "–vsys 0 –settingsfile <filename>") 4: Suggested VM base folder "/home/agarcia/VirtualBox VMs" (change with "–vsys 0 –basefolder <path>") 5: Number of CPUs: 1 (change with "–vsys 0 –cpus <n>") 6: Guest memory: 2048 MB (change with "–vsys 0 –memory <MB>") 7: Sound card (appliance expects "", can change on import) (disable with "–vsys 0 –unit 7 –ignore") 8: USB controller (disable with "–vsys 0 –unit 8 –ignore") 9: Network adapter: orig Bridged, config 3, extra slot=0;type=Bridged 10: CD-ROM (disable with "–vsys 0 –unit 10 –ignore") 11: IDE controller, type PIIX4 (disable with "–vsys 0 –unit 11 –ignore") 12: IDE controller, type PIIX4 (disable with "–vsys 0 –unit 12 –ignore") 13: SATA controller, type AHCI (disable with "–vsys 0 –unit 13 –ignore") 14: Hard disk image: source image=mvdebian-disk001.vmdk, target path=mvdebian-disk001.vmdk, controller=13;port=0 (change target path with "–vsys 0 –unit 14 –disk path"; change controller with "–vsys 0 –unit 14 –controller <index>"; change controller port with "–vsys 0 –unit 14 –port <n>"; disable with "–vsys 0 –unit 14 –ignore") 0%…10%…20%…30%…40%…50%…60%…70%…80 [09:28:44][Documents][agarcia@localhost]-$ vagrant package –base "mvdebian" –output debian.box ==> mvdebian: Exporting VM… ==> mvdebian: Compressing package to: /home/agarcia/Documents/debian.box [09:31:24][Documents][agarcia@localhost]-$ vagrant box add debian.box debian.box ==> box: Box file was not detected as metadata. Adding it directly… ==> box: Adding box 'debian.box' (v0) for provider: (amd64) box: Unpacking necessary files from: file:///home/agarcia/Documents/debian.box ==> box: Successfully added box 'debian.box' (v0) for '(amd64)'! Rocky [09:33:29][Documents][agarcia@localhost]-$ VBoxManage import rocky.ova 0%…10%…20%…30%…40%…50%…60%…70%…80%…90%…100% Interpreting /home/agarcia/Documents/rocky.ova… OK. Disks: vmdisk1 21474836480 -1 http://www.vmware.com/interfaces/specifications/vmdk.html#streamOptimized rocky1-disk001.vmdk -1 -1 Virtual system 0: 0: Suggested OS type: "RedHat_64" (change with "–vsys 0 –ostype <type>"; use "list ostypes" to list all possible values) 1: Suggested VM name "rocky1" (change with "–vsys 0 –vmname <name>") 2: Suggested VM group "/" (change with "–vsys 0 –group <group>") 3: Suggested VM settings file name "/home/agarcia/VirtualBox VMs/rocky1/rocky1.vbox" (change with "–vsys 0 –settingsfile <filename>") 4: Suggested VM base folder "/home/agarcia/VirtualBox VMs" (change with "–vsys 0 –basefolder <path>") 5: Number of CPUs: 2 (change with "–vsys 0 –cpus <n>") 6: Guest memory: 2048 MB (change with "–vsys 0 –memory <MB>") 7: Sound card (appliance expects "", can change on import) (disable with "–vsys 0 –unit 7 –ignore") 8: USB controller (disable with "–vsys 0 –unit 8 –ignore") 9: Network adapter: orig Bridged, config 3, extra slot=0;type=Bridged 10: Network adapter: orig Bridged, config 3, extra slot=1;type=Bridged 11: CD-ROM (disable with "–vsys 0 –unit 11 –ignore") 12: IDE controller, type PIIX4 (disable with "–vsys 0 –unit 12 –ignore") 13: IDE controller, type PIIX4 (disable with "–vsys 0 –unit 13 –ignore") 14: SATA controller, type AHCI (disable with "–vsys 0 –unit 14 –ignore") 15: Hard disk image: source image=rocky1-disk001.vmdk, target path=rocky1-disk001.vmdk, controller=14;port=0 (change target path with "–vsys 0 –unit 15 –disk path"; change controller with "–vsys 0 –unit 15 –controller <index>"; change controller port with "–vsys 0 –unit 15 –port <n>"; disable with "–vsys 0 –unit 15 –ignore") 0%…10%…20%…30%…40%…50%…60%…70%…80%…90%…100% Successfully imported the appliance. [09:35:12][Documents][agarcia@localhost]-$ vagrant package –base "rocky1" –output rocky.box ==> rocky1: Exporting VM… ==> rocky1: Compressing package to: /home/agarcia/Documents/rocky.box [09:36:46][Documents][agarcia@localhost]-$ vagrant box add rocky.box rocky.box ==> box: Box file was not detected as metadata. Adding it directly… ==> box: Adding box 'rocky.box' (v0) for provider: (amd64) box: Unpacking necessary files from: file:///home/agarcia/Documents/rocky.box ==> box: Successfully added box 'rocky.box' (v0) for '(amd64)'! [09:36:46][Documents][agarcia@localhost]-$ vagrant box add rocky.box rocky.box ==> box: Box file was not detected as metadata. Adding it directly… ==> box: Adding box 'rocky.box' (v0) for provider: (amd64) box: Unpacking necessary files from: file:///home/agarcia/Documents/rocky.box ==> box: Successfully added box 'rocky.box' (v0) for '(amd64)'! W10 Client [09:42:06][Documents][agarcia@localhost]-$ VBoxManage import w10client.ova 0%…10%…20%…30%…40%…50%…60%…70%…80%…90%…100% Interpreting /home/agarcia/Documents/w10client.ova… OK. Disks: vmdisk1 53687091200 -1 http://www.vmware.com/interfaces/specifications/vmdk.html#streamOptimized w10 client-disk001.vmdk -1 -1 Virtual system 0: 0: Suggested OS type: "Windows10_64" (change with "–vsys 0 –ostype <type>"; use "list ostypes" to list all possible … Read more

Adaptar les MVs perquè puguin ser compatibles amb vagrant

Adaptacio de virtualBox a vagrant Adaptar les MVs perquè puguin ser compatibles amb vagrant El primer que farem serà crear la carpeta del projecte mkdir vagrant cd vagrant vagrant init nombre_box Exemple del resultat de la comanda. [12:07:53][~][agarcia@localhost]-$ mkdir rocky_vagrant cd rocky_vagrant vagrant init rocky A `Vagrantfile` has been placed in this directory. You are now ready to `vagrant up` your first virtual environment! Please read the comments in the Vagrantfile as well as documentation on `vagrantup.com` for more information on using Vagrant. Ara ja començarem amb el procés , amb aquesta comanda revisarem la llista de màquines que tenim en VirtualBox, per després passar-les a box i afegir-les a les llistes de vagrant. VBoxManage list vms Exemple del resultat de la comanda. [09:36:04][Documents][agarcia@localhost]-$ VBoxManage list vms "rocky" {6d47e39a-b2d4-4081-9afc-1b33a5e6ee84} En aquest punt transformarem la MV de VirtualBox a un .box de vagrant, per fer-ho ho farem amb aquesta comanda i canviant el Nom_VM pel nom que ens va donar l’anterior comanda, i on posa nom_box posarem el nom que vulguem per la nostra .box vagrant package –base "Nom_VM" –output nom_box.box Exemple del resultat de la comanda. “Aquest procés pot tardar una mica depèn de la mida de la MV” [09:36:09][Documents][agarcia@localhost]-$ vagrant package –base "rocky" –output rocky.box ==> rocky: Exporting VM… ==> rocky: Compressing package to: /home/agarcia/Documents/rocky.box Una vegada creada la .box haurem d’afegir-la a vagant, per fer-ho serà amb aquesta comanda, en nom_box1 posarem el nom de la nostra MV.box anteriorment creada, i en nom_box2 serà el nom el qual és la MV es guardarà per utilitzar-la més endavant (pot ser el mateix nom si vols). vagrant box add nom_box1 nomb_box2.box Exemple del resultat de la comanda. [09:50:31][Documents][agarcia@localhost]-$ vagrant box add rocky rocky.box ==> box: Box file was not detected as metadata. Adding it directly… ==> box: Adding box 'rocky' (v0) for provider: (amd64) box: Unpacking necessary files from: file:///home/agarcia/Documents/rocky.box ==> box: Successfully added box 'rocky' (v0) for '(amd64)'! Ara configurarem l’arxiu vagrant previament crea, dintra d’aquest arxiu es on es configuraran cada MV de vagrant que volguem crear, per configuraro, aurem de estar dintre de la carpeta i executar la seguent comanda  vi Vagrantfile Exemple del resultat de la comanda. Ara dintre d’aquest arxiu, pegarem aquesta configuració “predeterminada” i canviarem el Nom x pel qual es necessiti. Vagrant.configure("2") do |config| config.vm.define "NOMBRE_VM" do |vm1| vm1.vm.box = "NOMBRE_VM" vm1.vm.provider "virtualbox" do |vb| vb.name = "NOMBRE_VM" vb.memory = "2048" vb.cpus = 2 end end Una vegada tot configurat el ultim pas es executar la maquina, que es fara la seguent comanda i ja es obrira la Maquina virtual en virtualbox. vagrant up nom_mv Exemple del resultat de la comanda. [08:40:16][test][agarcia@agarcia]-$ vagrant up debian Bringing machine 'debian' up with 'virtualbox' provider… ==> debian: Importing base box 'debian'… ==> debian: Matching MAC address for NAT networking… ==> debian: Setting the name of the VM: MV_DEBIAN ==> debian: Clearing any previously set network interfaces… ==> debian: Preparing network interfaces based on configuration… debian: Adapter 1: nat debian: Adapter 2: bridged ==> debian: Forwarding ports… debian: 22 (guest) => 2222 (host) (adapter 1) ==> debian: Running 'pre-boot' VM customizations… ==> debian: Booting VM… ==> debian: Waiting for machine to boot. This may take a few minutes… debian: SSH address: 127.0.0.1:2222 debian: SSH username: vagrant debian: SSH auth method: private key debian: debian: Vagrant insecure key detected. Vagrant will automatically replace debian: this with a newly generated keypair for better security. debian: debian: Inserting generated public key within guest… debian: Removing insecure key from the guest if it's present… debian: Key inserted! Disconnecting and reconnecting using new SSH key… ==> debian: Machine booted and ready! ==> debian: Checking for guest additions in VM… debian: The guest additions on this VM do not match the installed version of debian: VirtualBox! In most cases this is fine, but in rare cases it can debian: prevent things such as shared folders from working properly. If you see debian: shared folder errors, please make sure the guest additions within the debian: virtual machine match the version of VirtualBox you have installed on debian: your host and reload your VM. debian: debian: Guest Additions Version: 6.0.0 r127566 debian: VirtualBox Version: 7.2 ==> debian: Configuring and enabling network interfaces… ==> debian: Mounting shared folders… debian: /home/agarcia/Documents/test => /vagrant Instalacio Guess Additions Abans de poder executar res, hem d’indicar a VirtualBox que insereixi el CD virtual on hi ha els instal·ladors de les Guest Additions.Això és un pas manual i es fa des de la finestra de la màquina virtual, a la part superior del menú:Devices → Insert Guest Additions CD image…Aquesta acció munta un CD virtual dins de la nostra màquina virtual  com si haguéssim introduït un CD físic amb els controladors. Aquests controladors ja venen inclosos amb VirtualBox; simplement hem d’indicar que s’insereixin en aquesta màquina virtual. vagrant@debian:~$ cd /media/cdrom Ara que VirtualBox ha inserit el CD virtual amb els drivers, hem d’entrar a la carpeta on s’ha muntat el disc dins de Debian. Aquí és on es troben els fitxers necessaris per instal·lar les Guest Additions. Aquest script compila i instal·la els mòduls del kernel perquè la màquina virtual pugui tenir integració completa amb VirtualBox, com ara resolució dinàmica, carpetes compartides i clipboard compartit. vagrant@debian:/media/cdrom$ sudo sh VBoxLinuxAdditions.run Després de la instal·lació, els mòduls carregats no s’activen fins que el sistema es reinicia. Amb aquest reinici la màquina virtual  ja arrencarà amb les Guest Additions habilitades. vagrant@debian:/media/cdrom$ sudo reboot Un cop reiniciada la màquina, ja té les Guest Additions funcionant correctament i la integració amb VirtualBox és completa (resolució automàtica, carpetes compartides i clipboard compartit). Adaptar les MVs perquè puguin ser compatibles amb vagrant El primer que farem serà crear la carpeta del projecte mkdir vagrant cd vagrant vagrant init nombre_box Exemple del resultat de la comanda. [12:07:53][~][agarcia@localhost]-$ mkdir rocky_vagrant cd rocky_vagrant vagrant init rocky A `Vagrantfile` has been placed in this directory. You are now ready to `vagrant up` your first virtual environment! Please read the comments in the Vagrantfile as well as documentation on `vagrantup.com` for more … Read more

Laboratori de xarxa

Laboratori de xarxa Configuració d’un servidor DHCP Click Configuració de la pasarel·la de xarxa Click Adreçament fixat per MAC en el DHCP Click Configuració automatitzada d’enrutament Click Instal·lació de SO lliure Click Adreçament intern Click Configuració de VLANs     Click Mapa de xarxa lògic Click

Muntatge físic de la illa

Muntatge físic de la illa Assamblatge d’una torre Connexió de 2 targetes de xarxa Creació del cablejat de l’illa Habilitar arrencada per PXE de la pasarel·la Revisió dels punts de xarxa de l’illa Inici automàtic del PC