Betariko.com – Penggunaan fitur firewall VPS Cloud dan on premies terbilang cukup penting. Karena memberikan kontrok network apa saja yang diizinkan, untuk mengakses fitur yang ada di server.
yum install firewalld
systemctl start firewalldsystemctl enable firewalldsystemctl status firewalldMengecek status firewall
firewall-cmd –state
firewall-cmd –permanent –new-zone=namazone
firewall-cmd –permanent –delete-zone=namazone
firewall-cmd –list-all-zones
firewall-cmd –zone=public –list-all
Perintah Menampilan zona bawaan atau default zone
firewall-cmd –get-default-zone
firewall-cmd –set-default-zone=public
firewall-cmd –get-active-zone
Perintah Menambahkan interface pada zone
firewall-cmd –zone=public –add-interface=eth0
firewall-cmd –zone=public –change-interface=eth1
firewall-cmd –get-zone-of-interface=eth0
firewall-cmd –get-services
firewall-cmd –zone=public –list-services
firewall-cmd –zone=public –add-service=http
firewall-cmd –permanent –zone=public –add-service=http
firewall-cmd –reload
firewall-cmd –zone=public –remove-service=http
nano /usr/lib/firewalld/services/ssh.xml
<?xml version=”1.0″ encoding=”utf-8″?><service><short>SSH</short><description>Secure Shell (SSH) is a xxxxxxxxxxxxxxxxxxxxxxxxxxxxx.</description><port protocol=”tcp” port=”22″/></service>
cp /usr/lib/firewalld/services/ssh.xml /etc/firewalld/services/example.xml
<?xml version=”1.0″ encoding=”utf-8″?><service><short>Example Service</short><description>This is just an example service. yyyyyyyyyyyyyyyyyyyyyyy.</description><port protocol=”tcp” port=”7777″/><port protocol=”udp” port=”8888″/></service>
firewall-cmd –reloadfirewall-cmd –get-services
firewall-cmd –zone=public –list-ports
firewall-cmd –zone=public –add-port=5001/udp
firewall-cmd –zone=public –add-port=5001/tcp
firewall-cmd –zone=public –add-port=4990-4999/udp
firewall-cmd –zone=public –remove-port=5001/tcp
firewall-cmd –zone=public –add-forward-port=port=53:proto=tcp:toport=xxxxx
firewall-cmd –zone=public –add-masqueradefirewall-cmd –zone=public –add-forward-port=port=53:proto=tcp:toport=5353:toaddr=1.x.x.x
firewall-cmd –list-rich-rulesIzinkan koneksi jaringan dari IP 192.167.0.14
firewall-cmd –zone=public –add-rich-rule ‘rule family=ipv4 source address=192.167.2.10 port port=22 protocol=tcp reject’
firewall-cmd –zone=public –add-rich-rule ‘rule family=ipv4 source address=10.12.0.3 forward-port port=53 protocol=tcp to-port=6532’
firewall-cmd –zone=public –add-rich-rule ‘rule family=ipv4 forward-port port=53 protocol=tcp to-port=5353 to-addr=172.33.4.2’
firewall-cmd –zone=public –add-rich-rule ‘rule family=ipv4 source address=192.167.0.0/24 service name=https accept’
firewall-cmd –get-ipsets
firewall-cmd –permanent –new-ipset=blacklist –type=hash:ipfirewall-cmd –reload
firewall-cmd –ipset=blacklist –add-entry=192.167.1.11firewall-cmd –ipset=blacklist –add-entry=192.167.1.12
firewall-cmd –ipset=blacklist –remove-entry=192.167.1.12
firewall-cmd –info-ipset=blacklist
firewall-cmd –ipset=blacklist –get-entries
firewall-cmd –add-rich-rule=’rule source ipset=blacklist drop’
firewall-cmd –permanent –delete-ipset=blacklistfirewall-cmd –reload
Demikian semoga ulasan cara setting firewall linux Centos dapat memberikan manfaat bagi kamu yang ingin melakukan penyesuaian pada firewall server Linux Centos.