e Learning

How to Block All Incoming and Outgoing packets in CentOS 7

CentOS 7 Firewalld Allow us to block all incoming and outgoing network traffic using just one single command. This is Also called as panic mode. When the panic mode is on, all incoming and outgoing packets will be dropped and active connections will expire.

Enable this only if there are serious problems with your network environment. For example if the machine is getting hacked in.

Enable Panic Mode in CentOS 7

Open Server Console and enter the following command to turn on the panic mode.

firewall-cmd –panic-on

BE CAREFUL – This is a Very risky Command to execute in a production environment. Block all network traffic means, no way you can access the server from a remote session. So do not enable this mode without having physical access to the server.

Disable Panic Mode

Use following command To deactivate the panic mode in CentOS 7. Once  deactivate firewall works with configured firewall rules.

firewall-cmd –panic-off

Type following command to determine if panic mode is enabled

firewall-cmd –query-panic

As I mentioned earlier, be careful with this command. Only use in a situation where your CentOS 7 server is server compromised or hacked and never execute from a remote terminal.