Re: Redirecting port 8080 to port 80 - how to add in /etc/sysconfig/iptables file?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]



Am 2016-06-21 16:58, schrieb Always Learning:
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 [...]

Both hints are irrelevant in his case.

He needs port redirection by letting iptables rewrite the TCP header destination port. There is no IP forwarding of the kernel involved. Neither does he need to do full DNAT (or whatever the incomplete cited rule should do; it lacks a target directive).

Alexander
_______________________________________________
CentOS mailing list
CentOS@xxxxxxxxxx
https://lists.centos.org/mailman/listinfo/centos



[Index of Archives]     [CentOS]     [CentOS Announce]     [CentOS Development]     [CentOS ARM Devel]     [CentOS Docs]     [CentOS Virtualization]     [Carrier Grade Linux]     [Linux Media]     [Asterisk]     [DCCP]     [Netdev]     [Xorg]     [Linux USB]
  Powered by Linux