# Firewall Configuration

## Configuring The Firewall

### Start and enable the firewall

1. To start and enable the firewall use the commands below

```
systemctl start firewalld
systemctl enable firewalld
```

### Get an overview

#### Default Zone

1. Find the default zone. The default zone is usually public

```
firewall-cmd --get-default-zone
```

[![05.PNG](https://docs.azandi.co.za/uploads/images/gallery/2020-04/scaled-1680-/qq582R1Ib8dhdeyF-05.PNG)](https://docs.azandi.co.za/uploads/images/gallery/2020-04/qq582R1Ib8dhdeyF-05.PNG)

#### Display Allowed Services

1. Display the allowed services of the zone

```
firewall-cmd --list-service --zone=external
```

By default, "public" zone is applied with a NIC and dhcpv6-client and ssh are allowed.

[![06.PNG](https://docs.azandi.co.za/uploads/images/gallery/2020-04/scaled-1680-/X2Fl3jKuNdqLgnr5-06.PNG)](https://docs.azandi.co.za/uploads/images/gallery/2020-04/X2Fl3jKuNdqLgnr5-06.PNG)

#### Display Services Defined By Default

1. To list all service defined by default use the command below

```
firewall-cmd --get-services
```

It should give you an output similar to

[![07.PNG](https://docs.azandi.co.za/uploads/images/gallery/2020-04/scaled-1680-/g72icgvW2yZaBApS-07.PNG)](https://docs.azandi.co.za/uploads/images/gallery/2020-04/g72icgvW2yZaBApS-07.PNG)

#### Add/Remove services

1. Add or Remove allowed services. The change will be back after rebooting the system. If you change settings permanently, add the "--permanent" option.

[![08.PNG](https://docs.azandi.co.za/uploads/images/gallery/2020-04/scaled-1680-/7xfmKjboe5rhnrDI-08.PNG)](https://docs.azandi.co.za/uploads/images/gallery/2020-04/7xfmKjboe5rhnrDI-08.PNG)

#### Add/Remove Ports

1. Add or remove allowed ports

[![09.PNG](https://docs.azandi.co.za/uploads/images/gallery/2020-04/scaled-1680-/6FYRgLTU7MwvI6fE-09.PNG)](https://docs.azandi.co.za/uploads/images/gallery/2020-04/6FYRgLTU7MwvI6fE-09.PNG)

#### Add/Remove Prohibited ICMP Types

1. Add or remove prohibited ICMP types

[![010.PNG](https://docs.azandi.co.za/uploads/images/gallery/2020-04/scaled-1680-/o1qWvKWvzUi71dEC-010.PNG)](https://docs.azandi.co.za/uploads/images/gallery/2020-04/o1qWvKWvzUi71dEC-010.PNG)