Outils pour utilisateurs

Outils du site


admin:procedures:installation_serveur_physique

Différences

Ci-dessous, les différences entre deux révisions de la page.

Lien vers cette vue comparative

Les deux révisions précédentesRévision précédente
Prochaine révision
Révision précédente
admin:procedures:installation_serveur_physique [2017/06/30 10:18] – [Sur coon] fpoulainadmin:procedures:installation_serveur_physique [2023/11/11 19:02] (Version actuelle) – dokuwiki formatting pitchum
Ligne 6: Ligne 6:
 Ne pas hésiter à lire https://www.debian.org/releases/stretch/amd64/release-notes/ pour les notes de versions. Ne pas hésiter à lire https://www.debian.org/releases/stretch/amd64/release-notes/ pour les notes de versions.
 En particulier, pour la configuration réseau, attention au nom des interfaces réseaux : En particulier, pour la configuration réseau, attention au nom des interfaces réseaux :
-    udevadm test-builtin net_id /sys/class/net/eth0 2> /dev/null+ 
 +<code>udevadm test-builtin net_id /sys/class/net/eth0 2> /dev/null</code> 
 Cette commande permet de récupérer le nom de l'interface dans le nouveau format ( https://www.freedesktop.org/wiki/Software/systemd/PredictableNetworkInterfaceNames/ ) Cette commande permet de récupérer le nom de l'interface dans le nouveau format ( https://www.freedesktop.org/wiki/Software/systemd/PredictableNetworkInterfaceNames/ )
  
Ligne 12: Ligne 14:
  
 sur chaque disque, activer le "mode grub" sur chaque disque, activer le "mode grub"
-    # parted /dev/sda +<code> 
-    > set 1 bios_grub on +# parted /dev/sda 
-    > quit +> set 1 bios_grub on 
-    # grub-install /dev/sda+> quit 
 +# grub-install /dev/sda 
 +</code>
  
 ====== libvirt ====== ====== libvirt ======
  
-Rappel : virt-manager à besoin de  netcat-openbsd (enfin d'un netcat avec -U)+Rappel : ''virt-manager'' à besoin de  ''netcat-openbsd'' (enfin d'un netcat avec -U)
  
 Sur Coon : Sur Coon :
  
-    On édite le réseau defautl : virsh net-edit default ; virsh net-destroy default ; virsh net-start default+  * On édite le réseau défaut ''virsh net-edit default ; virsh net-destroy default ; virsh net-start default'' 
 +  * Le bridge est à ''192.168.1.4'' sur coon et le range dhcp est de ''192.168.1.10-99'' 
 +  * On ajoute ''enp1s0'' dans le bridge : ''brctl addif enp1s0 virbr0'' 
 +  * On relance l'interface enp1s0 : ''ifup enp1s0'' 
 +  * ''systemctl disable libvirt-guests'', pour éviter que les machines démarrent toutes seules sans action explicite d'un admin (ce qui ne devrait pas être possible, car le point de montage de la partition des qcow ne peut pas être monté automatiquement.
  
-    Le bridge est à 192.168.1.4 sur coon et le range dhcp est de 192.168.1.10-99+====== Firewall ======
  
-    On ajoute enp1s0 dans le bridge brctl addif enp1s0 virbr0+On utilisera ''firehol''. Pour les détails quant à l'usage, se référer à [[admin:procedures:configuration-firewall-guest|Un firewall simple pour le Chapril]].
  
-    On relance l'interface enp1s0 ifup enp1s0+<note warning>Ne surtout pas installer le paquet firewall-chaton il n'est prévu que pour les guests !</note>
  
 +On pensera à définir les services pour ''drbd'' et ''icinga'' :
 +<code bash /etc/firehol/services/icinga.conf>
 +#FHVER: 1:213
 +# La premiere ligne ci dessus est nécessaire !!
 +server_icinga_ports="tcp/5665"
 +client_icinga_ports="default"
 +</code>
 +<code bash /etc/firehol/services/drbd.conf >
 +#FHVER: 1:213
 +# La premiere ligne ci dessus est nécessaire !!
 +server_drbd_ports="tcp/7788 tcp/7789"
 +client_drbd_ports="default"
 +</code>
  
-systemctl disable libvirt-guests pour éviter que les machines démarrent toutes seules sans action explicite +===== Script de firewall =====
-d'un admin (ce qui ne devrait pas être possible, car le point de montage de la partition des qcow ne peut +
-pas être monté automatiquement+
  
-====== Firewall ======+On a un script de firewalling destiné à être identique entre maine et coon. La différence se situant au niveau de la configuration.
  
-On utilisera firehol. Pour les détails quant à l'usage, se référer à [[admin:procedures:configuration-firewall-guest|Un firewall simple pour le chaton]].+Dans le principe on reste permissif : même si les routes ne sont pas censées être celles là, on n'empêche pas de sortir du cluster via enp0s31f6.
  
-<note warning>Ne surtout pas installer le paquet firewall-chaton : il n'est prévu que pour les guests !</note>+Il faut par ailleurs gérer le dnat sur l'IP de FIP. On le fait en premier car c'est une contrainte de la conf de firehol. Ensuite il faut penser dans les routeurs comme si la destination était changée. Le bon goût de cette conséquence est que la gestion ipv6 est assez bien intégrée. Enfin on contrôle l'IP de sortie du cluster avec une règle de SNAT.
  
-===== Sur coon =====+<code bash /etc/firehol/firehol.conf> 
 +################################################################################ 
 +# Configuration 
 +################################################################################
  
-On reste permissif : même si les routes ne sont pas censées être celles là, on n'empêche pas de sortir du cluster via enp0s31f6.+myPrivateIp="192.168.1.x 192.168.1.x" 
 +myPublicIp4="94.130.8.x" 
 +myPublicIp6="2a01:4f8:10b:c4x::/64"
  
-<code bash /etc/firehol/firehol.conf > +clusterPrivateNetwork="192.168.1.0/24" 
-## IPv6+clusterV6Network="2a01:4f8:10b:c41::/64 2a01:4f8:10b:c42::/64"  
 + 
 +# Si vous décommentez la ligne qui suit, le firewall considérera que fip 
 +# pointe sur cette machine avec l'adresse déclarée. 
 + 
 +fip="88.99.233.240" 
 + 
 +declare -A dispatching=( 
 +     ["dns"]=' "53" "tcp udp" "192.168.1.53"  "2a01:4f8:10b:c42:5054:ff:fe08:3282")' 
 +    ["http"]=' "80" "tcp"     "192.168.1.93"  "2a01:4f8:10b:c41:5054:ff:fe08:48ff")' 
 +   ["https"]='( "443" "tcp"     "192.168.1.93"  "2a01:4f8:10b:c41:5054:ff:fe08:48ff")' 
 +  ["icinga"]='("5665" "tcp"     "192.168.1.70"  "2a01:4f8:10b:c41:5054:ff:fe9b:6f27")' 
 +    ["smtp"]=' "25" "tcp"     "192.168.1.57"  "2a01:4f8:10b:c42:5054:ff:fec3:b9c7")' 
 +     ["ssh"]=' "22" "tcp"     "192.168.1.93"  "2a01:4f8:10b:c41:5054:ff:fe08:48ff")' 
 +
 + 
 +################################################################################ 
 +# /Configuration 
 +################################################################################ 
 + 
 +################################################################################ 
 +# NAT pour ipv4 
 +################################################################################ 
 +if test -n "$fip" 
 +then 
 +    for service in "${!dispatching[@]}" 
 +    do 
 +        eval "srv=${dispatching[$service]}" 
 +        dport="${srv[0]}" 
 +        protos="${srv[1]}" 
 +        ipv4="${srv[2]}" 
 +        for proto in $protos 
 +        do 
 +            ipv4 dnat to $ipv4 inface enp0s31f6 dst $fip proto $proto dport $dport 
 +        done 
 +    done 
 + 
 +    # Contrôle de l'IP de sortie 
 +    ipv4 snat to $fip outface enp0s31f6 
 +fi 
 + 
 +################################################################################ 
 +# IPv6 
 +################################################################################
 ipv6 interface any v6interop proto icmpv6 ipv6 interface any v6interop proto icmpv6
     client ipv6neigh accept     client ipv6neigh accept
Ligne 53: Ligne 120:
     policy return     policy return
  
 +################################################################################
 # DHCP # DHCP
 +################################################################################
 interface4 virbr0 dhcp interface4 virbr0 dhcp
     policy return     policy return
     server dhcp accept     server dhcp accept
  
 +################################################################################
 +# FIP -> ME
 +# The purpose of this interface is to control the traffic
 +# on the enp0s31f6 interface destinated to fip IP.
 +################################################################################
 +if test -n "$fip"
 +then
 +    interface enp0s31f6 fip_trafic dst4 $fip dst6 $myPublicIp6
 +
 +        # The default policy is DROP.
 +        policy drop
 +
 +        # Protection anti flood
 +        protection strong
 +
 +        # Services acceptés
 +        server ICMP    accept
 +        server ICMPV6  accept
 +
 +        # The following means that this machine can REQUEST anything via enp0s31f6.
 +        client all accept
 +fi
 +
 +################################################################################
 # EXT->ME # EXT->ME
 # The purpose of this interface is to control the traffic # The purpose of this interface is to control the traffic
-# on the enp0s31f6 interface with IP 94.130.8.3+# on the enp0s31f6 interface destinated to public IP. 
-interface enp0s31f6 external_trafic dst4 94.130.8.3 dst6 2a01:4f8:10b:c42::/64+################################################################################ 
 +interface enp0s31f6 external_trafic dst4 $myPublicIp4 dst6 $myPublicIp6
  
     # The default policy is DROP.     # The default policy is DROP.
Ligne 70: Ligne 164:
  
     # Services acceptés     # Services acceptés
-    server ICMP accept 
     server ssh accept     server ssh accept
 +    server ICMP accept
 +    server ICMPV6 accept
  
     # The following means that this machine can REQUEST anything via enp0s31f6.     # The following means that this machine can REQUEST anything via enp0s31f6.
     client all accept     client all accept
  
 +################################################################################
 # LAN->ME # LAN->ME
 # The purpose of this interface is to control the traffic # The purpose of this interface is to control the traffic
-# on the {enp1s0,virbr0,virbr1} interface with IP 192.168.1.{3,5} (net: "192.168.1.0/24 ")+# on the {enp1s0,virbr0,virbr1} interface destinated to private IP. 
-interface "enp1s0 virbr0 virbr1" internal_trafic src4 "192.168.1.0/24" dst4 "192.168.1.3 192.168.1.5" src6 "2a01:4f8:10b:c41::/64 2a01:4f8:10b:c42::/64" dst6 2a01:4f8:10b:c42::/64+################################################################################ 
 +interface "enp1s0 virbr0 virbr1" internal_trafic src4 $clusterPrivateNetwork dst4 "$myPrivateIp" src6 "$clusterV6Network" dst6 $myPublicIp6
  
     # On est entre amis     # On est entre amis
Ligne 92: Ligne 189:
     server dhcp accept     server dhcp accept
     server dhcpv6 accept     server dhcpv6 accept
 +    server icinga accept
 +    server drbd accept
  
     # The following means that this machine can REQUEST anything via enp1s0.     # The following means that this machine can REQUEST anything via enp1s0.
     client all accept     client all accept
  
 +################################################################################
 # Clients on enp0s31f6 (Internet) accessing servers on {enp1s0,virbr0,virbr1} (LAN). # Clients on enp0s31f6 (Internet) accessing servers on {enp1s0,virbr0,virbr1} (LAN).
 +################################################################################
 router ext2me inface enp0s31f6 outface "enp1s0 virbr0 virbr1" router ext2me inface enp0s31f6 outface "enp1s0 virbr0 virbr1"
     protection strong     protection strong
  
 +################################################################################
 # Clients on {enp1s0,virbr0,virbr1} (LAN) accessing servers on enp0s31f6 (Internet). # Clients on {enp1s0,virbr0,virbr1} (LAN) accessing servers on enp0s31f6 (Internet).
 +################################################################################
 router me2ext inface "enp1s0 virbr0 virbr1" outface enp0s31f6 router me2ext inface "enp1s0 virbr0 virbr1" outface enp0s31f6
     masquerade     masquerade
Ligne 106: Ligne 209:
     route all accept     route all accept
  
 +################################################################################
 # Clients on {enp1s0,virbr0,virbr1} (LAN) accessing servers on {enp1s0,virbr0,virbr1} (LAN). # Clients on {enp1s0,virbr0,virbr1} (LAN) accessing servers on {enp1s0,virbr0,virbr1} (LAN).
 +################################################################################
 router me2me inface "enp1s0 virbr0 virbr1" outface "enp1s0 virbr0 virbr1" router me2me inface "enp1s0 virbr0 virbr1" outface "enp1s0 virbr0 virbr1"
     # If you remove it, no REQUEST will pass matching this traffic.     # If you remove it, no REQUEST will pass matching this traffic.
     route all accept     route all accept
  
-# Clients v6 on cluster (LAN) accessing servers on LAN via Hetzner router+################################################################################ 
-router6 me2me6 inface enp0s31f6 outface virbr1 src6 "2a01:4f8:10b:c41::/64 2a01:4f8:10b:c42::/64" dst6 2a01:4f8:10b:c42::/64 +# Clients on enp0s31f6 (Internet) accessing cluster'servers. 
-    route all accept+################################################################################ 
 +if test -n "$fip" 
 +then 
 +    for service in "${!dispatching[@]}" 
 +    do 
 +        eval "srv=${dispatching[$service]}" 
 +        dport="${srv[0]}" 
 +        protos="${srv[1]}" 
 +        ipv4="${srv[2]}" 
 +        ipv6="${srv[3]}" 
 +        for proto in $protos 
 +        do 
 +            router "$service"_"$dport"_"$proto" inface enp0s31f6 outface "virbr0 virbr1" dst4 $ipv4 dst6 $ipv6 
 +            protection strong 
 +            server $service accept 
 +        done 
 +    done 
 +fi
 </code> </code>
  
-===== Sur maine =====+===== Configuration sur coon =====
  
 +<code bash /etc/firehol/firehol.conf >
 +################################################################################
 +# Configuration
 +################################################################################
  
 +myPrivateIp="192.168.1.3 192.168.1.5"
 +myPublicIp4="94.130.8.3"
 +myPublicIp6="2a01:4f8:10b:c42::/64"
  
 +clusterPrivateNetwork="192.168.1.0/24"
 +clusterV6Network="2a01:4f8:10b:c41::/64 2a01:4f8:10b:c42::/64" 
 +
 +# Si vous décommentez la ligne qui suit, le firewall considérera que fip
 +# pointe sur cette machine avec l'adresse déclarée.
 +
 +# fip="88.99.233.240"
 +
 +declare -A dispatching=(
 +     ["dns"]=' "53" "tcp udp" "192.168.1.53"  "2a01:4f8:10b:c42:5054:ff:fe08:3282")'
 +    ["http"]=' "80" "tcp"     "192.168.1.93"  "2a01:4f8:10b:c41:5054:ff:fe08:48ff")'
 +   ["https"]='( "443" "tcp"     "192.168.1.93"  "2a01:4f8:10b:c41:5054:ff:fe08:48ff")'
 +  ["icinga"]='("5665" "tcp"     "192.168.1.70"  "2a01:4f8:10b:c41:5054:ff:fe9b:6f27")'
 +    ["smtp"]=' "25" "tcp"     "192.168.1.57"  "2a01:4f8:10b:c42:5054:ff:fec3:b9c7")'
 +     ["ssh"]=' "22" "tcp"     "192.168.1.93"  "2a01:4f8:10b:c41:5054:ff:fe08:48ff")'
 +)
 +
 +</code>
 +
 +===== Configuration sur maine =====
 +
 +<code bash /etc/firehol/firehol.conf >
 +################################################################################
 +# Configuration
 +################################################################################
 +
 +myPrivateIp="192.168.1.2 192.168.1.4"
 +myPublicIp4="94.130.8.2"
 +myPublicIp6="2a01:4f8:10b:c41::/64"
 +
 +clusterPrivateNetwork="192.168.1.0/24"
 +clusterV6Network="2a01:4f8:10b:c41::/64 2a01:4f8:10b:c42::/64" 
 +
 +# Si vous décommentez la ligne qui suit, le firewall considérera que fip
 +# pointe sur cette machine avec l'adresse déclarée.
 +
 +fip="88.99.233.240"
 +
 +declare -A dispatching=(
 +     ["dns"]=' "53" "tcp udp" "192.168.1.53"  "2a01:4f8:10b:c42:5054:ff:fe08:3282")'
 +    ["http"]=' "80" "tcp"     "192.168.1.93"  "2a01:4f8:10b:c41:5054:ff:fe08:48ff")'
 +   ["https"]='( "443" "tcp"     "192.168.1.93"  "2a01:4f8:10b:c41:5054:ff:fe08:48ff")'
 +  ["icinga"]='("5665" "tcp"     "192.168.1.70"  "2a01:4f8:10b:c41:5054:ff:fe9b:6f27")'
 +    ["smtp"]=' "25" "tcp"     "192.168.1.57"  "2a01:4f8:10b:c42:5054:ff:fec3:b9c7")'
 +     ["ssh"]=' "22" "tcp"     "192.168.1.93"  "2a01:4f8:10b:c41:5054:ff:fe08:48ff")'
 +)
 +</code>
admin/procedures/installation_serveur_physique.1498817911.txt.gz · Dernière modification : 2017/06/30 10:18 de fpoulain