How can we replace iptables with firewalld in ubuntu 16.04?

14,449

To switch do the following:

  1. Stop iptables if in use:

    sudo systemctl stop iptables
    
  2. Make sure iptables are not used by your system anymore:

    sudo systemctl mask iptables
    
  3. Check its status:

    sudo systemctl status iptables
    
  4. Remove UFW if installed:

    sudo apt-get remove ufw
    

Firewalld - Dynamic Firewall Manager

This replaces iptable as the preferred way to manage your firewall. Commands to use with firewalld includes:

  1. Install firewalld:

    sudo apt install firewalld
    
  2. Check its status:

    sudo systemctl status firewalld
    
  3. Enable or disable firewalld:

    sudo systemctl [enable | disable ] firewalld
    
  4. Starting and stoping it:

    sudo systemctl [ start | stop ] firewalld
    

So to use it is simply to enable it as in steps 2, then use the man pages to get more information.

See here for more information on how to use firewalld

Share:
14,449

Related videos on Youtube

RjV
Author by

RjV

Linux Admin

Updated on September 18, 2022

Comments

  • RjV
    RjV over 1 year

    In Ubuntu 16.04, can we install firewalld services?

    • Has QUIT--Anony-Mousse
      Has QUIT--Anony-Mousse over 7 years
      Doesn't firewalld depend on iptables?
  • Phil McKerracher
    Phil McKerracher about 6 years
    You left out "apt install firewalld" in the Firewalld section - it's not included in Ubuntu 16.04 by default