I setup openvpn at Centos vps. It has venet0 and tun0 nic. I try to open 5060 udp port for my vpn client pfsene, it shows udp port open or filter. Is these right iptables rules?

iptables -A FORWARD -d -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
iptables -t nat -A POSTROUTING -s -o venet0 -j SNAT --to-source "vps public ip"

You can simply configure iptables rules using firewall-cmd utility.

For example:

firewall-cmd --permanent --add-port=5060/udp
firewall-cmd --permanent --add-masquerade
firewall-cmd --reload
  • I setup openvpn at openVZ vps. Does it support masquerade? – Khandaker Shahriar Amin Apr 16 '18 at 12:30
  • If vps supports iptables NAT module, then MASQUERADE would be supported too – Jin JinRu Apr 16 '18 at 13:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.