[CentOS] Redirecting port 8080 to port 80 - how to add in /etc/sysconfig/iptables file?

Tue Jun 21 14:58:34 UTC 2016
Always Learning <centos at u68.u22.net>

On Tue, 2016-06-21 at 15:46 +0100, Always Learning wrote:

> On Tue, 2016-06-21 at 16:24 +0200, Alexander Farber wrote:
> 
> > *nat
> > :INPUT ACCEPT
> > :OUTPUT ACCEPT
> > :PREROUTING ACCEPT
> > :POSTROUTING ACCEPT
> > -A PREROUTING -p tcp --dst 144.76.184.154 --dport 8080 -j REDIRECT
> > --to-port 80
> 
> http://www.karlrupp.net/en/computer/nat_tutorial
> 
> # IMPORTANT: Activate IP-forwarding in the kernel!
> 
>    # Disabled by default!
>    $> echo "1" > /proc/sys/net/ipv4/ip_forward
> 
> ~~~~~~~~~~~~~~~
> 
> Is that a solution ?

and this ?


# TCP packets from 192.168.1.2, port 12345 to 12356
# to 123.123.123.123, Port 22
# (a backslash indicates contination at the next line)

iptables -t nat -A POSTROUTING -p tcp -s 192.168.1.2 \
     --sport 12345:12356 -d 123.123.123.123 --dport 22 [...]


-- 
Regards,

Paul.
England, EU.      England's place is in the European Union.