ស្វែងយល់ពី Dynamic Firewall របស់ Redhat/CentOS 7
Firewall មានសារះសំខាន់ណាស់សម្រាប់ការប្រើប្រាស់ធ្វើជារនាំងការពារ Server ដើម្បីកុំអោយមានការលួចវាលុកឬធ្វើអោយ Service ណាមួយមិនដំណើរការនៅក្នុង Server។
Redhat/CentOS ដែលធ្លាប់តែប្រើប្រាស់ iptables ពេលនេះបានប្តូរមកប្រើប្រាស់ Dynamic Firewall ជំនួសវិញ។ ខាងក្រោមនេះជា Rule មួយចំនួនដែល Sysadmin គួរតែដឹងសម្រាប់ការងាររាល់ថ្ងៃ
systemctl restart firewalld សម្រាប់ Restart Service Firewall
systemctl enable firewalld សម្រាប់អោយ firewall ដំណើរការពេលបើកម៉ាស៊ីន
firewall-cmd –help សម្រាប់មើលពីរបៀបប្រើប្រាស់
firewall-cmd –get-default-zone សម្រាប់មើលពី Zone។ Zone ដូចជា Firewall Windows Profile នៅពេលដែលយើងភ្ជាប់ទៅកាន់ Wifi វាតែងសួរយើងថាជា Private Network ឬ Public Network ជាដើម។
ប្រសិនបើចង់មើលថាតើ Network Card របស់យើងស្ថិតនៅក្នុង Zone អ្វីត្រូវប្រើប្រាស់ Command
firewall-cmd –zone=public –list-all សម្រាប់មើលថាតើ Firewall បានត្រួតពិនិត្យលើ Service អ្វីខ្លះ?
ប្រសិនជាចង់ប្តូ Zone ទៅលើ interface Network ណាមួយអាចប្រើប្រាស់ Command ដូចខាងក្រោម
សម្រាប់ Server អ្នកមិនគួរប្ត Firewall Zone នោះទេ គួរតែធ្វើវាអោយទៅជាអចិន្ត្រៃយ៏ ដោយចូលទៅកែប្រែ File
vi /etc/sysconfig/network-scripts/ifcfg-eno16777736
firewall-cmd –get-services សម្រាប់ឆែកមើលតើមាន Service ប៉ុន្មាននៅក្នុង Server
បន្ទាប់មកយើងអាច Add Service នោះអោយទៅ firewall ដើម្បីត្រួតពិនិត្យបានហើយ
–permanent សម្រាប់ អោយវាជាអចិន្ត្រៃុយ៏
sudo firewall-cmd –zone=public –add-port=10000/tcp សម្រាប់ Add port 10000 និង protocol TCP
sudo firewall-cmd –zone=public –add-port=3000-5000/tcp សម្រាប់ Add port នៅចន្លោះ ៣០០០ ទៅ ៥០០០ ដោយប្រើប្រាស់ protocol TCP/IP
ប្រសិនចង់ Remove service ចេញពី Firewall វិញអាចប្រើប្រាស់ command ដូចខាងក្រោម
firewall-cmd –zone=home –remove-service=http –permanent
នៅពេលដែលយើង Remove ចេញពី Firewall នោះ Client មិនអាច Access មកកាន់ http server បាននោះទេ។
ប្រសិនបើចង់ Forward ពី port 80 ទៅកាន់ port 8080 ប្រើប្រាស់ command ខាងក្រោម
firewall-cmd –zone=”home” –add-forward-port=port=80:proto=tcp:toport=8080 –permanent
ប្រសិនបើអ្នកចង់អោយវា Forward បន្តទៅកាន់ Server ផ្សេងមួយទៀតត្រូវធ្វើដូចខាងក្រោមនេះ
firewall-cmd –zone=public –add-masquerade
firewall-cmd –zone=”home” –add-forward-port=port=80:proto=tcp:toport=8080:toaddr=10.5.5.2
ពេល request ទៅកាន់ port 80 វានិងរុញទៅកាន់ Server 10.5.5.2:8080
Rich Rule មានមុខងារច្រើនសម្រាប់ប្រើប្រាស់ ស៊ីជំរៅជាងធម្មតា។ Rich Rule មានមុខងាច្រើន RICHRULE
ខាងក្រោមនេះជាឧទាហរណ៏ខ្លះ អំពី ការប្រើប្រាស់Rich Rule
firewall-cmd –zone=home –add-rich-rule ‘rule family=”ipv4″ source address=192.168.1.2 accept’
សម្រាប់ Accept ipv4 traffic ចេញពី computer/device ដែលមាន IP 192.168.1.2
firewall-cmd –zone=home –add-rich-rule ‘rule family=”ipv4″ source address=”192.168.1.2″ port port=22 protocol=tcp reject’
សម្រាប់ ច្រានចោលសំណើរចេញពី Device: 192.168.1.2 ដែលប្រើប្រាស់ port 22 protocol tcp អាចជា ssh protocol។
firewall-cmd –zone=home–add-rich-rule ‘rule family=ipv4 source address=192.168.10.2 forward-port port=80 protocol=tcp to-port=8080’
សម្រាប់Forward request ចេញពី host 192.168.10.2 ទៅកាន់ port 80 របស់ Server ទៅកាន់ port 8080 របស់ Server ដោយប្រើប្រាស់ Protocol TCP/IP
firewall-cmd –zone=public –add-rich-rule ‘rule family=ipv4 forward-port port=80 protocol=tcp to-port=8080 to-addr=192.168.5.2’
សម្រាប់ Forward port 80 ទៅកាន់ Server 192.168.5.2 port 8080 ដោយប្រើប្រាស់ protocol TCP/IP
Leave ស្វែងយល់ពី Dynamic Firewall របស់ Redhat/CentOS 7 to:
Read more #cambodia posts
Best Posts From TechFree
We have not curated any of techfree's posts yet. But you can encourage our curation team to review posts by visiting them regularly and by referring other readers. Because we give priority to frequently read content.
More Posts From TechFree
- របៀបបង្កើត ទម្រង់ Login និង Logout ដោយប្រើប្រាស់ PHP ជាមួយ MySql
- របៀបដំឡើង Yii Framework
- របៀបទទួលទិន្នន័យពីអ្នកប្រើជាមួយ Vue.Js
- របៀបបង្កើត លុប កែប្រែ ឯកសារជាមួយ Python
- ស្វែងយល់ពី Array នៅក្នុងភាសា Ruby
- របៀបបង្កើត web server ជាមួយ Nodejs
- របៀបដំឡើង CodeIgniter
- របៀបដំណើរការ Admin Site ជាមួយ Django Framework
- ស្វែងយល់ពី Load Balance Web Server
- បង្កើត Logo ងាយៗជាមួយកម្មវិធី GIMP (វគ្គបញ្ចប់)
- របៀបបង្កើតកម្មវិធីមើលវេបសាយ Browser ជាមួយ Electron
- របៀបប្រើប្រាស់ Vue.js Javscript Framework
- របៀបតភ្ជាប់ MySQL Database ជាមួយ Django Framework
- ស្វែងយល់ពី String នៅក្នុងភាសា Ruby
- របៀបប្រើប្រាស់ Modal ក្នុង Bootstrap
- របៀបបង្កើត Autocomplete ជាមួយ JQuery UI
- របៀបប្រើប្រាស់ Dependency Manager សម្រាប់ការអភិវឌ្ឍកម្មវិធី iOS
- បង្កើត Menu ថ្មីដោយខ្លួនឯងនៅក្នុង Electron
- បង្កើត Logo ងាយៗជាមួយកម្មវិធី GIMP (វគ្គ ២)
- ស្វែងយល់ពី port Scan ដោយប្រើប្រាស់ nmap