please advice:

I add next iptables rules:

iptables -I OUTPUT 2 -p udp --dport 53 -j ACCEPT
iptables -I OUTPUT 2 -p udp --dport 1700:1750 -j ACCEPT
iptables -I OUTPUT 3 -p udp -m udp --dport 1812 -j ACCEPT
iptables -I OUTPUT 5 -p udp -m udp --dport 1813 -j ACCEPT
iptables -I OUTPUT 5 -p udp -m udp --dport 5950:6050 -j ACCEPT
iptables -I OUTPUT 5 -p udp -m udp --dport 499:510 -j ACCEPT
iptables -I OUTPUT 5 -p udp -m udp --dport 4490:4550 -j ACCEPT
iptables -I OUTPUT 20 -p udp -j DROP

But, after apply: ipsec, l2tp and openvp udp port 6000 stops working

Advice, what is wrong?

Here is my udp services:

udp 0 0* 3115/charon
udp 0 0* 2885/xl2tpd
udp 0 0* 2818/openvpn
udp 0 0* 3115/charon
udp6 0 0 :::500 :::* 3115/charon 

The OUTPUT chain will better fit on servers that are "clients" of this services(like an office that have a openvpn connection with the main office).

You will have to ACCEPT the traffic that is incoming to your server and the output of those related connections depending on the service(like ftp/tcp that creates new related connections to transfer). Example on the openvpn service:

iptables -I INPUT -p udp --dport 2818 -j ACCEPT
iptables -I INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT

The last line you dont need to duplicate to every service.

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