Hi All,
I have two CentOS 5.6 boxes and trying to redirect all traffic coming on
port 80 on 192.168.1.10 to
port 8080 on 192.168.1.100.
I am using below rules, but it is not working for me.
Code:
$ iptables -A FORWARD -m state -p tcp -d 192.168.1.100 --dport 8080 --state NEW,ESTABLISHED,RELATED -j ACCEPT
$ iptables -t nat -A PREROUTING -p tcp --dport 80 -j DNAT --to-destination 192.168.1.100:8080
I tried running curl on 192.168.1.10
Code:
[root@box1 ~]# curl -i "http://192.168.1.10"
HTTP/1.1 302 Found
Date: Mon, 07 Nov 2011 13:49:58 GMT
Server: Apache
Location: /rhn/Login.do
Content-Length: 259
Content-Type: text/html; charset=iso-8859-1
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>302 Found</title>
</head><body>
<h1>Found</h1>
<p>The document has moved <a href="/rhn/Login.do">here</a>.</p>
<hr>
<address>Apache Server at 192.168.1.10 Port 80</address>
</body></html>
[root@box1 ~]#
and tcpdump on 192.168.1.100
Code:
[root@kick ~]# tcpdump -i eth0 port 8080 -vv
tcpdump: listening on eth0, link-type EN10MB (Ethernet), capture size 96 bytes
Am I missing something ?