Rootop 服务器运维与web架构

关于samba (smb)服务使用的端口

| 暂无评论

      内网有一台服务器,里面跑着oracle,为了安全开了iptables过滤。偶尔会使用smb服务与windows之间互访文件。之前在使用的时候一般停掉防火墙,后来这样嫌麻烦。查阅samba服务使用的端口,在防火墙中修改规则即可。

[root@oracle ~]# netstat -anop | grep smb
tcp        0      0 0.0.0.0:139                 0.0.0.0:*                   LISTEN      4026/smbd           off (0.00/0/0)
tcp        0      0 0.0.0.0:445                 0.0.0.0:*                   LISTEN      4026/smbd           off (0.00/0/0)
unix  2      [ ]         DGRAM                    9910   4026/smbd
[root@oracle ~]# netstat -anop | grep nmbd
udp        0      0 192.168.1.10:137            0.0.0.0:*                               4030/nmbd           off (0.00/0/0)
udp        0      0 0.0.0.0:137                 0.0.0.0:*                               4030/nmbd           off (0.00/0/0)
udp        0      0 192.168.1.10:138            0.0.0.0:*                               4030/nmbd           off (0.00/0/0)
udp        0      0 0.0.0.0:138                 0.0.0.0:*                               4030/nmbd           off (0.00/0/0)

nmbd是属于smb服务的一个进程。

我们看到使用了tcp的139和445端口,udp的137和138端口。在防火墙中允许通行:

iptables -A INPUT -p tcp –dport 139 -j ACCEPT
iptables -A INPUT -p tcp –dport 445 -j ACCEPT
iptables -A INPUT -p udp –dport 137 -j ACCEPT
iptables -A INPUT -p udp –dport 138 -j ACCEPT

(我设定默认OUTPUT为ACCEPT,FORWARD为ACCEPT,INPUT为DROP)

在后来的测试中,仅允许tcp协议的139端口通过也能访问到共享。

原创文章,转载请注明。本文链接地址: https://www.rootop.org/pages/1303.html

作者:Venus

服务器运维与性能优化

发表回复