问题原文
原帖链接 · Razor · CC BY-SA 4.0
I have recently enabled ufw in Linux and found that in order for my Samba shares to mount correctly, I need to enter this command
sudo iptables -t raw -A OUTPUT -p udp -m udp --dport 137 -j CT --helper netbios-ns
However, it is somehow forgotten at the next reboot and I have to enter it every time.
Is there a way to make this iptables command stick?
已采纳解答
原帖链接 · Esa Jokinen · CC BY-SA 4.0
Iptables rules are not persistent, and UFW cannot read and save rules added directly using iptables. Instead, you should be using the UFW to add the rules, e.g.
sudo ufw allow 134/udp
Or if you have Samba application rules installed:
sudo ufw allow samba
This will allow all ports used by Samba, as the application rule is something like:
[Samba]
title=LanManager-like file and printer server for Unix
description=The Samba software suite is a collection ...
ports=137,138/udp|139,445/tcp
You could also make iptables rules persistent by installing iptables-persistence and using iptables-save, but it is not recommended to mix this with UFW.
摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。
