新之助meow

Kratos
专注于用户阅读体验的响应式博客主题
  1. 首页
  2. 未分类
  3. 正文

suse ubuntu 开机自动加载iptables 规则

2016年10月11日 619点热度 0人点赞 0条评论

suse
禁用自带防火墙
# chkconfig --list | grep -i fire
SuSEfirewall2_init 0:off 1:off 2:off 3:off 4:off 5:off 6:off B:on 
SuSEfirewall2_setup 0:off 1:off 2:off 3:on 4:on 5:on 6:off
# chkconfig SuSEfirewall2_setup off #这里让系统在启动时默认不加载防火墙规则
# iptables -t filter -I input_ext 14 -p tcp --dport 22 -j ACCEPT #增加一条sshd的访问规则
# iptables-save > /root/iptables.save
# vi /etc/init.d/boot.local
iptables-restore /root/iptables.save #增加一条命令, 让系统的启动的时候自动恢复之前保存的防火墙规则....这样就OK

ubuntu

这时候需要root权限,必须是以root用户登录的,sudo是不行的。

设置root用户密码
sudo passwd root
输入新的 UNIX 密码:
重新输入新的 UNIX 密码:
passwd:已成功更新密码
这时就可以作为root登录了:
su
密码:

保存iptables规则
iptables-save > /etc/iptables-rules
ip6tables-save > /etc/ip6tables-rules

最后,我们需要编辑/etc/network/interfaces文件,在最后插入下面两行:

pre-up iptables-restore < /etc/iptables-rules
pre-up ip6tables-restore < /etc/ip6tables-rules

重启计算机以后,我们可以使用sudo iptables -L看到配置已经生效了。

 

其他linux可以参考这篇文章

https://blog.remibergsma.com/2013/02/12/automating-persistent-iptables-rules-on-red-hat-suse-and-debian/

标签: 暂无
最后更新:2016年10月11日

tjccn_wx@hotmail.com

这个人很懒,什么都没留下

点赞
< 上一篇
下一篇 >

文章评论

razz evil exclaim smile redface biggrin eek confused idea lol mad twisted rolleyes wink cool arrow neutral cry mrgreen drooling persevering
取消回复

归档

  • 2026 年 10 月
  • 2024 年 2 月
  • 2023 年 7 月
  • 2023 年 1 月
  • 2022 年 10 月
  • 2022 年 9 月
  • 2022 年 6 月
  • 2022 年 4 月
  • 2022 年 3 月
  • 2022 年 2 月
  • 2021 年 11 月
  • 2021 年 10 月
  • 2021 年 9 月
  • 2021 年 1 月
  • 2020 年 12 月
  • 2020 年 11 月
  • 2020 年 10 月
  • 2020 年 9 月
  • 2020 年 7 月
  • 2020 年 6 月
  • 2020 年 5 月
  • 2020 年 4 月
  • 2020 年 3 月
  • 2020 年 2 月
  • 2019 年 10 月
  • 2019 年 8 月
  • 2019 年 7 月
  • 2019 年 4 月
  • 2019 年 3 月
  • 2018 年 12 月
  • 2018 年 11 月
  • 2018 年 10 月
  • 2018 年 6 月
  • 2018 年 5 月
  • 2018 年 4 月
  • 2018 年 3 月
  • 2018 年 2 月
  • 2018 年 1 月
  • 2017 年 12 月
  • 2017 年 11 月
  • 2017 年 10 月
  • 2017 年 9 月
  • 2017 年 8 月
  • 2017 年 7 月
  • 2017 年 6 月
  • 2017 年 5 月
  • 2017 年 4 月
  • 2017 年 3 月
  • 2017 年 2 月
  • 2017 年 1 月
  • 2016 年 12 月
  • 2016 年 11 月
  • 2016 年 10 月
  • 2016 年 9 月
  • 2016 年 8 月
  • 2016 年 7 月
  • 2016 年 6 月
  • 2016 年 5 月
  • 2016 年 4 月
  • 2016 年 3 月
  • 2015 年 12 月
  • 2015 年 8 月

分类

  • android
  • mysql
  • nethunter
  • proxmark
  • 未分类

COPYRIGHT © 2026 新之助meow. ALL RIGHTS RESERVED.

Theme Kratos Made By Seaton Jiang