linux iptables停在载入额外iptables 模块,Linux IPTABLES 防火墙的设定

1.iptablesLinuxwangluoanquan/index.html'>防火墙启动和停止

启动iptables防火墙时命令行输入 #service iptables start

[root@host.jefflei.com ~]# service iptables start

应用 iptables 防火墙规则: [确定]

载入额外 iptables 模块:ip_conntrack_netbios_ns [确定]

要停止iptables命令行输入 #service iptables stop

[root@host.jefflei.com ~]# service iptables stop

清除防火墙规则: [确定]

把 chains 设置为 ACCEPT 策略:filter [确定]

正在卸载 Iiptables 模块: [确定]

2.查看iptables的状态

命令行输入 #service iptables status

[root@host.jefflei.com ~]# service iptables status

表格:filter

Chain INPUT (policy ACCEPT)

num target prot opt source destination

1 RH-Firewall-1-INPUT all -- 0.0.0.0/0 0.0.0.0/0

Chain FORWARD (policy ACCEPT)

num target prot opt source destination

1 RH-Firewall-1-INPUT all -- 0.0.0.0/0 0.0.0.0/0

Chain OUTPUT (policy ACCEPT)

num target prot opt source destination

Chain RH-Firewall-1-INPUT (2 references)

num target prot opt source destination

1 ACCEPT all -- 0.0.0.0/0 0.0.0.0/0

2 ACCEPT icmp -- 0.0.0.0/0 0.0.0.0/0 icmp type 255

3 ACCEPT esp -- 0.0.0.0/0 0.0.0.0/0

4 ACCEPT ah -- 0.0.0.0/0 0.0.0.0/0

5 ACCEPT udp -- 0.0.0.0/0 224.0.0.251 udp dpt:5353

6 ACCEPT udp -- 0.0.0.0/0 0.0.0.0/0 udp dpt:631

7 ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:631

8 ACCEPT all -- 0.0.0.0/0 0.0.0.0/0 state RELATED,ESTABLISHED

9 ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 state NEW tcp dpt:22

10 ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 state NEW tcp dpt:23

11 ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 state NEW tcp dpt:80

12    ACCEPT      tcp  --  0.0.0.0/0            0.0.0.0/0            state NEW tcp dpt:110

13 ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 state NEW tcp dpt:443

14 REJECT all -- 0.0.0.0/0 0.0.0.0/0 reject-with icmp-host-prohibited

*上面的输出显示了防火墙处于开启状态,并打开了22,23,80,110, 443端口

3.查看iptables规则集

要查看系统中现有的iptables规则集,可以运行以下命令:

iptables --list

4.清除原有防火墙规则.

不管你在安装linux时是否启动了防火墙,如果你想配置属于自己的防火墙,那就清除现在filter的所有规则.

[root@host.jefflei.com ~]# iptables -F 清除预设表filter中的所有规则链的规则

[root@host.jefflei.com ~]# iptables -X 清除预设表filter中使用者自定链中的规则

查看本机关于IPTABLES的设置情况

iptables -L -n

现在和安装linux时没有启动防火墙一样了.这些防火墙配置重起就会失去作用,当需要保存时使用如下命令

/etc/rc.d/init.d/iptables save

这样就可以写到/etc/sysconfig/iptables文件里了.写入后记得把防火墙重起一下,才能起作用.

service iptables restart

4.开机后自启动防火墙的设定

命令行输入 #ntsysv

[root@host.jefflei.com ~]# ntsysv

在gui中选上iptables后。确认

5.简单配置防火墙规则

[root@host.jefflei.com ~]# setup

选择 防火墙配置–》定制–》在“其他端口”中输入要开放的端口, 例:1723

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值