Common linux firewall configurations

Source: Internet
Author: User

Common linux firewall configurations

RHLE7/centos7 firewall installed by default is firewall


Switch Service
Systemctl start firewalld. service
Systemctl stop firewalld. service

Emergency mode: Network disconnection
Firewall-cmd -- enable panic-on
Firewall-cmd -- disable panic-off




Firewall-cmd -- list-services view all services




Firewall-cmd
Parameter
-- List-all,-service
-- Status
-- Reload: reload the firewall configuration file
-- Get-zones: Obtain the list of supported regions
-- Get-service: get all supported services


-- Get-icmptype


Set the default Region
-- Set-defualt-zone = <zone>

Add an interface to a region
Firewall-cmd [-- zone = zone] -- add-interface = <interface>


Modify the interface
-- Change

Delete an interface from a region
-- Remove

Check whether an interface exists in the region.
-- Query


-- Get-zone-of -- interface = <interface>

Add or delete a service
-- Add-service
-- Remove-service


Example:


Add service to whitelist
Firewall-cmd -- add-service = dhcp (temporarily effective)
Firewall-cmd -- permanent -- add-service = ftp (add -- permanent will be written to the default zone/etc/firewalld/zones/public. xml, and -- reload is required to load the configuration)
Firewall-cmd -- reload

Add Port
Firewall-cmd -- permanent -- zone = public -- add-port = 80/tcp

Enable the ip camouflage function in the region
-- Add-masquerade

Port ing

Firewall-cmd -- permanent -- add-forward-port = 33: proto = tcp: toport = 22: toaddr = 172.16.7.8

{: Toport = <port> [-<port>]} |: toaddr = <address >|{: toport = <port> [-<port>]: totoaddr = <address>}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.