免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
12下一页
最近访问板块 发新帖
查看: 6559 | 回复: 15
打印 上一主题 下一主题

[系统安全] 关于iptables规则的问题 [复制链接]

论坛徽章:
2
巨蟹座
日期:2014-05-06 11:02:39子鼠
日期:2014-05-12 09:49:09
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2014-05-11 02:34 |只看该作者 |倒序浏览
我在vps上面搭建了一个WordPress博客。
关闭防火墙的情况下可以正常访问。
但是当我将防火墙的INPUT链的默认规则设置为DROP之后,然后只开启80端口,发现访问网站就报404错误了。。
访问网站难道还要开启其他端口??
好奇怪啊。。。
关了防火墙网站又可以正常访问了。。。

论坛徽章:
0
2 [报告]
发表于 2014-05-11 11:21 |只看该作者
用命令 iptables  -nvxL

贴出来看看

论坛徽章:
0
3 [报告]
发表于 2014-05-11 11:49 |只看该作者
iptables -nv -L 贴出你的规则!

论坛徽章:
2
巨蟹座
日期:2014-05-06 11:02:39子鼠
日期:2014-05-12 09:49:09
4 [报告]
发表于 2014-05-11 12:07 |只看该作者
aaa1111sss 发表于 2014-05-11 11:21
用命令 iptables  -nvxL

贴出来看看



[root@wsl ~]# iptables -nvxL
Chain INPUT (policy DROP 10 packets, 846 bytes)
    pkts      bytes target     prot opt in     out     source               destination         
      95     7544 ACCEPT     tcp  --  *      *       0.0.0.0/0            0.0.0.0/0           tcp dpt:22
       6     1420 ACCEPT     tcp  --  *      *       0.0.0.0/0            0.0.0.0/0           tcp dpt:80

Chain FORWARD (policy ACCEPT 0 packets, 0 bytes)
    pkts      bytes target     prot opt in     out     source               destination         

Chain OUTPUT (policy ACCEPT 83 packets, 10699 bytes)
    pkts      bytes target     prot opt in     out     source               destination         


只有2条而已。。
80已经开了,不知道为什么访问会出现404...
我现在就是开着80的,你可以试着访问一下  fivewang.info    直接出现404...

论坛徽章:
223
2022北京冬奥会纪念版徽章
日期:2015-08-10 16:30:32操作系统版块每日发帖之星
日期:2016-05-10 19:22:58操作系统版块每日发帖之星
日期:2016-02-18 06:20:00操作系统版块每日发帖之星
日期:2016-03-01 06:20:00操作系统版块每日发帖之星
日期:2016-03-02 06:20:0015-16赛季CBA联赛之上海
日期:2019-09-20 12:29:3219周年集字徽章-周
日期:2019-10-01 20:47:4815-16赛季CBA联赛之八一
日期:2020-10-23 18:30:5320周年集字徽章-20	
日期:2020-10-28 14:14:2615-16赛季CBA联赛之广夏
日期:2023-02-25 16:26:26CU十四周年纪念徽章
日期:2023-04-13 12:23:10操作系统版块每日发帖之星
日期:2016-05-10 19:22:58
5 [报告]
发表于 2014-05-11 12:07 |只看该作者
iptable感觉好多人不会哦

论坛徽章:
2
巨蟹座
日期:2014-05-06 11:02:39子鼠
日期:2014-05-12 09:49:09
6 [报告]
发表于 2014-05-11 12:08 |只看该作者
xltxb 发表于 2014-05-11 11:49
iptables -nv -L 贴出你的规则!


[root@wsl ~]# iptables -nvxL
Chain INPUT (policy DROP 10 packets, 846 bytes)
    pkts      bytes target     prot opt in     out     source               destination         
      95     7544 ACCEPT     tcp  --  *      *       0.0.0.0/0            0.0.0.0/0           tcp dpt:22
       6     1420 ACCEPT     tcp  --  *      *       0.0.0.0/0            0.0.0.0/0           tcp dpt:80

Chain FORWARD (policy ACCEPT 0 packets, 0 bytes)
    pkts      bytes target     prot opt in     out     source               destination         

Chain OUTPUT (policy ACCEPT 83 packets, 10699 bytes)
    pkts      bytes target     prot opt in     out     source               destination         


只有2条而已。。
80已经开了,不知道为什么访问会出现404...
我现在就是开着80的,你可以试着访问一下  fivewang.info    直接出现404...

论坛徽章:
2
巨蟹座
日期:2014-05-06 11:02:39子鼠
日期:2014-05-12 09:49:09
7 [报告]
发表于 2014-05-11 12:13 |只看该作者
action08 发表于 2014-05-11 12:07
iptable感觉好多人不会哦

还好吧,主要还是对应用与系统的理解,知道应用和系统需要哪些权限,这样就简单很多了。。。

论坛徽章:
0
8 [报告]
发表于 2014-05-11 21:07 |只看该作者
回复 6# gouera
注意你的OUTPUT哪里DROP了太多的包。
在那里添加一条规则如下:
iptables -A OUTPUT -p tcp --sport 80 -j ACCEPT
然后试试!

论坛徽章:
2
巨蟹座
日期:2014-05-06 11:02:39子鼠
日期:2014-05-12 09:49:09
9 [报告]
发表于 2014-05-11 22:49 |只看该作者
回复 9# xltxb


    [root@wsl ~]# !300
iptables -nvxL
Chain INPUT (policy DROP 5 packets, 300 bytes)
    pkts      bytes target     prot opt in     out     source               destination         
    4188   528351 ACCEPT     tcp  --  *      *       0.0.0.0/0            0.0.0.0/0           tcp dpt:22
     186    17742 ACCEPT     tcp  --  *      *       0.0.0.0/0            0.0.0.0/0           tcp dpt:80

Chain FORWARD (policy ACCEPT 0 packets, 0 bytes)
    pkts      bytes target     prot opt in     out     source               destination         

Chain OUTPUT (policy ACCEPT 26 packets, 12308 bytes)
    pkts      bytes target     prot opt in     out     source               destination         
       2       92 ACCEPT     tcp  --  *      *       0.0.0.0/0            0.0.0.0/0           tcp spt:80

也是不行。。。

论坛徽章:
0
10 [报告]
发表于 2014-05-11 22:55 |只看该作者
回复 11# gouera
兄弟,我测试可以正常telnet 你的80端口,应该没有问题,是不是你有什么没设置对?

   
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP