# jose20035/pfsense-alta-disponivilidad architecture

> Architecture diagram of the GitHub repository jose20035/pfsense-alta-disponivilidad, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-06-14). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/jose20035/pfsense-alta-disponivilidad
- Repository: https://github.com/jose20035/pfsense-alta-disponivilidad

## Overview

##### Project type and purpose
- This is an infrastructure-as-code/virtualization project that builds a high-availability firewall cluster using pfSense under libvirt/KVM.
- Two pfSense VMs (master & slave) provide HA and firewall/NAT services for two Debian test guests (web & db).
- Four virtual networks are defined in XML (default/NAT, exter, intra, net-pfsense).

##### File structure
- Top level
- README.md – project description and steps
- imagenes/… – screenshots of configuration steps
- xml/
– maquinas/ (web.xml, db.xml): VM definitions for Debian guests
– redes/ (default is implicit, plus exter.xml, intra.xml, net-pfsense.xml): libvirt network definitions
- There are no application source code folders; all “source” is libvirt XML descriptors and docs.

##### README for additional insights
- Four libvirt networks with distinct roles (Internet NAT, external LAN, internal LAN, HA sync).
- Two Debian VMs (web & db) built with virt-builder, attached to exter & intra.
- Two pfSense VMs installed via virt-install, each with four NICs, implementing WAN, DMZ, LAN, and sync networks.
- pfSense configuration: interface assignment, firewall rules, DHCP, CARP VIPs, HA sync via pfsync.

- Use clear labels: VM names, network names, IP ranges (/24).
- From web/db through pfSense to default (Internet)
- Between pfSense nodes on net-pfsense (two-way)
- Clouds for networks (blue=WAN, orange=DMZ, green=LAN, purple=HA sync)
- CARP VIPs next to pfSense link and VIP IPs on WAN/LAN.

## Diagram (Mermaid)

```mermaid
flowchart TD
    LH["Libvirt Host"]:::infra

    subgraph "Virtual Networks"
        NW_d["default NAT/Internet\n(192.168.122.0/24)"]:::wan
        NW_w["exter DMZ\n(10.0.1.0/24)"]:::dmz
        NW_l["intra LAN\n(10.0.2.0/24)"]:::lan
        NW_sync["net-pfsense Sync\n(10.0.3.0/30)"]:::sync
    end

    subgraph "pfSense High-Availability Cluster"
        PM["pfsense-master"]:::pfsense
        PS["pfsense-slave"]:::pfsense
    end

    subgraph "Debian Test Guests"
        DW["Debian-web"]:::debian
        DB["Debian-db"]:::debian
    end

    %% VM to Network connections
    PM -->|"eth0=WAN"| NW_d
    PM -->|"eth1=DMZ"| NW_w
    PM -->|"eth2=LAN"| NW_l
    PM -->|"eth3=Sync"| NW_sync

    PS -->|"eth0=WAN"| NW_d
    PS -->|"eth1=DMZ"| NW_w
    PS -->|"eth2=LAN"| NW_l
    PS -->|"eth3=Sync"| NW_sync

    DW -->|"eth0=DMZ"| NW_w
    DB -->|"eth0=LAN"| NW_l

    %% Traffic flows
    DW -.->|"to Internet via pfSense NAT"| NW_d
    DB -.->|"to Internet via pfSense NAT"| NW_d

    %% Click Events
    click README.md "https://github.com/jose20035/pfsense-alta-disponivilidad/blob/main/README.md"
    click imagenes/ "https://github.com/jose20035/pfsense-alta-disponivilidad/tree/main/imagenes/"
    click DW "https://github.com/jose20035/pfsense-alta-disponivilidad/blob/main/xml/maquinas/web.xml"
    click DB "https://github.com/jose20035/pfsense-alta-disponivilidad/blob/main/xml/maquinas/db.xml"
    click NW_w "https://github.com/jose20035/pfsense-alta-disponivilidad/blob/main/xml/redes/exter.xml"
    click NW_l "https://github.com/jose20035/pfsense-alta-disponivilidad/blob/main/xml/redes/intra.xml"
    click NW_sync "https://github.com/jose20035/pfsense-alta-disponivilidad/blob/main/xml/redes/net-pfsense.xml"

    classDef infra fill:#eeeeee,stroke:#999999,color:#333333,stroke-width:2px;
    classDef wan fill:#cce5ff,stroke:#6699cc,color:#003366;
    classDef dmz fill:#ffe5cc,stroke:#cc9966,color:#663300;
    classDef lan fill:#ccffcc,stroke:#66cc66,color:#336633;
    classDef sync fill:#e5ccff,stroke:#9966cc,color:#330066,stroke-dasharray: 5 5;
    classDef pfsense fill:#ffcccc,stroke:#cc6666,color:#660000,stroke-width:2px;
    classDef debian fill:#fff2cc,stroke:#ccb366,color:#665500;
```
