# home.bksp

# Network

## Configuration

| Vlan | Network | Comment | Conf |
| --- | --- | --- | --- |
| 2 | 10.21.0.0/24 | Admin / Lan | DHCP |
| - | 10.21.1.0/24 | VPN | Auto (openvpn) |
| 10 | 10.21.10.0/24 | Servers | Static |
| 20 | 10.21.20.0/24 | Work | DHCP |

* Router
  | Port | VLAN |
  | --- | --- | 
  | 1 | 2, 10, 20 (tagged) |
  | 2 | 2 (untagged) |
  | 3 | 2 (untagged) |
  | 4 | 20 (untagged) |
  
* Switch
  | Port | VLAN |
  | --- | --- |
  | 1 | 3 (untagged) |
  | 2 | 2, 10, 20 (tagged) |
  | 3 | 2 (untagged) |
  | 4-7 | 10 (untagged) |
  | 8 | 20 (untagged) |

## Branchements

* Router
  | Port | Équipement |
  | --- | --- |
  | 1 | Switch |
  | 2 | Laptop perso |
  | 3 |  |
  | 4 | Laptop pro |
 
 * Switch
   | Port | Équipement |
   |--- | --- |
   | 2 | Router |
   | 3 | - |
   | 4 | Rasp (Mio) |
   | 5 | Rasp (Ritsu) |
   | 6 | NAS (Senjougahara) |
   | 8 | Gateway Lora |

## Adresses

| Équipement | Adresse | Net |
| --- | --- | --- |
| Router (gw1.home) | 10.21.0.1 | Admin |
| Switch (sw1.home) | 10.21.0.2 | Admin |
| Rasp (mio.home) | 10.21.10.101 | Server |
| Rasp (ritsu.home) | 10.21.10.102 | Server |
| NAS (senjougahara.home) | 10.21.10.32 | Server |
| Gateway Lora | 10.21.20.10 | Work |
| smallbell.vpn | 10.21.1.2 | VPN |

# Installation Rasp

## Installation Centos8 Stream

1. Graver l'image de disque ([Lien de l'image](https://people.centos.org/pgreco/CentOS-Userland-8-stream-aarch64-RaspberryPI-Minimal-4/))
   ```sh
   dd if=CentOS-Userland-8-stream-aarch64-RaspberryPI-Minimal-4-sda.raw of=/dev/mmcblk0 bs=64k status=progress
   ```
 2. Démarrer la rasp (par défault en dhcp) sur le réseau admin et trouver l'ip en regardant sur [http://10.21.0.1/cgi-bin/luci/admin/status/overview](http://10.21.0.1/cgi-bin/luci/admin/status/overview)
 3. SSH avec les identifiants root / centos
 4. Redimensionner la partition root
    ```sh
    dnf install cloud-utils-growpart e2fsprogs
    growpart /dev/mmcblk0 3
    resize2fs /dev/mmcblk0p3
    ```
 5. Configurer le réseau
    ```sh
    dnf install vim
    vim /etc/sysconfig/network-scripts/ifcfg-eth0
    ```
    ```
    DEVICE=eth0
    BOOTPROTO=none
    ONBOOT=yes
    PREFIX=24
    IPADDR=10.21.10.101
    GATEWAY=10.21.10.1
    DNS1=10.21.10.53 # todo
    ```
6. Redémarrer la rasp sur le réseau des servers
7. Migrer à Centos Stream
   ```sh
   rpm -i  https://vault.centos.org/centos/8/extras/aarch64/os/Packages/centos-release-stream-8.1-1.1911.0.7.el8.aarch64.rpm
   dnf --allowerasing --disablerepo '*' --enablerepo=extras swap centos-linux-repos centos-stream-repos
   dnf distro-sync
   ```
8. Redémarrer la rasp

Sources :
* [https://sigs.centos.org/automotive/building/centos_stream_pi4/](https://sigs.centos.org/automotive/building/centos_stream_pi4/)
* [http://reallyappreciate.com/raspberry-pi-4-8gb-model-with-centos-8/](http://reallyappreciate.com/raspberry-pi-4-8gb-model-with-centos-8/)