之前使用openwrt开启nat,就是在防火墙的端口转发中添加了samba服务的端口转发规则,结果发现不行,后来发现需要添加如下的自定义规则才行。
iptables -t nat -I PREROUTING -i eth0.2-p tcp -dport 135 -j DNAT --to-destination 192.168.120.1:135
iptables -t nat -I PREROUTING -i eth0.2-p tcp -dport 136 -j DNAT --to-destination 192.168.120.1:136
iptables -t nat -I PREROUTING -i eth0.2-p tcp -dport 137 -j DNAT --to-destination 192.168.120.1:137
iptables -t nat -I PREROUTING -i eth0.2-p tcp -dport 138 -j DNAT --to-destination 192.168.120.1:138
iptables -t nat -I PREROUTING -i eth0.2-p tcp -dport 139 -j DNAT --to-destination 192.168.120.1:139
iptables -t nat -I PREROUTING -i eth0.2-p tcp -dport 445 -j DNAT --to-destination 192.168.120.1:445