UDPを必要とするIPtablesの例

UDPを必要とするIPtablesの例

Centos vpsにopenvpnを設定しました。 venet0とtun0ネットワークカードがあります。 VPNクライアントpfseneに対して5060 UDPポートを開こうとしましたが、UDPポートが開いているかフィルタリングされていると表示されます。このiptablesのルールは正しいですか?

iptables -A FORWARD -d 10.8.0.2 -i venet0 -p udp -m udp --dport 5060 -j ACCEPT 
iptables -t nat -A PREROUTING -d "vps public ip" -p udp -m udp --dport 5060 -j DNAT --to-destination 10.8.0.2
iptables -t nat -A POSTROUTING -s 10.8.0.0/255.255.255.0 -o venet0 -j SNAT --to-source "vps public ip"

ベストアンサー1

iptablesユーティリティを使用して簡単にルールを設定できますfirewall-cmd

たとえば、

firewall-cmd --permanent --add-port=5060/udp
firewall-cmd --permanent --add-masquerade
firewall-cmd --reload

おすすめ記事