为了账号安全,请及时绑定邮箱和手机立即绑定

centos上samba服务器无法用

在安装调试samba在centos上的时候,我发现打开iptables的时候samba不能用,关闭的时候samba分享的目录就能用了,但是我试过网上很多方法添加了iptables的规则(打开了tcp的139  145 udp的 137 138)

#新增入站规则

iptables -A INPUT -p tcp -m multiport --dports 139,445 -j ACCEPT

iptables -A INPUT -p udp -m multiport --dports 137,138 -j ACCEPT

#新增出站规则

iptables -A OUTPUT -p tcp -m multiport --sports 139,445 -j ACCEPT

iptables -A OUTPUT -p tcp -m multiport --sports 137,138 -j ACCEPT

但是还是不能访问啊

补充:

selinux已经关闭

正在回答

2 回答

 这个问题和iptables的规则有关系,最好能检查下iptables规则顺序,可能是规则设置的问题。


0 回复 有任何疑惑可以回复我~
#1

majtsdd 提问者

非常感谢!
2015-07-25 回复 有任何疑惑可以回复我~

时隔多日,问题已经解决,原因正是因为 iptables 规则的顺序问题,下面附上全部的 iptables 配置信息

# Firewall configuration written by system-config-firewall
# Manual customization of this file is not recommended.
*filter
:INPUT ACCEPT [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
-A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
-A INPUT -p icmp -j ACCEPT
-A INPUT -i lo -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 22 -j ACCEPT

-A INPUT -s 192.168.22.0/24 -m state --state NEW -m tcp -p tcp --dport 445 -j ACCEPT
-A INPUT -s 192.168.22.0/24 -m state --state NEW -m udp -p udp --dport 445 -j ACCEPT

-A INPUT -s 192.168.22.0/24 -m state --state NEW -m udp -p udp --dport 137 -j ACCEPT
-A INPUT -s 192.168.22.0/24 -m state --state NEW -m udp -p udp --dport 138 -j ACCEPT
-A INPUT -s 192.168.22.0/24 -m state --state NEW -m tcp -p tcp --dport 139 -j ACCEPT

-A INPUT -j REJECT --reject-with icmp-host-prohibited
-A FORWARD -j REJECT --reject-with icmp-host-prohibited
COMMIT


0 回复 有任何疑惑可以回复我~

举报

0/150
提交
取消

centos上samba服务器无法用

我要回答 关注问题
微信客服

购课补贴
联系客服咨询优惠详情

帮助反馈 APP下载

慕课网APP
您的移动学习伙伴

公众号

扫描二维码
关注慕课网微信公众号