How do I add a network interface to firewalld?
To add the ens18 interface to the public zone of firewalld in Linux, you can follow these steps:
-
Open a terminal on your Linux machine.
-
Check the current zones and the configured interfaces using:
sudo firewall-cmd --get-active-zones -
Add the
ens18interface to the public zone with the following command:sudo firewall-cmd --zone=public --add-interface=ens18 --permanentThe
--permanentoption ensures that the change persists after a reboot. -
Reload the firewall to apply the changes:
sudo firewall-cmd --reload -
Verify that the interface has been added to the public zone:
sudo firewall-cmd --zone=public --list-interfaces
You should see ens18 listed as part of the public zone. If you have any further questions or need assistance with anything else, feel free to ask!