Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

What I want to do is say that for all UDP connections on interface ppp0 that have a destination port of 53, change that destination port to 1053.

I am attempting to change the destination port of UDP packets for VPN clients connected via PPTP on Ubuntu.

This question:
http://stackoverflow.com/questions/242772/using-iptables-to-change-a-destination-port
suggests that this can be done using NAT at the --to-destination option, for example:

iptables -t nat -A OUTPUT -p udp --dport 53 -j DNAT --to-destination x.x.x.x:1053

This does work but it changes the port for ALL packets going out on port 53 but I only want to change the port for some of my VPN clients who are connected on interface ppp0-255 and IP range 192.168.0.10-255.

I have tried adding the source into the statement, for example:

iptables -t nat -A OUTPUT -s 192.168.0.10 -p udp --dport 53 -j DNAT --to-destination x.x.x.x:1053

This however does not appear to work and the VPN connections still go through to port 53.

share|improve this question

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.