Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I used to run a service on port 25570 I'm now changing it to run on port 25565 but I still want people who try to access it on the old port to have access to the service. So I'd like to forward port 25570 to 25565 on the same machine.

I know there's a lot of questions that talk about forwarding to a different machine but I was wondering if the method is different when using the same machine?

share|improve this question

1 Answer 1

up vote 3 down vote accepted
iptables -t nat -A PREROUTING -p tcp --dport 25570 -j REDIRECT --to-port 25565

This assumes you're not routing traffic for an entire network through this box and that if you were there's no expectation that traffic destined for other hosts will be on that port

share|improve this answer

Your Answer

 
discard

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

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