![Debian systemd 防火墙还是firewalld?](https://linux22.com/image/193761/Debian%20systemd%20%E9%98%B2%E7%81%AB%E5%A2%99%E8%BF%98%E6%98%AFfirewalld%EF%BC%9F.png)
我在 Debian 10 Buster 的防火墙配置方面遇到了一些问题:
[agp@debian10 ~]$ systemctl status firewalld
● firewalld.service - firewalld - dynamic firewall daemon
Loaded: loaded (/lib/systemd/system/firewalld.service; enabled; vendor preset: enabled)
Active: active (running) since Sat 2021-07-31 07:12:13 CEST; 16min ago
Docs: man:firewalld(1)
Main PID: 721 (firewalld)
Tasks: 2 (limit: 4915)
Memory: 43.6M
CGroup: /system.slice/firewalld.service
└─721 /usr/bin/python3 /usr/sbin/firewalld --nofork --nopid
[agp@debian10 ~]$ systemctl status nftables.service
● nftables.service - nftables
Loaded: loaded (/lib/systemd/system/nftables.service; enabled; vendor preset: enabled)
Active: active (exited) since Sat 2021-07-31 07:12:06 CEST; 16min ago
Docs: man:nft(8)
http://wiki.nftables.org
Process: 387 ExecStart=/usr/sbin/nft -f /etc/nftables.conf (code=exited, status=0/SUCCESS)
Main PID: 387 (code=exited, status=0/SUCCESS)
然而,当检查 systemd 时,它报告“降级”:
● debian10
State: degraded
Jobs: 0 queued
Failed: 1 units
并检查问题:
[agp@debian10 ~]$ systemctl | grep fail
● firewall.service loaded failed failed Add Firewall Rules to iptables
我检查了几个不同的论坛和 Debian Wiki 页面,只是对有关 iptables 设置和 nftable 配置的已弃用信息感到更加困惑,这些信息已取代 Debian Buster 中的 iptables。
但这是我的问题的开始:
为什么我的系统上有 2 个防火墙服务,它们的作用是什么?
[agp@debian10 ~]$ systemctl status firewall
● firewall.service - Add Firewall Rules to iptables
Loaded: loaded (/etc/systemd/system/firewall.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Sat 2021-07-31 07:12:10 CEST; 2h 35min ago
Process: 720 ExecStart=/etc/firewall/enable.sh (code=exited, status=203/EXEC)
Main PID: 720 (code=exited, status=203/EXEC)
[agp@debian10 ~]$ systemctl status firewalld
● firewalld.service - firewalld - dynamic firewall daemon
Loaded: loaded (/lib/systemd/system/firewalld.service; enabled; vendor preset: enabled)
Active: active (running) since Sat 2021-07-31 07:12:13 CEST; 2h 35min ago
Docs: man:firewalld(1)
Main PID: 721 (firewalld)
Tasks: 2 (limit: 4915)
Memory: 44.9M
CGroup: /system.slice/firewalld.service
└─721 /usr/bin/python3 /usr/sbin/firewalld --nofork --nopid
firewall.service 是否需要使用 iptables 配置,或者是否会与正在运行的 firewalld.service 设置发生冲突?
我感谢您的考虑、建议和关注。干杯!
答案1
这firewalld.service
是在安装firwalld
包时创建的。
withfirewall.service
和ExecStart=/etc/firewall/enable.sh
Description:Add Firewall Rules to iptables
是手动创建的。中提到了相同的服务Debian 维基(参见示例脚本)