# VMware configuration firewall via SSH/CLI

Connectez-vous en SSH sur le serveur ESXi

Afficher les règles de firewall actuelles

```bash
esxcli network firewall ruleset list
```

[![image.png](https://know.app.slaunay.com/uploads/images/gallery/2023-11/scaled-1680-/My8XDoDQGsxs6JZA-image.png)](https://know.app.slaunay.com/uploads/images/gallery/2023-11/My8XDoDQGsxs6JZA-image.png)

Ajouter une règles de firewall

```bash
esxcli network firewall ruleset allowedip add --ruleset-id=[NAME] --ip-address=[IP_OU_RANGE]
```

[![image.png](https://know.app.slaunay.com/uploads/images/gallery/2023-11/scaled-1680-/EUFrfJerd0BA29Vy-image.png)](https://know.app.slaunay.com/uploads/images/gallery/2023-11/EUFrfJerd0BA29Vy-image.png)

Activer la règle

```bash
esxcli network firewall ruleset set --ruleset-id=[NAME] --enabled=true
```

[![image.png](https://know.app.slaunay.com/uploads/images/gallery/2023-11/scaled-1680-/lj4PC1DYpI9Pexik-image.png)](https://know.app.slaunay.com/uploads/images/gallery/2023-11/lj4PC1DYpI9Pexik-image.png)

Recharger les règles de firewall

```bash
esxcli network firewall refresh
```

[![image.png](https://know.app.slaunay.com/uploads/images/gallery/2023-11/scaled-1680-/d2Bhml4Ze4FTKcer-image.png)](https://know.app.slaunay.com/uploads/images/gallery/2023-11/d2Bhml4Ze4FTKcer-image.png)