{"id":9770,"date":"2025-03-12T11:43:49","date_gmt":"2025-03-12T04:43:49","guid":{"rendered":"https:\/\/www.jetorbit.com\/panduan\/?p=9770"},"modified":"2025-03-12T11:43:51","modified_gmt":"2025-03-12T04:43:51","slug":"cara-setting-firewall-vps","status":"publish","type":"post","link":"https:\/\/www.jetorbit.com\/panduan\/cara-setting-firewall-vps\/","title":{"rendered":"Cara Setting Firewall VPS: UFW, Firewalld, Allow Port, dan Allow Service Untuk IP Tertentu"},"content":{"rendered":"<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_81 counter-hierarchy ez-toc-counter ez-toc-grey ez-toc-container-direction\">\n<div class=\"ez-toc-title-container\">\n<p class=\"ez-toc-title\" style=\"cursor:inherit\">Daftar Isi Artikel<\/p>\n<span class=\"ez-toc-title-toggle\"><a href=\"#\" class=\"ez-toc-pull-right ez-toc-btn ez-toc-btn-xs ez-toc-btn-default ez-toc-toggle\" aria-label=\"Toggle Table of Content\"><span class=\"ez-toc-js-icon-con\"><span class=\"\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #999;color:#999\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewBox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #999;color:#999\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewBox=\"0 0 24 24\" version=\"1.2\" baseProfile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/span><\/a><\/span><\/div>\n<nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/www.jetorbit.com\/panduan\/cara-setting-firewall-vps\/#1_Mengenal_Firewall_VPS\" >1. Mengenal Firewall VPS<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/www.jetorbit.com\/panduan\/cara-setting-firewall-vps\/#2_Menggunakan_UFW_Uncomplicated_Firewall\" >2. Menggunakan UFW (Uncomplicated Firewall)<\/a><ul class='ez-toc-list-level-3' ><li class='ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/www.jetorbit.com\/panduan\/cara-setting-firewall-vps\/#a_Instalasi_UFW\" >a. Instalasi UFW<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/www.jetorbit.com\/panduan\/cara-setting-firewall-vps\/#b_Mengizinkan_Port_Tertentu\" >b. Mengizinkan Port Tertentu<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"https:\/\/www.jetorbit.com\/panduan\/cara-setting-firewall-vps\/#c_Membatasi_Akses_Berdasarkan_IP\" >c. Membatasi Akses Berdasarkan IP<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-6\" href=\"https:\/\/www.jetorbit.com\/panduan\/cara-setting-firewall-vps\/#d_Menutup_Akses_Semua_Koneksi_Kecuali_yang_Diperbolehkan\" >d. Menutup Akses Semua Koneksi Kecuali yang Diperbolehkan<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-7\" href=\"https:\/\/www.jetorbit.com\/panduan\/cara-setting-firewall-vps\/#e_Mengecek_dan_Menghapus_Aturan_di_UFW\" >e. Mengecek dan Menghapus Aturan di UFW<\/a><\/li><\/ul><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-8\" href=\"https:\/\/www.jetorbit.com\/panduan\/cara-setting-firewall-vps\/#3_Menggunakan_Firewalld\" >3. Menggunakan Firewalld<\/a><ul class='ez-toc-list-level-3' ><li class='ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-9\" href=\"https:\/\/www.jetorbit.com\/panduan\/cara-setting-firewall-vps\/#a_Instalasi_Firewalld\" >a. Instalasi Firewalld<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-10\" href=\"https:\/\/www.jetorbit.com\/panduan\/cara-setting-firewall-vps\/#b_Mengizinkan_Port_di_Firewalld\" >b. Mengizinkan Port di Firewalld<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-11\" href=\"https:\/\/www.jetorbit.com\/panduan\/cara-setting-firewall-vps\/#c_Mengizinkan_Layanan_di_Firewalld\" >c. Mengizinkan Layanan di Firewalld<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-12\" href=\"https:\/\/www.jetorbit.com\/panduan\/cara-setting-firewall-vps\/#d_Membatasi_Akses_Berdasarkan_IP\" >d. Membatasi Akses Berdasarkan IP<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-13\" href=\"https:\/\/www.jetorbit.com\/panduan\/cara-setting-firewall-vps\/#e_Mengecek_Aturan_Firewalld\" >e. Mengecek Aturan Firewalld<\/a><\/li><\/ul><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-14\" href=\"https:\/\/www.jetorbit.com\/panduan\/cara-setting-firewall-vps\/#4_Kesimpulan\" >4. Kesimpulan<\/a><\/li><\/ul><\/nav><\/div>\n\n<p>Mengamankan server <a href=\"https:\/\/www.jetorbit.com\/panduan\/tag\/vps\/\" data-type=\"post_tag\" data-id=\"553\">VPS <\/a>adalah langkah penting dalam mengelola infrastruktur digital. Salah satu cara terbaik untuk meningkatkan keamanan adalah dengan mengatur firewall. Firewall bertindak sebagai penghalang antara server dan ancaman eksternal, mengontrol traffic yang diizinkan maupun yang diblokir. panduan ini akan membahas cara setting firewall pada VPS menggunakan UFW dan Firewalld, termasuk cara mengizinkan port serta membatasi akses layanan hanya untuk IP tertentu(Service Allow by Certain IP).<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"1_Mengenal_Firewall_VPS\"><\/span>1. Mengenal Firewall VPS<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>Firewall adalah perangkat lunak atau perangkat keras yang bertugas menyaring traffic jaringan berdasarkan aturan yang telah ditentukan. Dengan firewall, traffic yang tidak diinginkan bisa diblokir, sehingga keamanan server meningkat.<\/p>\n\n\n\n<p>Di dunia VPS, ada dua firewall populer yang sering digunakan:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>UFW (Uncomplicated Firewall)<\/strong>: Firewall yang lebih sederhana dan cocok untuk pemula.<\/li>\n\n\n\n<li><strong>Firewalld<\/strong>: Firewall yang lebih fleksibel dengan pendekatan berbasis zona.<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"2_Menggunakan_UFW_Uncomplicated_Firewall\"><\/span>2. Menggunakan UFW (Uncomplicated Firewall)<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>UFW adalah frontend dari iptables yang dirancang agar lebih mudah digunakan. Untuk menggunakannya, pastikan UFW sudah terinstal di sistem.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"a_Instalasi_UFW\"><\/span>a. Instalasi UFW<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p>Jika UFW belum terinstal, gunakan perintah berikut:<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#1E1E1E\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"54\" height=\"14\" viewBox=\"0 0 54 14\"><g fill=\"none\" fill-rule=\"evenodd\" transform=\"translate(1 1)\"><circle cx=\"6\" cy=\"6\" r=\"6\" fill=\"#FF5F56\" stroke=\"#E0443E\" stroke-width=\".5\"><\/circle><circle cx=\"26\" cy=\"6\" r=\"6\" fill=\"#FFBD2E\" stroke=\"#DEA123\" stroke-width=\".5\"><\/circle><circle cx=\"46\" cy=\"6\" r=\"6\" fill=\"#27C93F\" stroke=\"#1AAB29\" stroke-width=\".5\"><\/circle><\/g><\/svg><\/span><span role=\"button\" tabindex=\"0\" data-code=\"sudo apt update &amp;&amp; sudo apt install ufw -y\" style=\"color:#D4D4D4;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki dark-plus\" style=\"background-color: #1E1E1E\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #9CDCFE\">sudo<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #9CDCFE\">apt<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #9CDCFE\">update<\/span><span style=\"color: #D4D4D4\"> &amp;&amp; <\/span><span style=\"color: #9CDCFE\">sudo<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #9CDCFE\">apt<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #9CDCFE\">install<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #9CDCFE\">ufw<\/span><span style=\"color: #D4D4D4\"> -<\/span><span style=\"color: #9CDCFE\">y<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<p>Setelah instalasi selesai, pastikan UFW dalam kondisi aktif:<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#1E1E1E\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"54\" height=\"14\" viewBox=\"0 0 54 14\"><g fill=\"none\" fill-rule=\"evenodd\" transform=\"translate(1 1)\"><circle cx=\"6\" cy=\"6\" r=\"6\" fill=\"#FF5F56\" stroke=\"#E0443E\" stroke-width=\".5\"><\/circle><circle cx=\"26\" cy=\"6\" r=\"6\" fill=\"#FFBD2E\" stroke=\"#DEA123\" stroke-width=\".5\"><\/circle><circle cx=\"46\" cy=\"6\" r=\"6\" fill=\"#27C93F\" stroke=\"#1AAB29\" stroke-width=\".5\"><\/circle><\/g><\/svg><\/span><span role=\"button\" tabindex=\"0\" data-code=\"sudo ufw enable\" style=\"color:#D4D4D4;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki dark-plus\" style=\"background-color: #1E1E1E\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #9CDCFE\">sudo<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #9CDCFE\">ufw<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #9CDCFE\">enable<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"b_Mengizinkan_Port_Tertentu\"><\/span>b. Mengizinkan Port Tertentu<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p>Misalnya, untuk mengizinkan akses SSH (port 22), gunakan perintah:<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#1E1E1E\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"54\" height=\"14\" viewBox=\"0 0 54 14\"><g fill=\"none\" fill-rule=\"evenodd\" transform=\"translate(1 1)\"><circle cx=\"6\" cy=\"6\" r=\"6\" fill=\"#FF5F56\" stroke=\"#E0443E\" stroke-width=\".5\"><\/circle><circle cx=\"26\" cy=\"6\" r=\"6\" fill=\"#FFBD2E\" stroke=\"#DEA123\" stroke-width=\".5\"><\/circle><circle cx=\"46\" cy=\"6\" r=\"6\" fill=\"#27C93F\" stroke=\"#1AAB29\" stroke-width=\".5\"><\/circle><\/g><\/svg><\/span><span role=\"button\" tabindex=\"0\" data-code=\"sudo ufw allow 22\/tcp\" style=\"color:#D4D4D4;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki dark-plus\" style=\"background-color: #1E1E1E\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #9CDCFE\">sudo<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #9CDCFE\">ufw<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #9CDCFE\">allow<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #B5CEA8\">22<\/span><span style=\"color: #D4D4D4\">\/<\/span><span style=\"color: #9CDCFE\">tcp<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<p>Untuk mengizinkan port lain, cukup ubah angka port sesuai kebutuhan, misalnya:<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#1E1E1E\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"54\" height=\"14\" viewBox=\"0 0 54 14\"><g fill=\"none\" fill-rule=\"evenodd\" transform=\"translate(1 1)\"><circle cx=\"6\" cy=\"6\" r=\"6\" fill=\"#FF5F56\" stroke=\"#E0443E\" stroke-width=\".5\"><\/circle><circle cx=\"26\" cy=\"6\" r=\"6\" fill=\"#FFBD2E\" stroke=\"#DEA123\" stroke-width=\".5\"><\/circle><circle cx=\"46\" cy=\"6\" r=\"6\" fill=\"#27C93F\" stroke=\"#1AAB29\" stroke-width=\".5\"><\/circle><\/g><\/svg><\/span><span role=\"button\" tabindex=\"0\" data-code=\"sudo ufw allow 80\/tcp  # HTTP\nsudo ufw allow 443\/tcp # HTTPS\" style=\"color:#D4D4D4;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki dark-plus\" style=\"background-color: #1E1E1E\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #9CDCFE\">sudo<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #9CDCFE\">ufw<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #9CDCFE\">allow<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #B5CEA8\">80<\/span><span style=\"color: #D4D4D4\">\/<\/span><span style=\"color: #9CDCFE\">tcp<\/span><span style=\"color: #D4D4D4\">  # <\/span><span style=\"color: #4FC1FF\">HTTP<\/span><\/span>\n<span class=\"line\"><span style=\"color: #9CDCFE\">sudo<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #9CDCFE\">ufw<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #9CDCFE\">allow<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #B5CEA8\">443<\/span><span style=\"color: #D4D4D4\">\/<\/span><span style=\"color: #9CDCFE\">tcp<\/span><span style=\"color: #D4D4D4\"> # <\/span><span style=\"color: #4FC1FF\">HTTPS<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"c_Membatasi_Akses_Berdasarkan_IP\"><\/span>c. Membatasi Akses Berdasarkan IP<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p>Untuk membatasi akses hanya dari IP tertentu, gunakan format berikut:<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#1E1E1E\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"54\" height=\"14\" viewBox=\"0 0 54 14\"><g fill=\"none\" fill-rule=\"evenodd\" transform=\"translate(1 1)\"><circle cx=\"6\" cy=\"6\" r=\"6\" fill=\"#FF5F56\" stroke=\"#E0443E\" stroke-width=\".5\"><\/circle><circle cx=\"26\" cy=\"6\" r=\"6\" fill=\"#FFBD2E\" stroke=\"#DEA123\" stroke-width=\".5\"><\/circle><circle cx=\"46\" cy=\"6\" r=\"6\" fill=\"#27C93F\" stroke=\"#1AAB29\" stroke-width=\".5\"><\/circle><\/g><\/svg><\/span><span role=\"button\" tabindex=\"0\" data-code=\"sudo ufw allow from 192.168.1.100 to any port 22\" style=\"color:#D4D4D4;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki dark-plus\" style=\"background-color: #1E1E1E\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #9CDCFE\">sudo<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #9CDCFE\">ufw<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #9CDCFE\">allow<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #9CDCFE\">from<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #B5CEA8\">192.168<\/span><span style=\"color: #D4D4D4\">.<\/span><span style=\"color: #B5CEA8\">1.100<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #9CDCFE\">to<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #9CDCFE\">any<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #9CDCFE\">port<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #B5CEA8\">22<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<p>Perintah ini hanya mengizinkan IP <code>192.168.1.100<\/code> untuk mengakses SSH.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"d_Menutup_Akses_Semua_Koneksi_Kecuali_yang_Diperbolehkan\"><\/span>d. Menutup Akses Semua Koneksi Kecuali yang Diperbolehkan<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p>Untuk memblokir semua traffic masuk secara default, jalankan:<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#1E1E1E\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"54\" height=\"14\" viewBox=\"0 0 54 14\"><g fill=\"none\" fill-rule=\"evenodd\" transform=\"translate(1 1)\"><circle cx=\"6\" cy=\"6\" r=\"6\" fill=\"#FF5F56\" stroke=\"#E0443E\" stroke-width=\".5\"><\/circle><circle cx=\"26\" cy=\"6\" r=\"6\" fill=\"#FFBD2E\" stroke=\"#DEA123\" stroke-width=\".5\"><\/circle><circle cx=\"46\" cy=\"6\" r=\"6\" fill=\"#27C93F\" stroke=\"#1AAB29\" stroke-width=\".5\"><\/circle><\/g><\/svg><\/span><span role=\"button\" tabindex=\"0\" data-code=\"sudo ufw default deny incoming\nsudo ufw default allow outgoing\" style=\"color:#D4D4D4;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki dark-plus\" style=\"background-color: #1E1E1E\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #9CDCFE\">sudo<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #9CDCFE\">ufw<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #C586C0\">default<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #9CDCFE\">deny<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #9CDCFE\">incoming<\/span><\/span>\n<span class=\"line\"><span style=\"color: #9CDCFE\">sudo<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #9CDCFE\">ufw<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #C586C0\">default<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #9CDCFE\">allow<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #9CDCFE\">outgoing<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<p>Dengan aturan ini, hanya traffic yang secara eksplisit diizinkan yang bisa masuk.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"e_Mengecek_dan_Menghapus_Aturan_di_UFW\"><\/span>e. Mengecek dan Menghapus Aturan di UFW<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p>Untuk melihat aturan yang telah dibuat:<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#1E1E1E\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"54\" height=\"14\" viewBox=\"0 0 54 14\"><g fill=\"none\" fill-rule=\"evenodd\" transform=\"translate(1 1)\"><circle cx=\"6\" cy=\"6\" r=\"6\" fill=\"#FF5F56\" stroke=\"#E0443E\" stroke-width=\".5\"><\/circle><circle cx=\"26\" cy=\"6\" r=\"6\" fill=\"#FFBD2E\" stroke=\"#DEA123\" stroke-width=\".5\"><\/circle><circle cx=\"46\" cy=\"6\" r=\"6\" fill=\"#27C93F\" stroke=\"#1AAB29\" stroke-width=\".5\"><\/circle><\/g><\/svg><\/span><span role=\"button\" tabindex=\"0\" data-code=\"sudo ufw status numbered\" style=\"color:#D4D4D4;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki dark-plus\" style=\"background-color: #1E1E1E\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #9CDCFE\">sudo<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #9CDCFE\">ufw<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #9CDCFE\">status<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #9CDCFE\">numbered<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<p>Jika ingin menghapus aturan tertentu, gunakan perintah berikut dengan mengganti angka dengan nomor aturan yang ingin dihapus:<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#1E1E1E\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"54\" height=\"14\" viewBox=\"0 0 54 14\"><g fill=\"none\" fill-rule=\"evenodd\" transform=\"translate(1 1)\"><circle cx=\"6\" cy=\"6\" r=\"6\" fill=\"#FF5F56\" stroke=\"#E0443E\" stroke-width=\".5\"><\/circle><circle cx=\"26\" cy=\"6\" r=\"6\" fill=\"#FFBD2E\" stroke=\"#DEA123\" stroke-width=\".5\"><\/circle><circle cx=\"46\" cy=\"6\" r=\"6\" fill=\"#27C93F\" stroke=\"#1AAB29\" stroke-width=\".5\"><\/circle><\/g><\/svg><\/span><span role=\"button\" tabindex=\"0\" data-code=\"sudo ufw delete 2\" style=\"color:#D4D4D4;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki dark-plus\" style=\"background-color: #1E1E1E\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #9CDCFE\">sudo<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #9CDCFE\">ufw<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #569CD6\">delete<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #B5CEA8\">2<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"3_Menggunakan_Firewalld\"><\/span>3. Menggunakan Firewalld<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>Firewalld adalah firewall default pada distribusi Linux berbasis RHEL (CentOS, Fedora). Firewalld menggunakan konsep zona untuk mengatur traffic.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"a_Instalasi_Firewalld\"><\/span>a. Instalasi Firewalld<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p>Pastikan Firewalld sudah terinstal:<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#1E1E1E\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"54\" height=\"14\" viewBox=\"0 0 54 14\"><g fill=\"none\" fill-rule=\"evenodd\" transform=\"translate(1 1)\"><circle cx=\"6\" cy=\"6\" r=\"6\" fill=\"#FF5F56\" stroke=\"#E0443E\" stroke-width=\".5\"><\/circle><circle cx=\"26\" cy=\"6\" r=\"6\" fill=\"#FFBD2E\" stroke=\"#DEA123\" stroke-width=\".5\"><\/circle><circle cx=\"46\" cy=\"6\" r=\"6\" fill=\"#27C93F\" stroke=\"#1AAB29\" stroke-width=\".5\"><\/circle><\/g><\/svg><\/span><span role=\"button\" tabindex=\"0\" data-code=\"sudo yum install firewalld -y\" style=\"color:#D4D4D4;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki dark-plus\" style=\"background-color: #1E1E1E\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #9CDCFE\">sudo<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #9CDCFE\">yum<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #9CDCFE\">install<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #9CDCFE\">firewalld<\/span><span style=\"color: #D4D4D4\"> -<\/span><span style=\"color: #9CDCFE\">y<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<p>Aktifkan dan jalankan layanan Firewalld:<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#1E1E1E\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"54\" height=\"14\" viewBox=\"0 0 54 14\"><g fill=\"none\" fill-rule=\"evenodd\" transform=\"translate(1 1)\"><circle cx=\"6\" cy=\"6\" r=\"6\" fill=\"#FF5F56\" stroke=\"#E0443E\" stroke-width=\".5\"><\/circle><circle cx=\"26\" cy=\"6\" r=\"6\" fill=\"#FFBD2E\" stroke=\"#DEA123\" stroke-width=\".5\"><\/circle><circle cx=\"46\" cy=\"6\" r=\"6\" fill=\"#27C93F\" stroke=\"#1AAB29\" stroke-width=\".5\"><\/circle><\/g><\/svg><\/span><span role=\"button\" tabindex=\"0\" data-code=\"sudo systemctl enable firewalld\nsudo systemctl start firewalld\" style=\"color:#D4D4D4;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki dark-plus\" style=\"background-color: #1E1E1E\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #9CDCFE\">sudo<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #9CDCFE\">systemctl<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #9CDCFE\">enable<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #9CDCFE\">firewalld<\/span><\/span>\n<span class=\"line\"><span style=\"color: #9CDCFE\">sudo<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #9CDCFE\">systemctl<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #9CDCFE\">start<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #9CDCFE\">firewalld<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"b_Mengizinkan_Port_di_Firewalld\"><\/span>b. Mengizinkan Port di Firewalld<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p>Untuk mengizinkan port tertentu, gunakan perintah berikut:<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#1E1E1E\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"54\" height=\"14\" viewBox=\"0 0 54 14\"><g fill=\"none\" fill-rule=\"evenodd\" transform=\"translate(1 1)\"><circle cx=\"6\" cy=\"6\" r=\"6\" fill=\"#FF5F56\" stroke=\"#E0443E\" stroke-width=\".5\"><\/circle><circle cx=\"26\" cy=\"6\" r=\"6\" fill=\"#FFBD2E\" stroke=\"#DEA123\" stroke-width=\".5\"><\/circle><circle cx=\"46\" cy=\"6\" r=\"6\" fill=\"#27C93F\" stroke=\"#1AAB29\" stroke-width=\".5\"><\/circle><\/g><\/svg><\/span><span role=\"button\" tabindex=\"0\" data-code=\"sudo firewall-cmd --permanent --add-port=22\/tcp\nsudo firewall-cmd --permanent --add-port=80\/tcp\nsudo firewall-cmd --permanent --add-port=443\/tcp\" style=\"color:#D4D4D4;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki dark-plus\" style=\"background-color: #1E1E1E\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #9CDCFE\">sudo<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #9CDCFE\">firewall<\/span><span style=\"color: #D4D4D4\">-<\/span><span style=\"color: #9CDCFE\">cmd<\/span><span style=\"color: #D4D4D4\"> --<\/span><span style=\"color: #9CDCFE\">permanent<\/span><span style=\"color: #D4D4D4\"> --<\/span><span style=\"color: #9CDCFE\">add<\/span><span style=\"color: #D4D4D4\">-<\/span><span style=\"color: #9CDCFE\">port<\/span><span style=\"color: #D4D4D4\">=<\/span><span style=\"color: #B5CEA8\">22<\/span><span style=\"color: #D4D4D4\">\/<\/span><span style=\"color: #9CDCFE\">tcp<\/span><\/span>\n<span class=\"line\"><span style=\"color: #9CDCFE\">sudo<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #9CDCFE\">firewall<\/span><span style=\"color: #D4D4D4\">-<\/span><span style=\"color: #9CDCFE\">cmd<\/span><span style=\"color: #D4D4D4\"> --<\/span><span style=\"color: #9CDCFE\">permanent<\/span><span style=\"color: #D4D4D4\"> --<\/span><span style=\"color: #9CDCFE\">add<\/span><span style=\"color: #D4D4D4\">-<\/span><span style=\"color: #9CDCFE\">port<\/span><span style=\"color: #D4D4D4\">=<\/span><span style=\"color: #B5CEA8\">80<\/span><span style=\"color: #D4D4D4\">\/<\/span><span style=\"color: #9CDCFE\">tcp<\/span><\/span>\n<span class=\"line\"><span style=\"color: #9CDCFE\">sudo<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #9CDCFE\">firewall<\/span><span style=\"color: #D4D4D4\">-<\/span><span style=\"color: #9CDCFE\">cmd<\/span><span style=\"color: #D4D4D4\"> --<\/span><span style=\"color: #9CDCFE\">permanent<\/span><span style=\"color: #D4D4D4\"> --<\/span><span style=\"color: #9CDCFE\">add<\/span><span style=\"color: #D4D4D4\">-<\/span><span style=\"color: #9CDCFE\">port<\/span><span style=\"color: #D4D4D4\">=<\/span><span style=\"color: #B5CEA8\">443<\/span><span style=\"color: #D4D4D4\">\/<\/span><span style=\"color: #9CDCFE\">tcp<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<p>Setelah itu, restart Firewalld agar perubahan diterapkan:<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#1E1E1E\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"54\" height=\"14\" viewBox=\"0 0 54 14\"><g fill=\"none\" fill-rule=\"evenodd\" transform=\"translate(1 1)\"><circle cx=\"6\" cy=\"6\" r=\"6\" fill=\"#FF5F56\" stroke=\"#E0443E\" stroke-width=\".5\"><\/circle><circle cx=\"26\" cy=\"6\" r=\"6\" fill=\"#FFBD2E\" stroke=\"#DEA123\" stroke-width=\".5\"><\/circle><circle cx=\"46\" cy=\"6\" r=\"6\" fill=\"#27C93F\" stroke=\"#1AAB29\" stroke-width=\".5\"><\/circle><\/g><\/svg><\/span><span role=\"button\" tabindex=\"0\" data-code=\"sudo firewall-cmd --reload\" style=\"color:#D4D4D4;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki dark-plus\" style=\"background-color: #1E1E1E\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #9CDCFE\">sudo<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #9CDCFE\">firewall<\/span><span style=\"color: #D4D4D4\">-<\/span><span style=\"color: #9CDCFE\">cmd<\/span><span style=\"color: #D4D4D4\"> --<\/span><span style=\"color: #9CDCFE\">reload<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"c_Mengizinkan_Layanan_di_Firewalld\"><\/span>c. Mengizinkan Layanan di Firewalld<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p>Firewalld juga mendukung pengelolaan layanan secara langsung. Misalnya, untuk mengizinkan HTTP dan HTTPS:<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#1E1E1E\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"54\" height=\"14\" viewBox=\"0 0 54 14\"><g fill=\"none\" fill-rule=\"evenodd\" transform=\"translate(1 1)\"><circle cx=\"6\" cy=\"6\" r=\"6\" fill=\"#FF5F56\" stroke=\"#E0443E\" stroke-width=\".5\"><\/circle><circle cx=\"26\" cy=\"6\" r=\"6\" fill=\"#FFBD2E\" stroke=\"#DEA123\" stroke-width=\".5\"><\/circle><circle cx=\"46\" cy=\"6\" r=\"6\" fill=\"#27C93F\" stroke=\"#1AAB29\" stroke-width=\".5\"><\/circle><\/g><\/svg><\/span><span role=\"button\" tabindex=\"0\" data-code=\"sudo firewall-cmd --permanent --add-service=http\nsudo firewall-cmd --permanent --add-service=https\" style=\"color:#D4D4D4;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki dark-plus\" style=\"background-color: #1E1E1E\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #9CDCFE\">sudo<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #9CDCFE\">firewall<\/span><span style=\"color: #D4D4D4\">-<\/span><span style=\"color: #9CDCFE\">cmd<\/span><span style=\"color: #D4D4D4\"> --<\/span><span style=\"color: #9CDCFE\">permanent<\/span><span style=\"color: #D4D4D4\"> --<\/span><span style=\"color: #9CDCFE\">add<\/span><span style=\"color: #D4D4D4\">-<\/span><span style=\"color: #9CDCFE\">service<\/span><span style=\"color: #D4D4D4\">=<\/span><span style=\"color: #9CDCFE\">http<\/span><\/span>\n<span class=\"line\"><span style=\"color: #9CDCFE\">sudo<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #9CDCFE\">firewall<\/span><span style=\"color: #D4D4D4\">-<\/span><span style=\"color: #9CDCFE\">cmd<\/span><span style=\"color: #D4D4D4\"> --<\/span><span style=\"color: #9CDCFE\">permanent<\/span><span style=\"color: #D4D4D4\"> --<\/span><span style=\"color: #9CDCFE\">add<\/span><span style=\"color: #D4D4D4\">-<\/span><span style=\"color: #9CDCFE\">service<\/span><span style=\"color: #D4D4D4\">=<\/span><span style=\"color: #9CDCFE\">https<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"d_Membatasi_Akses_Berdasarkan_IP\"><\/span>d. Membatasi Akses Berdasarkan IP<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p>Untuk membatasi akses hanya dari IP tertentu, gunakan perintah berikut:<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#1E1E1E\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"54\" height=\"14\" viewBox=\"0 0 54 14\"><g fill=\"none\" fill-rule=\"evenodd\" transform=\"translate(1 1)\"><circle cx=\"6\" cy=\"6\" r=\"6\" fill=\"#FF5F56\" stroke=\"#E0443E\" stroke-width=\".5\"><\/circle><circle cx=\"26\" cy=\"6\" r=\"6\" fill=\"#FFBD2E\" stroke=\"#DEA123\" stroke-width=\".5\"><\/circle><circle cx=\"46\" cy=\"6\" r=\"6\" fill=\"#27C93F\" stroke=\"#1AAB29\" stroke-width=\".5\"><\/circle><\/g><\/svg><\/span><span role=\"button\" tabindex=\"0\" data-code=\"sudo firewall-cmd --permanent --add-rich-rule='rule family=&quot;ipv4&quot; source address=&quot;192.168.1.100&quot; port protocol=&quot;tcp&quot; port=&quot;22&quot; accept'\" style=\"color:#D4D4D4;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki dark-plus\" style=\"background-color: #1E1E1E\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #9CDCFE\">sudo<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #9CDCFE\">firewall<\/span><span style=\"color: #D4D4D4\">-<\/span><span style=\"color: #9CDCFE\">cmd<\/span><span style=\"color: #D4D4D4\"> --<\/span><span style=\"color: #9CDCFE\">permanent<\/span><span style=\"color: #D4D4D4\"> --<\/span><span style=\"color: #9CDCFE\">add<\/span><span style=\"color: #D4D4D4\">-<\/span><span style=\"color: #9CDCFE\">rich<\/span><span style=\"color: #D4D4D4\">-<\/span><span style=\"color: #9CDCFE\">rule<\/span><span style=\"color: #D4D4D4\">=<\/span><span style=\"color: #CE9178\">&#39;rule family=&quot;ipv4&quot; source address=&quot;192.168.1.100&quot; port protocol=&quot;tcp&quot; port=&quot;22&quot; accept&#39;<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<p>Perintah ini hanya mengizinkan IP <code>192.168.1.100<\/code> untuk mengakses SSH.<\/p>\n\n\n\n<p>Jika ingin menghapus aturan, gunakan:<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#1E1E1E\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"54\" height=\"14\" viewBox=\"0 0 54 14\"><g fill=\"none\" fill-rule=\"evenodd\" transform=\"translate(1 1)\"><circle cx=\"6\" cy=\"6\" r=\"6\" fill=\"#FF5F56\" stroke=\"#E0443E\" stroke-width=\".5\"><\/circle><circle cx=\"26\" cy=\"6\" r=\"6\" fill=\"#FFBD2E\" stroke=\"#DEA123\" stroke-width=\".5\"><\/circle><circle cx=\"46\" cy=\"6\" r=\"6\" fill=\"#27C93F\" stroke=\"#1AAB29\" stroke-width=\".5\"><\/circle><\/g><\/svg><\/span><span role=\"button\" tabindex=\"0\" data-code=\"sudo firewall-cmd --permanent --remove-rich-rule='rule family=&quot;ipv4&quot; source address=&quot;192.168.1.100&quot; port protocol=&quot;tcp&quot; port=&quot;22&quot; accept'\" style=\"color:#D4D4D4;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki dark-plus\" style=\"background-color: #1E1E1E\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #9CDCFE\">sudo<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #9CDCFE\">firewall<\/span><span style=\"color: #D4D4D4\">-<\/span><span style=\"color: #9CDCFE\">cmd<\/span><span style=\"color: #D4D4D4\"> --<\/span><span style=\"color: #9CDCFE\">permanent<\/span><span style=\"color: #D4D4D4\"> --<\/span><span style=\"color: #9CDCFE\">remove<\/span><span style=\"color: #D4D4D4\">-<\/span><span style=\"color: #9CDCFE\">rich<\/span><span style=\"color: #D4D4D4\">-<\/span><span style=\"color: #9CDCFE\">rule<\/span><span style=\"color: #D4D4D4\">=<\/span><span style=\"color: #CE9178\">&#39;rule family=&quot;ipv4&quot; source address=&quot;192.168.1.100&quot; port protocol=&quot;tcp&quot; port=&quot;22&quot; accept&#39;<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"e_Mengecek_Aturan_Firewalld\"><\/span>e. Mengecek Aturan Firewalld<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p>Untuk melihat aturan yang telah diterapkan:<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#1E1E1E\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"54\" height=\"14\" viewBox=\"0 0 54 14\"><g fill=\"none\" fill-rule=\"evenodd\" transform=\"translate(1 1)\"><circle cx=\"6\" cy=\"6\" r=\"6\" fill=\"#FF5F56\" stroke=\"#E0443E\" stroke-width=\".5\"><\/circle><circle cx=\"26\" cy=\"6\" r=\"6\" fill=\"#FFBD2E\" stroke=\"#DEA123\" stroke-width=\".5\"><\/circle><circle cx=\"46\" cy=\"6\" r=\"6\" fill=\"#27C93F\" stroke=\"#1AAB29\" stroke-width=\".5\"><\/circle><\/g><\/svg><\/span><span role=\"button\" tabindex=\"0\" data-code=\"sudo firewall-cmd --list-all\" style=\"color:#D4D4D4;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki dark-plus\" style=\"background-color: #1E1E1E\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #9CDCFE\">sudo<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #9CDCFE\">firewall<\/span><span style=\"color: #D4D4D4\">-<\/span><span style=\"color: #9CDCFE\">cmd<\/span><span style=\"color: #D4D4D4\"> --<\/span><span style=\"color: #9CDCFE\">list<\/span><span style=\"color: #D4D4D4\">-<\/span><span style=\"color: #9CDCFE\">all<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<p>Jika ingin melihat aturan dalam zona tertentu, gunakan:<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#1E1E1E\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"54\" height=\"14\" viewBox=\"0 0 54 14\"><g fill=\"none\" fill-rule=\"evenodd\" transform=\"translate(1 1)\"><circle cx=\"6\" cy=\"6\" r=\"6\" fill=\"#FF5F56\" stroke=\"#E0443E\" stroke-width=\".5\"><\/circle><circle cx=\"26\" cy=\"6\" r=\"6\" fill=\"#FFBD2E\" stroke=\"#DEA123\" stroke-width=\".5\"><\/circle><circle cx=\"46\" cy=\"6\" r=\"6\" fill=\"#27C93F\" stroke=\"#1AAB29\" stroke-width=\".5\"><\/circle><\/g><\/svg><\/span><span role=\"button\" tabindex=\"0\" data-code=\"sudo firewall-cmd --zone=public --list-all\" style=\"color:#D4D4D4;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki dark-plus\" style=\"background-color: #1E1E1E\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #9CDCFE\">sudo<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #9CDCFE\">firewall<\/span><span style=\"color: #D4D4D4\">-<\/span><span style=\"color: #9CDCFE\">cmd<\/span><span style=\"color: #D4D4D4\"> --<\/span><span style=\"color: #9CDCFE\">zone<\/span><span style=\"color: #D4D4D4\">=<\/span><span style=\"color: #9CDCFE\">public<\/span><span style=\"color: #D4D4D4\"> --<\/span><span style=\"color: #9CDCFE\">list<\/span><span style=\"color: #D4D4D4\">-<\/span><span style=\"color: #9CDCFE\">all<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"4_Kesimpulan\"><\/span>4. Kesimpulan<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>Mengatur firewall pada VPS adalah langkah penting dalam meningkatkan keamanan server. Dengan UFW, pengelolaan firewall menjadi lebih mudah, sedangkan Firewalld menawarkan fleksibilitas lebih tinggi dengan pendekatan berbasis zona.<\/p>\n\n\n\n<p>Beberapa hal yang perlu diperhatikan:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Gunakan UFW jika menginginkan firewall yang simpel dan mudah dikonfigurasi.<\/li>\n\n\n\n<li>Gunakan Firewalld jika membutuhkan manajemen zona yang lebih kompleks.<\/li>\n\n\n\n<li>Selalu cek aturan yang diterapkan untuk menghindari pemblokiran yang tidak disengaja.<\/li>\n<\/ul>\n\n\n\n<p>Dengan mengikuti langkah-langkah di atas, keamanan VPS bisa lebih terjaga dari ancaman yang tidak diinginkan.<\/p>\n\n\n\n<p class=\"has-white-color has-midnight-gradient-background has-text-color has-background has-link-color has-medium-font-size wp-elements-e372e49135fcab98bf5287be70b753fe\" style=\"border-radius:10px\">Deploy <a href=\"https:\/\/www.jetorbit.com\/cloud-vps\/\">Cloud VPS<\/a> di Jetorbit dan dapatkan diskon 20% langsung!<\/p>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Mengamankan server VPS adalah langkah penting dalam mengelola infrastruktur digital. Salah satu cara terbaik untuk meningkatkan keamanan adalah dengan mengatur firewall. Firewall bertindak sebagai penghalang antara server dan ancaman eksternal, mengontrol traffic yang diizinkan maupun yang diblokir. panduan ini akan membahas cara setting firewall pada VPS menggunakan UFW dan Firewalld, termasuk cara mengizinkan port serta [&hellip;]<\/p>\n","protected":false},"author":7,"featured_media":9788,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[488],"tags":[708,553],"class_list":["post-9770","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-vps","tag-firewall","tag-vps"],"_links":{"self":[{"href":"https:\/\/www.jetorbit.com\/panduan\/wp-json\/wp\/v2\/posts\/9770","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.jetorbit.com\/panduan\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.jetorbit.com\/panduan\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.jetorbit.com\/panduan\/wp-json\/wp\/v2\/users\/7"}],"replies":[{"embeddable":true,"href":"https:\/\/www.jetorbit.com\/panduan\/wp-json\/wp\/v2\/comments?post=9770"}],"version-history":[{"count":4,"href":"https:\/\/www.jetorbit.com\/panduan\/wp-json\/wp\/v2\/posts\/9770\/revisions"}],"predecessor-version":[{"id":9831,"href":"https:\/\/www.jetorbit.com\/panduan\/wp-json\/wp\/v2\/posts\/9770\/revisions\/9831"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.jetorbit.com\/panduan\/wp-json\/wp\/v2\/media\/9788"}],"wp:attachment":[{"href":"https:\/\/www.jetorbit.com\/panduan\/wp-json\/wp\/v2\/media?parent=9770"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.jetorbit.com\/panduan\/wp-json\/wp\/v2\/categories?post=9770"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.jetorbit.com\/panduan\/wp-json\/wp\/v2\/tags?post=9770"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}