Guide to Opening Port 80 and 443 in Firewall Print

  • error, setup
  • 0

[Tiếng Việt bên dưới]

What is FirewallD?

FirewallD is a powerful firewall solution that comes installed by default on RHEL 7 and CentOS 7 systems, designed to replace iptables with several fundamental differences:

FirewallD employs "zones" and "services" instead of "chains" and "rules" used in iptables. FirewallD manages automatically established rules that take effect immediately without disrupting existing connections and sessions.

Opening Ports 80 and 443 in FirewallD

With a firewall, you can open ports temporarily or permanently. Temporary rules are deleted upon system reboot. If you wish to open ports temporarily, you can use the following commands (the port will be closed if the system is rebooted):

firewall-cmd --zone=public --add-port=80/tcp

firewall-cmd --zone=public --add-port=443/tcp

To open ports permanently, use these commands:

firewall-cmd --permanent --zone=public --add-port=80/tcp

firewall-cmd --permanent --zone=public --add-port=443/tcp

The "--permanent" option ensures rules persist even after system restarts. Next, you'll need to reload FirewallD for the changes to take effect. To reload FirewallD, use this command:

firewall-cmd --reload

Mở Port 80 và 443 trong FirewallD

Viewing Rules

After adding rules, you can verify their successful addition by running the following command:

firewall-cmd --permanent --zone=public --list-ports

Removing Rules

If you want to remove added rules, you can use the following commands:

firewall-cmd --permanent --zone=public --remove-port=80/tcp

firewall-cmd --permanent --zone=public --remove-port=443/tcp

Next, execute the following command to apply the changes:

firewall-cmd --reload Conclusion

We hope that through the article "Guide to Open Ports 80 and 443 in Firewall," you have understood the steps to successfully open ports. If you have any questions or need assistance, feel free to contact Tothost at:

TOTHOST - Cloud At Your Fingertips

• Hotline: (+84) 24 6688 2221

• Email: contact@tothost.vn

• Website: https://tothost.vn/

• Telegram: @tothost

Read more instructional articles: https://tothost.vn/c/blog/huong-dan-su-dung/

[Tiếng Việt] Hướng dẫn mở Port 80 và 443 trong Firewall

FirewallD là gì?

FirewallD là giải pháp tường lửa mạnh mẽ  được cài đặt mặc định trên RHEL 7 và CentOS 7, nhằm thay thế Iptables với những khác biệt cơ bản:

  • FirewallD sử dụng “zones” và “services” thay vì “chain” và “rules” trong Iptables.
  • FirewallD quản lý các quy tắc được thiết lập tự động, có tác dụng ngay lập tức mà không làm mất đi các kết nối và session hiện có.

Cách mở Port 80 và 443 trong FirewallD

Sử dụng tường lửa, bạn có thể mở port tạm thời hoặc vĩnh viễn. Các rule tạm thời sẽ bị xóa sau khi khởi động lại hệ thống.

  • Nếu muốn mở bọn tạm thời các bạn dùng lệnh sau (Port sẽ bị đóng nếu khởi động lại hệ thống):

firewall-cmd --zone=public --add-port=80/tcp

firewall-cmd --zone=public --add-port=443/tcp

  • Để mở port vĩnh viến các bạn dùng lệnh sau:

firewall-cmd --permanent --zone=public --add-port=80/tcp

firewall-cmd --permanent --zone=public --add-port=443/tcp

Tùy chọn –permanent đảm bảo các rule vẫn được áp dụng kể cả khi khởi động lại hệ thống. Tiếp theo, các bạn sẽ cần phải reload lại FirewallD để thay đổi có hiệu lực. Để reload FirewallD các bạn sử dụng lệnh sau:

firewall-cmd --reload

Mở Port 80 và 443 trong FirewallD

Xem các rule

Sau khi thêm các rule, bạn có thể xác minh xem rule đã được thêm thành công hay chưa bằng cách chạy lệnh sau.

firewall-cmd --permanent --zone=public --list-ports

Xóa rule

Nếu bạn muốn xoá rule đã thêm các bạn có thể sử dụng lệnh như sau:

firewall-cmd --permanent --zone=public --remove-port=80/tcp

firewall-cmd --permanent --zone=public --remove-port=443/tcp

Tiếp theo, chạy lệnh sau để áp dụng các thay đổi:

firewall-cmd --reload

Kết luận

Hi vọng qua bài viết "Hướng dẫn mở port 80 và 443 trong Firewall" bạn đã có thể nắm được các bước và thực hiện thành công mở port. Nếu có thắc mắc nào cần được giải đáp hoặc vấn đề cần hỗ trợ các bạn có thể liên hệ Tothost tại:

TOTHOST - Cloud At Your Fingertips

• Hotline: (+84) 24 6688 2221

• Email: contact@tothost.vn

• Website: https://tothost.vn/

• Telegram: @tothost

Đọc thêm các bài viết hướng dẫn: https://tothost.vn/c/blog/huong-dan-su-dung/

 


Was this answer helpful?

« Back