在新安装的 ubuntu 16.04 上尝试安装 ufw 时出错

在新安装的 ubuntu 16.04 上尝试安装 ufw 时出错

在安装 nginx、php、mysql 后,在全新安装的 Ubuntu 16.04 LTS 上,我尝试安装 ufw。

首先,当我尝试允许端口 22/OpenSSH 时,我遇到了 iptables 错误。

ERROR: initcaps
[Errno 2] iptables: Memory allocation problem.

经过一番研究,我尝试了命令

iptables -F
iptables -X

然后再次运行该命令。现在它似乎起作用了。

然后我尝试运行 sudo nfw enable 但不幸的是我不断收到此错误消息:

sudo ufw enable
Command may disrupt existing ssh connections. Proceed with operation (y|n)? y
ERROR: problem running ufw-init
modprobe: ERROR: ../libkmod/libkmod.c:514 lookup_builtin_file() could not open builtin file '/lib/modules/4.4.0-042stab127.2/modules.builtin.bin'
modprobe: FATAL: Module nf_conntrack_ftp not found in directory /lib/modules/4.4.0-042stab127.2
modprobe: ERROR: ../libkmod/libkmod.c:514 lookup_builtin_file() could not open builtin file '/lib/modules/4.4.0-042stab127.2/modules.builtin.bin'
modprobe: FATAL: Module nf_nat_ftp not found in directory /lib/modules/4.4.0-042stab127.2
modprobe: ERROR: ../libkmod/libkmod.c:514 lookup_builtin_file() could not open builtin file '/lib/modules/4.4.0-042stab127.2/modules.builtin.bin'
modprobe: FATAL: Module nf_conntrack_netbios_ns not found in directory /lib/modules/4.4.0-042stab127.2
iptables-restore: line 30 failed
iptables-restore: line 10 failed
iptables-restore: line 42 failed
iptables-restore v1.6.0: Couldn't load target `ufw-user-input':No such file or directory

Error occurred at line: 2
Try `iptables-restore -h' or 'iptables-restore --help' for more information.
ip6tables-restore: line 42 failed
ip6tables-restore: line 2 failed
ip6tables-restore: line 8 failed
ip6tables-restore: line 138 failed
ip6tables-restore v1.6.0: Couldn't load target `ufw6-skip-to-policy-input':No such file or directory

Error occurred at line: 19
Try `ip6tables-restore -h' or 'ip6tables-restore --help' for more information.
ip6tables-restore: line 10 failed
ip6tables-restore: line 42 failed
ip6tables-restore v1.6.0: Couldn't load target `ufw6-user-input':No such file or directory

Error occurred at line: 2
Try `ip6tables-restore -h' or 'ip6tables-restore --help' for more information.
sysctl: permission denied on key 'net.ipv4.tcp_sack'

Problem running '/etc/ufw/after.rules'
Problem running '/etc/ufw/user.rules'
Problem running '/etc/ufw/before6.rules'
Problem running '/etc/ufw/after6.rules'
Problem running '/etc/ufw/user6.rules' 

我对此还很陌生,所以我真的无法弄清楚这里的问题是什么。

谢谢你!

相关内容