Skip to contentSkip to conversation

udp portforward on same interface

DISCUSSION Amir Zangeneh 3 participants 4 messages Jul 14, 2003 – Jul 15, 2003 netfilter

lore
Share & tools
lore
#0 lore raw

Hi

I'm using iptables as a firewall system and I'm very pleased. But I'm trying to make a rule which forwards a udp port to another on the same interface.. I want users who connect to port 78 be redirected to port 98.. Is it possible to do this with iptables? If yes.. Could someone give me an example.. thank you..

Amir

#1 lore raw

This doesn't belong on netfilter-devel as it's clearly a user question which can even be easily answered by looking at the manpage.

Example:
iptables -t nat -A PREROUTING -i <if> -p udp --dport 78 -j REDIRECT --to-ports 98 iptables -A INPUT -i <if> -p tcp --dport 98 -j ACCEPT

Bye
Patrick

Quoted 6 lines · Amir Zangeneh

Hi

I'm using iptables as a firewall system and I'm very pleased. But I'm trying to make a rule which forwards a udp port to another on the same interface.. I want users who connect to port 78 be redirected to port 98.. Is it possible to do this with iptables? If yes.. Could someone give me an example.. thank you..

Amir

#2 lore raw
In reply to Amir Zangeneh

Hello,

first of all this is the the netfilter developing mailing list, maybe you try the users mailing list next time?? ;-)

What you want to do can easily be done with the REDIRECT target. Try something like

iptables -t nat -A PREROUTING -p udp --dport 78 -j REDIRECT --to-ports 98

Hope this helps ;-)

Sven

Quoted 6 lines · Amir Zangeneh

Hi

I'm using iptables as a firewall system and I'm very pleased. But I'm trying to make a rule which forwards a udp port to another on the same interface.. I want users who connect to port 78 be redirected to port 98.. Is it possible to do this with iptables? If yes.. Could someone give me an example.. thank you..

Amir

#3 lore raw
In reply to Amir Zangeneh

Uhhh, and don't forget to ACCEPT traffic for UDP port 98 in filter table INPUT

Sven

Quoted 6 lines · Amir Zangeneh

Hi

I'm using iptables as a firewall system and I'm very pleased. But I'm trying to make a rule which forwards a udp port to another on the same interface.. I want users who connect to port 78 be redirected to port 98.. Is it possible to do this with iptables? If yes.. Could someone give me an example.. thank you..

Amir