Ci-dessous, les différences entre deux révisions de la page.
| Les deux révisions précédentesRévision précédenteProchaine révision | Révision précédente | ||
| linux:proxmox [26-11-2023 10:19] – [Petites commandes à connaitre] edmc73 | linux:proxmox [19-06-2024 14:53] (Version actuelle) – [Login ssh long] edmc73 | ||
|---|---|---|---|
| Ligne 30: | Ligne 30: | ||
| ===== Configuration ===== | ===== Configuration ===== | ||
| - | ==== Cas de figure : une seule adresse ip + un LAN ==== | + | ==== Cas de figure : une seule adresse ip public |
| - | On rajouter pour l' | + | |
| - | iptables -t nat -A POSTROUTING -s 192.168.0.0/ | + | |
| - | + | ||
| - | Cela permet à votre réseau virtuel en 192.168.0.0 d' | + | |
| - | Pour un accès ssh de votre VM, vous devez utiliser | + | Par défaut, vous avez un bridge vmbr0 connecté |
| - | Exemple pour le port 2222 qui sera redirigé | + | |
| - | On déclare tout d' | + | |
| - | iptables -t nat -A POSTROUTING -s 192.168.0.0/ | + | |
| - | + | ||
| - | Ensuite on redirige le port 2222 | + | |
| - | iptables -t nat -A PREROUTING -d 70.70.70.70 -p tcp --dport 2222 -j DNAT --to-dest 192.168.0.1: | + | |
| - | //(a venir, une config plus sécurisé du firewall...)// | + | < |
| + | Name: vmbr0 | ||
| + | IPv4/CIDR : 94.94.94.94/24 | ||
| + | Gateway | ||
| + | Bridge ports: eno1 | ||
| + | </code> | ||
| - | Je désactive l' | + | Créons un bridge qui définira notre réseau local |
| - | L' | + | |
| - | Pour cela, modifiez | + | < |
| + | Name: vmbr1 | ||
| + | IPv4/CIDR : 192.168.0.1/ | ||
| + | Gateway (IPv4) : (vide) | ||
| + | Bridge ports: (vide) | ||
| + | </ | ||
| + | |||
| + | On crée maintenant une VM avec les infos suivantes | ||
| + | < | ||
| + | Name: eth0 | ||
| + | Bridge: vmbr1 | ||
| + | IPv4 : Static | ||
| + | IPv4/CIDR : 192.168.0.2/ | ||
| + | Gateway (IPv4) : 192.168.0.1 | ||
| + | </ | ||
| + | |||
| + | Maintenant, il faut dire au système que l'on veut faire de l'ip forwarding | ||
| + | echo 1 > / | ||
| + | |||
| + | Ensuite il suffit juste de rajouter une règle iptable pour router notre réseau local vers le bridge qui a accès au WAN | ||
| + | |||
| + | iptables -t nat -A POSTROUTING -s 192.168.0.0/ | ||
| + | |||
| + | Vous pouvez automatiser tout ça dans votre fichier | ||
| + | |||
| + | < | ||
| + | auto vmbr1 | ||
| + | iface vmbr1 inet static | ||
| + | address 192.168.0.1/ | ||
| + | bridge-ports none | ||
| + | bridge-stp off | ||
| + | bridge-fd 0 | ||
| + | post-up echo 1 > / | ||
| + | post-up iptables -t nat -A POSTROUTING -s 192.168.0.0/24 -o vmbr0 -j MASQUERADE | ||
| + | post-up / | ||
| + | post-down iptables -t nat -D POSTROUTING -s 192.168.0.0/ | ||
| + | </ | ||
| + | |||
| + | Le fichier / | ||
| + | |||
| + | Pour un accès ssh de votre VM, vous devez utiliser un autre port que le 22 qui est déja utilisé par votre serveur principal.\\ | ||
| + | Exemple pour le port 2222 qui sera redirigé sur le port 22 de votre VM 192.168.0.2 | ||
| + | iptables -t nat -A PREROUTING -i vmbr0 -p tcp --dport 2222 -j DNAT --to-destination 192.168.0.2: | ||
| - | Rédémarrez apache | ||
| - | Installons maintenant **pound** qui permet le reverse-proxy et load-balancer | ||
| - | aptitude install pound | ||
| - | [[linux: | ||
| - | | ||
| ==== Cas de figure : Une adresse ip WAN pour chaque VM ==== | ==== Cas de figure : Une adresse ip WAN pour chaque VM ==== | ||
| Ligne 409: | Ligne 440: | ||
| Ajouter un répertoire pour le backup (ici /backup) | Ajouter un répertoire pour le backup (ici /backup) | ||
| + | |||
| + | ===== upgrade 6 to 7 ===== | ||
| + | |||
| + | Après avoir checké avec la commande | ||
| + | pve6to7 | ||
| + | |||
| + | Suivre la procédure sur https:// | ||
| + | |||
| + | sed -i ' | ||
| + | sed -i -e ' | ||
| + | apt update | ||
| + | apt dist-upgrade | ||
| + | |||
| + | Ensuite, je n' | ||
| + | |||
| + | < | ||
| + | update-initramfs: | ||
| + | |||
| + | gzip: stdout: No space left on device | ||
| + | E: mkinitramfs failure gzip 1 | ||
| + | update-initramfs: | ||
| + | run-parts: / | ||
| + | Failed to process / | ||
| + | dpkg: error processing package pve-kernel-5.15.131-1-pve (--configure): | ||
| + | | ||
| + | Setting up libboost-iostreams1.74.0: | ||
| + | Setting up libsigc++-2.0-0v5: | ||
| + | Setting up aptitude-common (0.8.13-3) ... | ||
| + | dpkg: dependency problems prevent configuration of pve-kernel-5.15: | ||
| + | | ||
| + | Package pve-kernel-5.15.131-1-pve is not configured yet. | ||
| + | |||
| + | dpkg: error processing package pve-kernel-5.15 (--configure): | ||
| + | | ||
| + | dpkg: dependency problems prevent configuration of proxmox-ve: | ||
| + | | ||
| + | Package pve-kernel-5.15 is not configured yet. | ||
| + | |||
| + | dpkg: error processing package proxmox-ve (--configure): | ||
| + | | ||
| + | Setting up libcwidget4: | ||
| + | Setting up aptitude (0.8.13-3) ... | ||
| + | update-alternatives: | ||
| + | Processing triggers for man-db (2.9.4-2) ... | ||
| + | Processing triggers for libc-bin (2.31-13+deb11u7) ... | ||
| + | Errors were encountered while processing: | ||
| + | | ||
| + | | ||
| + | | ||
| + | E: Sub-process / | ||
| + | |||
| + | </ | ||
| + | |||
| + | et le reboot s'est mal passé... | ||
| + | |||
| + | Obligé de rebooter sur un live rescue | ||
| + | < | ||
| + | mount / | ||
| + | mount /dev/sda1 /mnt/boot | ||
| + | for name in proc sys dev ; do mount --bind /$name /mnt/$name; done | ||
| + | |||
| + | chroot /mnt | ||
| + | </ | ||
| + | |||
| + | relancer les commandes apt dist-upgrade et constater que rien ne fonctionne... | ||
| + | |||
| + | Finalement, ce qui a fonctionner | ||
| + | < | ||
| + | umount /boot | ||
| + | fsck.ext4 -p -c -f /dev/sda1 | ||
| + | /dev/sda1: Updating bad block inode. | ||
| + | /dev/sda1: 362/51000 files (1.4% non-contiguous), | ||
| + | |||
| + | apt dist-upgrade | ||
| + | run-parts: executing / | ||
| + | Setting up pve-kernel-5.15 (7.4-8) ... | ||
| + | Setting up proxmox-ve (7.4-1) ... | ||
| + | |||
| + | </ | ||
| + | |||
| + | Plus d' | ||
| + | |||
| + | Après un reboot, j'ai eu droit à ça | ||
| + | Kernel Panic - not syncing: VFS: Unable to mount root fs on unknown-block(0, | ||
| + | |||
| + | donc reboot sur un ancien kernel et | ||
| + | < | ||
| + | update-initramfs -u -k 5.15.131-1-pve | ||
| + | |||
| + | update-initramfs: | ||
| + | gzip: stdout: No space left on device | ||
| + | E: mkinitramfs failure gzip 1 | ||
| + | update-initramfs: | ||
| + | |||
| + | |||
| + | df -h /boot | ||
| + | Filesystem | ||
| + | / | ||
| + | </ | ||
| + | il n'y a donc pas assez d' | ||
| + | |||
| + | Faisons le ménage en cherchant avec grub les kernel installé | ||
| + | dpkg --list | grep kernel | ||
| + | |||
| + | en supprimant les paquets obsolètes | ||
| + | apt purge nom_du_paquet | ||
| + | |||
| + | et en supprimant à la main les fichiers resté dans /boot de la même version supprimé | ||
| + | |||
| + | On relance ensuite les 2 commandes qui vont bien | ||
| + | < | ||
| + | oot@proxmox202009:/ | ||
| + | update-initramfs: | ||
| + | Running hook script ' | ||
| + | Re-executing '/ | ||
| + | No / | ||
| + | root@proxmox202009:/ | ||
| + | Filesystem | ||
| + | / | ||
| + | |||
| + | root@proxmox202009:/ | ||
| + | Generating grub configuration file ... | ||
| + | Found linux image: / | ||
| + | Found initrd image: / | ||
| + | Found linux image: / | ||
| + | Found initrd image: / | ||
| + | Warning: os-prober will not be executed to detect other bootable partitions. | ||
| + | Systems on them will not be added to the GRUB boot configuration. | ||
| + | Check GRUB_DISABLE_OS_PROBER documentation entry. | ||
| + | done | ||
| + | </ | ||
| + | |||
| + | On reboot. Et là... encore un problème. Le système boot bien, tout fonctionne sauf l' | ||
| + | |||
| + | Et oui il était écrit en petit dans la doc ( https:// | ||
| + | |||
| + | donc, faire un | ||
| + | ip -c link | ||
| + | pour récupérer l' | ||
| + | et rajouter dans le **/ | ||
| + | hwaddress 00: | ||
| + | on restart le réseau | ||
| + | systemctl restart networking | ||
| + | |||
| + | Et ça marche !! (enfin l' | ||
| + | |||
| + | Et ça fait plaisir de voir que je ne suis pas le seul à avoir eu des problèmes -> https:// | ||
| + | |||
| + | ===== Autres bidouilles ===== | ||
| + | ==== Login ssh long LXC ==== | ||
| + | Sur un LXC avec une debian 11, se connecter en ssh était super long | ||
| + | |||
| + | Dans les log du LXC je voyais ceci | ||
| + | < | ||
| + | Jun 19 14:41:43 zabbix dbus-daemon[78]: | ||
| + | Jun 19 14:41:43 zabbix sshd[1013861]: | ||
| + | </ | ||
| + | |||
| + | En redémarrant le service concerné, j'ai vu qu'il ne fonctionnait pas | ||
| + | < | ||
| + | root@lxc:/ | ||
| + | Job for systemd-logind.service failed because the control process exited with error code. | ||
| + | See " | ||
| + | |||
| + | root@lxc:/ | ||
| + | ● systemd-logind.service - User Login Management | ||
| + | | ||
| + | | ||
| + | Docs: man: | ||
| + | | ||
| + | | ||
| + | | ||
| + | Process: 1013940 ExecStart=/ | ||
| + | Main PID: 1013940 (code=exited, | ||
| + | CPU: 5ms | ||
| + | |||
| + | juin 19 14:43:27 zabbix systemd[1]: systemd-logind.service: | ||
| + | juin 19 14:43:27 zabbix systemd[1]: Stopped User Login Management. | ||
| + | juin 19 14:43:27 zabbix systemd[1]: systemd-logind.service: | ||
| + | juin 19 14:43:27 zabbix systemd[1]: systemd-logind.service: | ||
| + | juin 19 14:43:27 zabbix systemd[1]: Failed to start User Login Management. | ||
| + | </ | ||
| + | |||
| + | La solution trouvé sur le net consiste à masquer le service... | ||
| + | < | ||
| + | root@zabbix:/ | ||
| + | Created symlink / | ||
| + | </ | ||
| + | |||
| + | < | ||
| + | mask UNIT... | ||
| + | Mask one or more units, as specified on the command line. This will link these unit files to /dev/null, making it impossible to start them. This is a | ||
| + | | ||
| + | care. This honors the --runtime option to only mask temporarily until the next reboot of the system. The --now option may be used to ensure that the units | ||
| + | are also stopped. This command expects valid unit names only, it does not accept unit file paths. | ||
| + | </ | ||
| + | |||