[Mageia-discuss] Setting up a port forward

Olav Vitters olav at vitters.nl
Fri Aug 31 14:04:48 CEST 2012


On Fri, Aug 31, 2012 at 12:41:37PM +0100, Anne Wilson wrote:
> I need to set up ssh in such a way that it comes in on a high port,
> say 5122 which is forwarded to 22 - or otherwise to have ssh listen on
> 5122.  I assume this is beyond MCC, and will entail editing iptables.
>  This is not something I'm familiar with.  Can someone please advise me?

I have in /etc/sysconfig/iptables:
# 1;3S
# Generated by iptables-save v1.3.3 on Wed Nov 16 17:30:45 2005
*nat
:PREROUTING ACCEPT [0:0]
:POSTROUTING ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
-A PREROUTING -i eth0 -p tcp -m tcp --dport 443 -j REDIRECT --to-ports 22
-A PREROUTING -i eth0 -p tcp -m tcp --dport 53 -j REDIRECT --to-ports 22
COMMIT
# Completed on Wed Nov 16 17:30:45 2005
# Generated by iptables-save v1.3.3 on Wed Nov 16 17:30:45 2005



or as iptables command:
iptables -t nat -A PREROUTING -i eth0 -p tcp -m tcp \
         --dport 443 -j REDIRECT --to-ports 22

that redirect tcp port 443 to 22 (loads of proxies allow you to CONNECT
to 443, but not to 22).

-- 
Regards,
Olav


More information about the Mageia-discuss mailing list