when I DNAT to local address, the port num seems to be strange.
# iptables -t nat -I OUTPUT -d 1.2.3.4 -j DNAT --to 127.0.0.1
# nc -vvv -l 8888 & [1] 2038 # nc 1.2.3.4 8888& [2] 2039
# netstat -tn Active Internet connections (w/o servers) Proto Recv-Q Send-Q Local Address Foreign Address State tcp 0 0 127.0.0.1:8888 222.185.xx.xx:1025 ESTABLISHED tcp 0 0 222.185.xx.xx:53529 1.2.3.4:8888 ESTABLISHED ...(other line were lognored, and 'xx' for privacy reason)
And why the port num shows 1025? And at the mean time I also can listen to this port:
# nc -l 1025& # netstat -tnl Active Internet connections (only servers) Proto Recv-Q Send-Q Local Address Foreign Address State tcp 0 0 0.0.0.0:1025 0.0.0.0:* LISTEN
Quoted 2 lines
Subject: when I DNAT to local address, the port num seems to be strange.
If destination is 127.0.0.1, needs -j REDIRECT. You can also use -j DNAT 192.168.1.1 (i.e. the eth0 addr)
Quoted 6 lines · Jan Engelhardt
Quoted 1 line
Subject: when I DNAT to local address, the port num seems to be strange.
If destination is 127.0.0.1, needs -j REDIRECT. You can also use -j DNAT 192.168.1.1 (i.e. the eth0 addr)
I've tried as you told: REDIRECT --to-ports 8888, or -j DNAT --to LOCALADDRESS, but it nothing changes.
P.S:
$ uname -r 2.6.11-1.1369_FC4
Quoted 6 lines
Quoted 3 lines
If destination is 127.0.0.1, needs -j REDIRECT. You can also use -j DNAT 192.168.1.1 (i.e. the eth0 addr)
I've tried as you told: REDIRECT --to-ports 8888, or -j DNAT --to LOCALADDRESS, but it nothing changes.
Make sure 8888 itself is not DROPped? I am not sure what's in the FC kernel, but should not be any different. Note that PREROUTING does NOT apply if src==127.0.0.1! Currently, you only told us dst=127.0.0.1...
Jan Engelhardt
Signature · 1 line
| Alphagate Systems, http://alphagate.hopto.org/