Firewalld在启动时无法启动
我已使用以下命令安装了firewalld
和uninstalled ufw
:
sudo apt install firewall-applet sudo systemctl start firewalld sudo systemctl enable firewalld
它可以工作,但在重启时无法自行启动。
$ sudo systemctl status firewalld.service ● firewalld.service - firewalld - dynamic firewall daemon Loaded: loaded (/lib/systemd/system/firewalld.service; enabled; vendor preset Active: inactive (dead) May 10 18:39:03 Yyyy systemd[1]: Stopped firewalld - dynamic firewall daemon. lines 1-5/5 (END)
我的笔记本电脑正在运行Ubuntu 16.04 LTS。
sudo systemctl status iptables.service
的输出:
● iptables.service Loaded: not-found (Reason: No such file or directory) Active: inactive (dead)
Iptables已安装。 dpkg -s iptables
的输出
Package: iptables Status: install ok installed Priority: important Section: net Installed-Size: 1624 Maintainer: Ubuntu Developers Architecture: amd64 Version: 1.6.0-2ubuntu3 Depends: libxtables11 (= 1.6.0-2ubuntu3), libc6 (>= 2.14), libnfnetlink0 Description: administration tools for packet filtering and NAT iptables is the userspace command line program used to configure the Linux packet filtering ruleset. It is targeted towards system administrators. Since Network Address Translation is also configured from the packet filter ruleset, iptables is used for this, too. The iptables package also includes ip6tables. ip6tables is used for configuring the IPv6 packet filter Homepage: http://www.netfilter.org/ Original-Maintainer: iptables devel team
我试过sudo firewalld-cmd --runtime-to-parmanent
但是它没有帮助firewalld
在启动时启动。
谢谢
我在新安装的Ubuntu 16.04.4上遇到与OP相同的问题。
我检查了服务文件 – /lib/systemd/system/firewalld.service它说firewalld与iptables.service冲突ip6tables.service ebtables.service ipset.service
然后我发现安装并启用了ebtables.service; 禁用和屏蔽后
sudo systemctl disable ebtables sudo systemctl mask ebtables
firewalld可以在重新启动后没有任何其他脚本/技巧启动,因为它应该被启用。
所以我的问题的根本原因是 – ebtables.service阻止firewalld.service启动 。
在firewalld文档中略微戳了一下这个页面 。 您可能需要设置“永久配置”,该配置将在每次服务停止/重启或机器启动时加载。 firewall-cmd --runtime-to-permanent
将采用您现有的运行时配置(当然,一旦您正确设置并正常工作)并将其迁移到永久性。
这是我能提出的唯一建议; 希望它有所帮助。
在启动时启动防火墙的一种方法是使用cron使用@reboot
属性运行它:
打开一个终端并输入:
sudo crontab -e
在文件的末尾输入命令:
@reboot systemctl start firewalld
保存文件并退出。
每次计算机启动时,上面的命令都会运行一次命令。
UPDATE
方法2
如果您可以访问ubuntu的GUI,则通过点击开始按钮(Windows键)打开短划线。
键入startup Applications
,然后单击启动应用程序图标。
你会得到这样的屏幕:
单击Add按钮并添加命令,如下所示:
然后单击添加。
你已准备好出发。