甲骨文云新机特殊调教
开放权限
sudo -i
卸载重装防火墙
apt purge -y iptables-persistent
iptables -L
apt update -y && apt install -y iptables-persistent
编辑文件
nano /etc/iptables/rules.v4
编辑的内容
*filter
:INPUT DROP [0:0]
:FORWARD DROP [0:0]
:OUTPUT ACCEPT [0:0]
-A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
-A OUTPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
-A INPUT -p tcp --dport 22 -j ACCEPT
-A INPUT -i lo -j ACCEPT
COMMIT
加载规则
iptables-restore < /etc/iptables/rules.v4
systemctl enable netfilter-persistent
查看链与规则
iptables -L
官网版一键脚本
curl -sS -O https://kejilion.pro/kejilion.sh && chmod +x kejilion.sh && ./kejilion.sh
加载规则
回复删除iptables-restore < /etc/iptables/rules.v4
后报错
Error occurred at line: 3
Try `iptables-restore -h' or 'iptables-restore --help' for more information.
查询iptables显示
root@instance-20240114-1136:~# iptables -L
Chain INPUT (policy ACCEPT)
target prot opt source destination
Chain FORWARD (policy ACCEPT)
target prot opt source destination
Chain OUTPUT (policy ACCEPT)
target prot opt source destination
不知为何没有加载成功,请求协助
我也是,无法restore
删除这里有个坑,要先用官网版一键脚本处理完成后再搞iptables才正常。
回复删除一键脚本那么多程序,具体是用哪个呢?谢谢。
删除编辑文件:
回复删除~# nano /etc/iptables/rules.v4
无返回
加载规则1:
~# iptables-restore < /etc/iptables/rules.v4
返回
iptables-restore v1.8.10 (nf_tables): iptables-restore: line 54 table name 'filter ' invalid
Error occurred at line: 54
Try `iptables-restore -h' or 'iptables-restore --help' for more information.
加载规则2:~# systemctl enable netfilter-persistent
返回:
Synchronizing state of netfilter-persistent.service with SysV service script with /usr/lib/systemd/systemd-sysv-install.
Executing: /usr/lib/systemd/systemd-sysv-install enable netfilter-persistent
请问哪里出错了呢?