Linux Learning Notes (33) iptables Backup, Firewalld

Source: Internet
Author: User

I. Saving and backing up iptables rules

Service Iptables Save//rules will be saved to/etc/sysconfig/iptables iptables-save > My.ipt//iptables rules back to My.ipt file iptabl Es-restore < My.ipt//restore Backup rules

Second, FIREWALLD

Open Firewalld

Systemctl Disable Iptablessystemctl Stop iptablessystemctl enable Firewalldsystemctl start Firewalldfirewalld default 9 zone default zone is Publicfirewall-cmd--get-zones//View all zones Note: There is no space in the middle of the firewall-cmd,-- Get-zones no space in the middle Firewall-cmd--get-default-zone//view default Zone



Firewall-cmd--set-default-zone=work//Set Default zone Firewall-cmd--GET-ZONE-OF-INTERFACE=ENS33//check specified net Card firewall-cmd--zone=public--add-interface=ens37//Set zone Firewall-cmd--ZONE=DMZ--CHANGE-INTERFACE=ENS37 for the specified NIC                     /change Zone Firewall-cmd--ZONE=DMZ--REMOVE-INTERFACE=ENS37//For network card remove zone Firewall-cmd--get-active-zones View the zone where all network cards are located


Third, servies

Firewall-cmd--get-services//View all servies firewall-cmd--list-services See what service is in the current zone

Firewall-cmd--zone=public--add-service=http//Add HTTP to the public zone Firewall-cmd--zone=public--remove-service=h TTP//Remove HTTP from below public zone

ls/usr/lib/firewalld/zones///zone configuration file Template/usr/lib/firewalld/services/ Services template Firewall-cmd--zone=public--add-service=http--permanent//Change profile, then generate configuration file under/etc/firewalld/zones directory


Requirements: FTP Service custom port 1121, need to release FTP under work zone

Cp/usr/lib/firewalld/services/ftp.xml/etc/firewalld/services vi/etc/firewalld/services/ftp.xml//change 21 to 1121 CP/USR /lib/firewalld/zones/work.xml/etc/firewalld/zones/vi/etc/firewalld/zones/work.xml//Add a line <service name= "ftp"/ > Firewall-cmd--reload//reload Firewall-cmd--zone=work--list-services







Linux Learning Notes (33) iptables Backup, Firewalld

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.