kylin系统永久关闭iptables

1  关闭iptables, 并且相关规则写入文件firewall.rules

sudo iptables-save > /root/firewall.rules
iptables -X
iptables -t nat -F
iptables -t nat -X
iptables -t mangle -F
iptables -t mangle -X
iptables -P INPUT ACCEPT
iptables -P FORWARD ACCEPT
iptables -P OUTPUT ACCEPT
iptables-restore < /root/firewall.rules

2 开启执行恢复防火墙规则的脚本(关闭防火墙)

echo '/sbin/iptables-restore /root/firewall.rules' >>/etc/rc.local

3 由于kylin是用test登录的,所以修改rc.local的权限等

chmod 777 /etc/rc.local
chown test /etc/rc.local
chgrp test /etc/rc.local

4 重启,查看ssh能否连上主机

reboot

ssh test@ip

你可能感兴趣的:(服务器,linux,网络)