Linux Firewall Commands


Graphical Firewall:
Firewall-config is command to open a graphical window for firewall or You can use Menu Application -> Sundary -> Firewall.





Command Line Firewall:
To work firewall with command line mode install package called firewalld.


Firewall Commands:
1.       firewall-cmd --get-default-zone : Says current zone
2.       firewall-cmd --get-zones : List available zones
3.       firewall-cmd --get-active-zone : List the zones currently use along with interface information.
4.       firewall-cmd --set-default-zone=home : Set default zone, It change on both runtime and permanent configuration.
5.       firewall-cmd --permanent --zone=work --add-source=IP : Route all traffic coming from the mentioned IP address or netmask to the specified zone. If no zone option is provided the default zone is will be used.
6.       firewall-cmd --permanent --zone=work --remove-source=IP: Remove the rule routing all traffic coming from the IP address or netmask from the specified zone.
7.   firewall-cmd --reload = Drop runtime configuration and apply the persistent configuration.
8.   firewall-cmd --list-all = It will list all configured interfaces sources, service and ports for zone.
9.   firewall-cmd --list-all-zone = Retrieve all info for zones.
10. firewall-cmd --permanent --add-service=servicename = Allow traffic to mentioned service, If no zone option is provided the default zone will be selected.
11. firewall-cmd --permanent --add-port=portnumber = Allow traffic to the port.








Previous
Next Post »