LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 1083|回复: 5

防火墙配置

[复制链接]
发表于 2007-7-20 17:25:23 | 显示全部楼层 |阅读模式
fedora7操作系统,想提供mysql服务,用
iptables -A  INPUT -p  tcp --dport mysql -i eth0 -j ACCEPT
添加端口,依然访问不了,只好把防火墙给关了。

哪位大虾知道一个非暴力的方法阿?
发表于 2007-7-22 21:17:54 | 显示全部楼层
mysql缺省使用的是3306端口,如果没有自己修改端口的话,用
--dport 3306 试试

还有,你是否有其他的IPTABLES的规则阻止了这个端口的开放?
回复 支持 反对

使用道具 举报

 楼主| 发表于 2007-7-23 11:32:16 | 显示全部楼层
iptables -A INPUT -p tcp --dport 3306 -i eth0 -j ACCEPT同样无效

[root@localhost ~]# iptables -L
Chain INPUT (policy ACCEPT)
target     prot opt source               destination         
ACCEPT     udp  --  anywhere             anywhere            udp dpt:domain
ACCEPT     tcp  --  anywhere             anywhere            tcp dpt:domain
ACCEPT     udp  --  anywhere             anywhere            udp dpt:bootps
ACCEPT     tcp  --  anywhere             anywhere            tcp dpt:bootps
RH-Firewall-1-INPUT  0    --  anywhere             anywhere            

Chain FORWARD (policy ACCEPT)
target     prot opt source               destination         
ACCEPT     0    --  anywhere             192.168.122.0/24    state RELATED,ESTABLISHED
ACCEPT     0    --  192.168.122.0/24     anywhere            
ACCEPT     0    --  anywhere             anywhere            
REJECT     0    --  anywhere             anywhere            reject-with icmp-port-unreachable
REJECT     0    --  anywhere             anywhere            reject-with icmp-port-unreachable
REJECT     0    --  anywhere             anywhere            reject-with icmp-host-prohibited

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination         

Chain RH-Firewall-1-INPUT (1 references)
target     prot opt source               destination         
ACCEPT     0    --  anywhere             anywhere            
ACCEPT     icmp --  anywhere             anywhere            icmp any
ACCEPT     esp  --  anywhere             anywhere            
ACCEPT     ah   --  anywhere             anywhere            
ACCEPT     udp  --  anywhere             224.0.0.251         udp dpt:mdns
ACCEPT     udp  --  anywhere             anywhere            udp dpt:ipp
ACCEPT     tcp  --  anywhere             anywhere            tcp dpt:ipp
ACCEPT     0    --  anywhere             anywhere            state RELATED,ESTABLISHED
ACCEPT     tcp  --  anywhere             anywhere            state NEW tcp dpt:ftp
ACCEPT     tcp  --  anywhere             anywhere            state NEW tcp dpt:nfs
ACCEPT     tcp  --  anywhere             anywhere            state NEW tcp dpt:ssh
ACCEPT     tcp  --  anywhere             anywhere            state NEW tcp dpt:http
ACCEPT     tcp  --  anywhere             anywhere            state NEW tcp dpt:https
ACCEPT     tcp  --  anywhere             anywhere            state NEW tcp dpt:webcache
REJECT     0    --  anywhere             anywhere            reject-with icmp-host-prohibited

不好意思,刚用linux。很多东西都不懂。
回复 支持 反对

使用道具 举报

发表于 2007-7-23 18:07:52 | 显示全部楼层
你得修改配置文件

似乎是用的redhat的发布版,我不知道这个配置文件在哪儿

不过,应该把那一句添加到RH-Firewall-1-INPUT这个链中
ACCEPT tcp -- anywhere anywhere state NEW tcp dpt:webcache
这一句后面

而不是自己写一个添加规则的脚本,那个脚本是没有作用的,因为被
RH-Firewall-1-INPUT 0 -- anywhere anywhere
这一句屏蔽了

也许,你还可以试试
iptables -I INPUT 4 -p tcp --dport mysql -i eth0 -j ACCEPT
这么写的目的是将这个规则插入到INPUT的链的第四条规则中,这样就不会被屏蔽了
回复 支持 反对

使用道具 举报

 楼主| 发表于 2007-7-25 18:23:48 | 显示全部楼层
可以了
大虾,太感谢了!
回复 支持 反对

使用道具 举报

发表于 2007-8-28 20:00:20 | 显示全部楼层
iptables -A INPUT 是将新加的规则插入到最后的,可以利用iptables -I INPUT 4这种形式来选择你要插入的规则
回复 支持 反对

使用道具 举报

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

本版积分规则

快速回复 返回顶部 返回列表