how to redirect vps port to host [message #611] |
Tue, 27 December 2005 08:39 |
peian
Messages: 2 Registered: December 2005
|
Junior Member |
|
|
I want to redirect traffic towards a vps port to a host port.
e.g. 192.168.1.3 is host IP, 192.168.1.13 is a VPS ip.
I want to redirect 192.168.1.13:3456 to 192.168.1.3:80
How do I do it?
This doesn't work:
iptables -t nat -A PREROUTING -p tcp -d 192.168.1.13 --dport 3456 -j DNAT --to 192.168.1.3:80
Thanks a lot.
[Updated on: Tue, 27 December 2005 15:13] Report message to a moderator
|
|
|
|
Re: how to redirect vps port to host [message #613 is a reply to message #611] |
Tue, 27 December 2005 14:33 |
|
scythe
Messages: 22 Registered: December 2005 Location: Hungary
|
Junior Member |
|
|
Hi
I have the same problem (except Im trying to forward a port inside the vps from the host and not outside as peian above - port 8080 of host into port 80 of VPS), and I have iptable_nat loaded before vps start, as well as conntrack enabled on ve0. Probably i (we) are missing some module/setting for iptables, but i cant find which one. My config:
192.168.8.128 is the host address (running in vmware, but that shouldnt count)
10.1.1.1 is the vps address - i can ssh into the vps from the host
# iptables -t nat -A PREROUTING -p tcp -d 192.168.8.128 --dport 8080 -j DNAT --to 10.1.1.1:80
after adding this line to iptables, i just get a connection refused on 192.168.8.128:8080. All rules are set to accept, i dont use any other iptables settings currently.
Thanks for any help!
(Edit: typos)
[Updated on: Tue, 27 December 2005 14:38] Report message to a moderator
|
|
|
|
Re: how to redirect vps port to host [message #615 is a reply to message #612] |
Tue, 27 December 2005 15:09 |
peian
Messages: 2 Registered: December 2005
|
Junior Member |
|
|
dim wrote on Tue, 27 December 2005 07:05 | Do you enable iptable_nat module for your VPS?
Do you have iptable_nat module loaded before VPS start?
|
No, it's not compiled, as "iptables -nvL -t nat" showed it.
But I thought it's host problem. The traffic supposed to be intercepted by host, and not seen at all by VPS. So it doesn't matter if iptables nat is enabled or not in VPS, right?
"iptables -nvL -t nat" in host does work. It report 0 pkts and 0 bytes for prerouting chain.
Is there additional rule/chain/target I should add to iptables?
Thanks
|
|
|